Inversion::Template::

IncludeTag class

Inversion ‘include’ tag.

A tag that inserts other template files into the current template.

Example

<?include /an/absolute/path/to/a/different/template.tmpl ?>
<?include a/relative/path/to/a/different/template.tmpl ?>

Attributes

path R

The path of the included template

Public Class Methods

new( path, linenum=nil, colnum=nil )

Create a new IncludeTag with the specified ‘path`.

# File lib/inversion/template/includetag.rb, line 22
def initialize( path, linenum=nil, colnum=nil )
        super
        self.log.debug "Body is: %p" % [ @body ]
        @path = @body
        @included_template = nil
end

Public Instance Methods

after_appending( parsestate )

Parser callback – append the nodes from the included template onto the tree of the including template.

# File lib/inversion/template/includetag.rb, line 46
def after_appending( parsestate )
        parsestate.append_tree( @included_template.node_tree )
end
before_appending( parsestate )

Parser callback – Load the included template and check for recursive includes.

# File lib/inversion/template/includetag.rb, line 39
def before_appending( parsestate )
        @included_template = parsestate.load_subtemplate( self.path )
end