class Juli::Macro::Template

set ERB template.

ERB template, which is used on generating HTML from juli-formatted text, can be specified by:

  1. juli(1) command line -t option.

  2. this macro

  3. .juli/config template directive.

  4. lib/juli/template

See 'doc/template(macro).txt' for the detail how to use it. Here is the implementation document.

NOTE: Template class is totally different from TemplateBase. Template is to specify ERB template, while TemplateBase is the base class to provide HTML flagment replacement in a juli document.

Public Instance Methods

on_root(file, root, visitor = nil) click to toggle source

save visitor for later use at run()

# File lib/juli/macro/template.rb, line 25
def on_root(file, root, visitor = nil)
  @visitor = visitor
end
run(*args) click to toggle source
# File lib/juli/macro/template.rb, line 29
def run(*args)
  if @visitor.respond_to?('template=')
    @visitor.template = args[0]
  end
  ''
end