W3TPL/tags

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< W3TPL
Revision as of 16:05, 14 September 2008 by Woozle (talk | contribs) (preliminary documentation; not complete or final)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Although the main "meat" of W3TPL is the (as-yet-unfinished) parser for text within <w3tpl></w3tpl> tags, there are a number of other tags which replicate much of the same functionality and may be suitable for simpler tasks.

In order to get around the parser, most of these tags have ways of using internal data for their values rather than depending on the parser to get things in the right order. to be documented

Tags

  • Text block inclusion:
    • <hide>: Runs the parser on everything in between the tags, but doesn't display the result. Useful for doing a lot of "programmish" stuff, so you can format it nicely and comment it without messing up your display
    • <echo>: overrides the "hide" attribute (and eventually the <hide> tag), i.e. displays contents
    • <load>: includes the contents of another page – like templates, but without creating a separate instance of the page object
  • <let>, <get>: much like PageVars extension, but using XML tags instead of {{#parser}} functions
  • <func>: defines a function which can be called with arguments later
    • <arg>: optional method of passing arguments to a function
    • <call>: call a previously defined function
  • Control structures:
    • <if>, <else>
    • <xploop list="\demarcated\list" repl=string-to-replace sep=separator>: Same as {{#xploop}}, but uses varname instead of $s$
  • Debugging:
    • <dump>: show list of all variables (with values) and functions (with code)

Common Attributes

  • name=: name of variable being accessed (usage depends on tag)
  • hide: if present, the contents of the tag will not be displayed except for those enclosed by <echo><echo> tags. If absent, the contents of the <echo><echo> tags are ignored and only the remainder of the content is shown. (At present, contents of the <hide> tag itself are never displayed; this will be changed to enable the <echo> tag at some point.)
    • Used in: <if>/<else>, <for>
  • parse: parse any wikitext when reading the value of a variable