Library: tags
Overview
Functional HTML tag writing.
This library allows you to write HTML in the form of nested function calls. By default, a function is predefined for each tag, with the function name being in all caps. A dictionary of HTML attributes can optionally be passed as a first argument to a tag; other arguments become child tags. Attribute names that conflict with JavaScript keywords have been renamed; use "className" in place of "class" and "htmlFor" in place of "for".
Tag objects inherit from Array, so array methods can be used to manipulate a tag's list of child tags.
source: tags.js
examples
print(P({id="sec3"},"Tags are ",B(I("crazy"))," awesome."));
Functions
Imports a specified list of tags. All HTML tags are automatically imported
by default, but you may wish to use the tag library to write other kinds
of mark-up. For each tag you want to import, pass in the name (including
any punctuation) with the (upper/lower) case you want to use for the function
(traditionally all uppercase). The function name will have punctuation
replaced with underscores, and the printed tag will be all lowercase.
parameters
| object | scopeObj |
where to define the tags; to define in the global scope, pass this from the top level (not from inside a function)
|
| array | tagArray | an array of strings, the tags to import |
examples
importTags(this, ["MEDIA:TITLE"]);
print(MEDIA_TITLE({type:"html"}, "funny pictures"));
// prints <media:title type="html">funny pictures</media:title>