Difference between revisions of "W3TPL/tags"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(the <trace> tag was apparently retired some time ago)
(Replaced content with "{{to wooz}}")
Tag: Replaced
 
Line 1: Line 1:
==About==
+
{{to wooz}}
Although the main "meat" of [[W3TPL]] is the (as-yet-unfinished) parser for text within {{xmltag|w3tpl}}{{xmltag|/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''
 
 
 
One of the weaknesses of the MediaWiki parser is that it cannot deal with nested tags properly; the ending-tag of a tag-pair nested inside another tag-pair results in closure of the ''outer'' tag-pair as well, and any text past the internal closing-tag is displayed rather than being passed to the tag handler. W3TPL allows you to get around this limitation by defining ''functions'' which are parsed separately from the code-block in which they are executing.
 
 
 
==Tags==
 
{|
 
|-
 
! alphabetical !! by function
 
|-
 
| valign=top |
 
* {{w3tpl/tag|arg}}
 
* {{w3tpl/tag|call}}
 
* {{w3tpl/tag|class}}
 
* {{w3tpl/tag|dump}}
 
* {{w3tpl/tag|echo}}
 
* {{w3tpl/tag|else}}
 
* {{w3tpl/tag|for}}
 
* {{w3tpl/tag|func}}
 
* {{w3tpl/tag|get}}
 
* {{w3tpl/tag|hide}}
 
* {{w3tpl/tag|if}}
 
* {{w3tpl/tag|let}}
 
* {{w3tpl/tag|load}}
 
* {{w3tpl/tag|save}}
 
* {{w3tpl/tag|w3tpl}}
 
* {{w3tpl/tag|xploop}}
 
| valign=top |
 
* '''Text block inclusion''':
 
** '''{{w3tpl/tag|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
 
** '''{{w3tpl/tag|echo}}''': overrides the "hide" attribute (and eventually the {{xmltag|hide}} tag), i.e. displays contents
 
** '''{{w3tpl/tag|load}}''': includes the contents of another page &ndash; like templates, but without creating a separate instance of the page object
 
* '''{{w3tpl/tag|let}}, {{w3tpl/tag|get}}''': much like PageVars extension, but using XML tags instead of <nowiki>{{#parser}}</nowiki> functions
 
* '''{{w3tpl/tag|func}}''': defines a function which can be called with arguments later
 
** '''{{w3tpl/tag|arg}}''': optional method of passing arguments to a function
 
** '''{{w3tpl/tag|call}}''': call a previously defined function
 
* '''Control structures''':
 
** '''{{w3tpl/tag|if}}, {{w3tpl/tag|else}}'''
 
** '''{{w3tpl/tag|for}}
 
** '''{{w3tpl/tag|xploop}}: Same as <nowiki>{{#xploop}}</nowiki>, but uses varname instead of $s$
 
*** '''syntax''': xploop list="\demarcated\list" repl=string-to-replace sep=separator
 
* '''Debugging''':
 
** '''{{w3tpl/tag|dump}}''': show list of all variables (with values) and functions (with code)
 
* '''In development''':
 
** '''{{w3tpl/tag|class}}'''
 
** '''{{w3tpl/tag|w3tpl}}''': currently, is only used for disabling cache; will later enclose blocks of executable w3tpl code
 
* '''Content management''':
 
** '''{{w3tpl/tag|load}}'''
 
** '''{{w3tpl/tag|save}}''' - experimental; may not be useful without a lot more support
 
|}
 
 
 
==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 {{w3tpl/tag|echo}}{{w3tpl/tag|echo}} tags. If absent, the contents of the {{w3tpl/tag|echo}}{{w3tpl/tag|echo}} tags are ignored and only the remainder of the content is shown. (At present, contents of the {{w3tpl/tag|hide}} tag itself are never displayed; this will be changed to enable the {{xmltag|echo}} tag at some point.)
 
** '''Used in''': {{w3tpl/tag|if}}/{{w3tpl/tag|else}}, {{w3tpl/tag|for}}
 
* '''parse''': parse any wikitext when reading the value of a variable
 

Latest revision as of 20:01, 15 April 2022

Wooz-dev-logo.take 1.crop.1200pxw.png This page has been moved to wooz.dev, User:Woozle's coding site.