lib/rtfdoc.rb in rtfdoc-0.1.2 vs lib/rtfdoc.rb in rtfdoc-0.1.3
- old
+ new
@@ -109,13 +109,17 @@
end
end
class Template
- def initialize(sections)
- @content = sections.map(&:output).join
+ attr_reader :app_name, :page_title
+
+ def initialize(sections, config)
+ @content = sections.map(&:output).join
@menu_content = sections.map(&:menu_output).join
+ @app_name = config['app_name']
+ @page_title = config['title']
end
def output
template = Erubi::Engine.new(File.read(File.expand_path('../src/index.html.erb', __dir__)))
eval(template.src)
@@ -333,10 +337,10 @@
paths.is_a?(Hash) ? Resource.build(rs, paths) : Section.new(rs, File.read(paths))
end
end
out = File.new("#{Dir.tmpdir}/rtfdoc_output.html", 'w')
- out.write(Template.new(nodes).output)
+ out.write(Template.new(nodes, config).output)
out.close
end
private