class Inversion::Template::IncludeTag
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 )
click to toggle source
Create a new IncludeTag
with the specified ‘path`.
Calls superclass method
Inversion::Template::Tag::new
# 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 )
click to toggle source
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 )
click to toggle source
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