Class: Juli::Macro::Template

Inherits:
Base
  • Object
show all
Defined in:
lib/juli/macro/template.rb

Overview

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.

Instance Method Summary collapse

Methods inherited from Base

#after_root, conf_template, #initialize, #set_conf_default

Methods included from Util

#camelize, conf, find_template, in_filename, juli_repo, mkdir, out_filename, str_limit, str_trim, to_wikiname, underscore, usage, visitor, visitor_list

Constructor Details

This class inherits a constructor from Juli::Macro::Base

Instance Method Details

#on_root(file, root, visitor = nil) ⇒ Object

save visitor for later use at run()



25
26
27
# File 'lib/juli/macro/template.rb', line 25

def on_root(file, root, visitor = nil)
  @visitor = visitor
end

#run(*args) ⇒ Object



29
30
31
32
33
34
# File 'lib/juli/macro/template.rb', line 29

def run(*args)
  if @visitor.respond_to?('template=')
    @visitor.template = args[0]
  end
  ''
end