Template:Xtag: Difference between revisions
Jump to navigation
Jump to search
Created page with "<code class="nowrap">{{#switch:{{{2|pair}}} |c|close = <!--nothing--> |s|single |o|open |p|pair = <{{#switch:{{{1|}}} |categorytree=mw:Extension:CategoryTree|cate..." |
RogueScholar (talk | contribs) Fix template logic |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{#switch:{{lc:{{{2|pair}}}}} | |||
|c|close = <!--nothing--> | |c|close = <!--nothing--> | ||
|s|single | |s|single | ||
|o|open | |o|open | ||
|p|pair = <{{#switch:{{{1|}}} | |p|pair = {{#if:{{{1|}}}|<code class="nowrap"><}}{{#switch:{{lc:{{{1|}}}}} | ||
|categorytree=[[ | |categorytree=[[mediawikiwiki:Extension:CategoryTree|categorytree]] | ||
| | |dpl=[[mediawikiwiki:Extension:DynamicPageList (third-party)|DPL]] | ||
|dynamicpagelist=[[mediawikiwiki:Extension:DynamicPageList (third-party)|DynamicPageList]] | |||
| | |gallery=[[wikipedia:Help:Gallery tag|gallery]] | ||
|includeonly=[[wikipedia:Help:Template#Noinclude, includeonly, and onlyinclude|includeonly]] | |||
|gallery=[[Help:Gallery tag|gallery]] | |indicator=[[mediawikiwiki:Help:Page status indicators|indicator]] | ||
| | |imagemap=[[mediawikiwiki:Extension:ImageMap|imagemap]] | ||
|inputbox=[[mediawikiwiki:Extension:InputBox|inputbox]] | |||
|noinclude=[[wikipedia:Help:Template#Noinclude, includeonly, and onlyinclude|noinclude]] | |||
|indicator=[[ | |nowiki=[[wikipedia:Help:Nowiki|nowiki]] | ||
|imagemap=[[ | |onlyinclude=[[wikipedia:Help:Template#Noinclude, includeonly, and onlyinclude|onlyinclude]] | ||
|inputbox=[[ | |poem=[[mediawikiwiki:Extension:Poem|poem]] | ||
| | |pre=[[wikipedia:Wikipedia:PRE|pre]] | ||
|ref=[[mediawikiwiki:Extension:Cite/Cite.php|ref]] | |||
|references=[[mediawikiwiki:Extension:Cite/Cite.php|references]] | |||
|nowiki=[[Help:Nowiki|nowiki]] | |section=[[mediawikiwiki:Extension:Labeled Section Transclusion|section]] | ||
|onlyinclude=[[Help:Template#Noinclude, includeonly, and onlyinclude|onlyinclude]] | |source=[[mediawikiwiki:Extension:SyntaxHighlight|source]] | ||
|poem=[[ | |syntaxhighlight=[[mediawikiwiki:Extension:SyntaxHighlight|syntaxhighlight]] | ||
|pre=[[ | |#default={{{1|}}} | ||
|ref=[[ | |||
|references=[[ | |||
|section=[[ | |||
|source=[[ | |||
|syntaxhighlight=[[ | |||
|#default= | |||
}}{{#if:{{{params|}}}| {{{params}}}}} | }}{{#if:{{{params|}}}| {{{params}}}}} | ||
}}{{#switch:{{{2|open}}} | }}{{#switch:{{lc:{{{2|open}}}}} | ||
|c|close = {{{content|}}} | |c|close = {{{content|}}} | ||
|s|single =  /> | |s|single =  /> | ||
|o|open = >{{{content|}}} | |o|open = {{#if:{{{1|}}}|>{{{content|}}}}} | ||
|p|pair = >{{{content| | |p|pair = >{{{content|…}}} | ||
}}{{#switch:{{{2|open}}} | }}{{#switch:{{lc:{{{2|open}}}}} | ||
|s|single | |s|single | ||
|o|open = <!--nothing--> | |o|open = <!--nothing--> | ||
|c|close | |c|close | ||
|p|pair = </{{{1|tag}}}> | |p|pair = </{{{1|tag}}}> | ||
}}</code><noinclude> | }}{{#if:{{{1|}}}|</code>}}<noinclude> | ||
{{ | {{Documentation}}</noinclude> | ||
</noinclude> | |||
Latest revision as of 23:10, 5 March 2022
[edit] Template documentation
This template outputs a formatted MediaWiki parser or extension tag that links to the help or extension page about it. It is similar in function and behavior to {{Tag}}, but it links the tag and defaults to an open value for the second positional (unnamed) parameter.
Parser and extension tags
For a machine-generated list, see Special:Version#mw-version-parser-extensiontags, it may include tags not documented here.
- Parser tags
<gallery>,<includeonly>,<noinclude>,<nowiki>,<onlyinclude>and<pre>- Extension tags
<categorytree>,<DPL>,<DynamicPageList>,<imagemap>,<indicator>,<inputbox>,<poem>,<ref>,<references>,<section>and<syntaxhighlight>(alias<source>)
Parameters
- unnamed first parameter or
|1=(mandatory): the name of the tag - unnamed second parameter or
|2=(optional): what type of tag to display; valid values areooropen(default): display only the opening tag of an open-and-closed paircorclose: display only the closing tag of an open-and-closed pairsorsingle: display a single, self-closing tagporpair: display a matched pair of tags (open-and-closed)- To suppress the ellipsis (
…) which appears between the tags, add an empty|content=parameter
- To suppress the ellipsis (
|content=the text shown between the tags|params=any parameters to be included in the opening tag
Examples
Markup → renders as
{{Xtag|nowiki}}→<nowiki>
{{Xtag|nowiki|s}}→<nowiki />
{{Xtag|syntaxhighlight|p|params=enclose="div" lang="text"}}→<syntaxhighlight enclose="div" lang="text">…</syntaxhighlight>
See also
- {{Tag}}