Template:Xtag: Difference between revisions

From Official Kodi Wiki
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...")
 
(Fix template so that its parameters are applicable to Kodi Wiki and not one of the Wikimedia projects)
Line 1: Line 1:
<code class="nowrap">{{#switch:{{{2|pair}}}
<code class="nowrap">{{#switch:{{#lc:{{{2|pair}}}}}
  |c|close  = <!--nothing-->
  |c|close  = <!--nothing-->
  |s|single
  |s|single
  |o|open
  |o|open
  |p|pair  = &lt;{{#switch:{{{1|}}}
  |p|pair  = &lt;{{#switch:{{#lc:{{{1|}}}}}
  |categorytree=[[mw:Extension:CategoryTree|categorytree]]
  |categorytree=[[mediawikiwiki:Extension:CategoryTree|categorytree]]
  |charinsert=[[mw:Extension:CharInsert|charinsert]]
  |dpl=[[mediawikiwiki:Extension:DynamicPageList (third-party)|DPL]]
 
  |dynamicpagelist=[[mediawikiwiki:Extension:DynamicPageList (third-party)|DynamicPageList]]
  |chem=[[Help:Displaying a formula#Chemistry|chem]]
  |gallery=[[wikipedia:Help:Gallery tag|gallery]]
|ce=[[Help:Displaying a formula#Chemistry|ce]]
  |includeonly=[[wikipedia:Help:Template#Noinclude, includeonly, and onlyinclude|includeonly]]
  |gallery=[[Help:Gallery tag|gallery]]
  |indicator=[[mediawikiwiki:Help:Page status indicators|indicator]]
  |graph=[[Help:Graph|graph]]
  |imagemap=[[mediawikiwiki:Extension:ImageMap|imagemap]]
|hiero=[[mw:Extension:WikiHiero|hiero]]
  |inputbox=[[mediawikiwiki:Extension:InputBox|inputbox]]
|includeonly=[[Help:Template#Noinclude, includeonly, and onlyinclude|includeonly]]
  |noinclude=[[wikipedia:Help:Template#Noinclude, includeonly, and onlyinclude|noinclude]]
  |indicator=[[mw:Help:Page status indicators|indicator]]
  |nowiki=[[wikipedia:Help:Nowiki|nowiki]]
  |imagemap=[[mw:Extension:ImageMap|imagemap]]
  |onlyinclude=[[wikipedia:Help:Template#Noinclude, includeonly, and onlyinclude|onlyinclude]]
  |inputbox=[[mw:Extension:InputBox|inputbox]]
  |poem=[[mediawikiwiki:Extension:Poem|poem]]
  |math=[[mw:Extension:Math|math]]
  |pre=[[wikipedia:Wikipedia:PRE|pre]]
|math chem=[[Help:Displaying a formula#Chemistry|math chem]]
  |ref=[[mediawikiwiki:Extension:Cite/Cite.php|ref]]
|noinclude=[[Help:Template#Noinclude, includeonly, and onlyinclude|noinclude]]
  |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=[[mw:Extension:Poem|poem]]
  |syntaxhighlight=[[mediawikiwiki:Extension:SyntaxHighlight|syntaxhighlight]]
  |pre=[[WP:PRE|pre]]
  |#default={{{1|}}}
  |ref=[[mw:Extension:Cite/Cite.php|ref]]
  |references=[[mw:Extension:Cite/Cite.php|references]]
  |section=[[mw:Extension:Labeled Section Transclusion|section]]
|score=[[Help:Score|score]]
  |source=[[mw:Extension:SyntaxHighlight|source]]
  |syntaxhighlight=[[mw:Extension:SyntaxHighlight|syntaxhighlight]]
|templatedata=[[Wikipedia:TemplateData/Tutorial|templatedata]]
|timeline=[[mw:Extension:EasyTimeline|timeline]]
  |#default=tag
}}{{#if:{{{params|}}}|&#32;{{{params}}}}}
}}{{#if:{{{params|}}}|&#32;{{{params}}}}}
}}{{#switch:{{{2|open}}}
}}{{#switch:{{#lc:{{{2|open}}}}}
  |c|close  = {{{content|}}}
  |c|close  = {{{content|}}}
  |s|single =  &#32;/&gt;
  |s|single =  &#32;/&gt;
  |o|open  = &gt;{{{content|}}}
  |o|open  = &gt;{{{content|}}}
  |p|pair  = &gt;{{{content|...}}}
  |p|pair  = &gt;{{{content|...}}}
}}{{#switch:{{{2|open}}}
}}{{#switch:{{#lc:{{{2|open}}}}}
  |s|single
  |s|single
  |o|open  = <!--nothing-->
  |o|open  = <!--nothing-->
Line 44: Line 35:
  |p|pair  = &lt;/{{{1|tag}}}&gt;
  |p|pair  = &lt;/{{{1|tag}}}&gt;
}}</code><noinclude>
}}</code><noinclude>
{{documentation}}
{{Documentation}}</noinclude>
</noinclude>

Revision as of 16:39, 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
, , , , and
Extension tags
, , , , , , , , , and (alias )

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 are
    • o or open (default): display only the opening tag of an open-and-closed pair
    • c or close: display only the closing tag of an open-and-closed pair
    • s or single: display a single, self-closing tag
    • p or pair: display a matched pair of tags (open-and-closed)
      • To suppress the ellipsis () which appears between the tags, add an empty |content= parameter
  • |content= the text shown between the tags
  • |params= any parameters to be included in the opening tag

Examples

Markup → renders as

{{Xtag|nowiki}}
{{Xtag|nowiki|s}}
{{Xtag|syntaxhighlight|p|params=enclose="div" lang="text"}}

See also