Noel Tags
Noel can define and extend custom HTML-like tags in order to abstract out
duplicate or complex content. Tags are initially defined using the built-in
<TAG> tag. Unmatched tags (including regular HTML tags) are ignored by
the Noel parser.
<foo>
<tag Foo><b>squee!</b></tag> <foo>
<foo> <Tag foo>42</Tag> <foo>
| => |
<foo>
<b>squee!</b>
<foo> 42
|
Tag names, like variable names, must begin
with a letter and can contain letters, digits, dashes (-), and underscores (_).
Unlike variable names, tag names are not case sensitive. Tag definitions
can be nested inside tag definitions.
Tag Resolution
When the Noel parser encounters a custom tag in the output, the tag is replaced
with the custom tag contents. Sometimes you will have tags that may or may
not be defined (especially within higher-level template files). You can use
silent tag notation, similar to silent variable notation, to hide
tags when no matching custom tag is defined.
<foo>...
<!foo>...
| => |
<foo>...
...
|
There is also an <IFTAG> conditional
for more complex behavior based on tag existence.
Extending Tags
Content can be inserted into an existing tag (creating the tag if it is
undefined) using the built-in <INSERTTAG> tag.
<Tag Site>-- Site Header --<p></Tag>
<InsertTag Site>Content</InsertTag>
<Site>
-- Site Header --<p>Content
|
By default content is appended to the end of a tag, but insertion points
can be used to insert content into different locations within a tag. The default
insertion point is '<<>>'. Insertion points can be
inserted/relocated by the insert content.
<Tag Site>Header <<>> Footer</Tag>
<InsertTag Site>Content</InsertTag>
<InsertTag Site>...<<>> More</InsertTag>
<InsertTag Site>!!!</InsertTag>
<Site>
Header Content...!!! More Footer
|
The special insertion points 'TOP' and 'BOTTOM' can be used for prepending or
appending content to a tag.
<Tag Site>FOO <<>> BAR</Tag>
<InsertTag Site>middle</InsertTag>
<InsertTag Site@TOP>top </InsertTag>
<InsertTag Site@BOTTOM> bottom</InsertTag>
<Site>
top FOO middle BAR bottom
|
Insertion points can be escaped by using a Copy Content
delimiter around the first two less-than signs, i.e..:
<!!::<<::>>>. Insertion points are not escaped when they
are completely enclosed within a Copy Content section; this allows
Javascript and CSS to be easily inserted into copy content-delimited sections
of a page.
Local Tags
Local tags are tags within tags which can be referenced using the 'insertion
point' format given above. Local tags can be defined using the notation
"<Tag parentTagName@localTagName>" and extended using
the notation "<InsertTag parentTagName@localTagName>".
<Tag Header><HTML><Head><Title><TITLE></Title></Head></Tag>
<InsertTag Header@TITLE>Site Name</InsertTag>
<InsertTag Header@TITLE> - Section Name</InsertTag>
<InsertTag Header@TITLE> - Page Name</InsertTag>
<Header>
<HTML><Head><Title>Site Name - Section Name - Page Name</Title></Head>
|
Like local variables, local tags only exist within the context of their parent tag;
changes to local tags do not effect parent or children tags.
If you insert into a local tag but the tag is never used in its parent tag,
the content is discarded (without any error or warning.)
Undefining Tags
Tags can also be undefined via the built-in <UNDEFTAG> tag. Example:
<undeftag Foo>
|