Class: RDocF95::TemplatePage

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc-f95/template.rb

Instance Method Summary collapse

Constructor Details

#initialize(*templates) ⇒ TemplatePage

Create a new TemplatePage that will use templates.



34
35
36
# File 'lib/rdoc-f95/template.rb', line 34

def initialize(*templates)
  @templates = templates
end

Instance Method Details

#href(ref, name) ⇒ Object

Returns “<a href="#ref">#name</a>”



41
42
43
44
45
46
47
# File 'lib/rdoc-f95/template.rb', line 41

def href(ref, name)
  if ref then
    "<a href=\"#{ref}\">#{name}</a>"
  else
    name
  end
end

#write_html_on(io, values) ⇒ Object

Process the template using values, writing the result to io.



52
53
54
55
56
57
58
59
60
61
# File 'lib/rdoc-f95/template.rb', line 52

def write_html_on(io, values)
  b = binding
  template_include = ""

  @templates.reverse_each do |template|
    template_include = ERB.new(template).result b
  end

  io.write template_include
end