Template:Tag: Difference between revisions
m 1 revision |
m 1 revision imported |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<code class="nowrap">{{#switch:{{{2|pair}}} | <code class="{{#ifeq:{{{wrap|}}}|yes|wrap|nowrap}}" style="{{#ifeq:{{{style|}}}|plain|border:none;background:transparent;|{{{style|}}}}}"><!-- | ||
Opening tag | |||
-->{{#switch:{{{2|pair}}} | |||
|c|close = | |||
|e|empty|s|single|v|void | |||
}}{{#switch:{{{2|pair}}} | |o|open | ||
|p|pair = <{{#if:{{{link|}}}|[[HTML element#{{{1|tag}}}|{{{1|tag}}}]]|{{{1|tag}}}}}{{#if:{{{params|{{{attribs|}}}}}}| {{{params|{{{attribs}}}}}}}} | |||
}}<!-- | |||
Content between tags | |||
-->{{#switch:{{{2|pair}}} | |||
}}{{#switch:{{{2|pair}}} | |c|close = {{{content|}}} | ||
|e|empty|s|single|v|void =  /> | |||
|o|open = >{{{content|}}} | |||
|p|pair = {{#ifeq:{{{1|tag}}}|!--||>}}{{{content|...}}} | |||
}}<!-- | |||
}}</code><noinclude> | Closing tag | ||
{{ | -->{{#switch:{{{2|pair}}} | ||
|e|empty|s|single|v|void | |||
|o|open = | |||
|c|close | |||
|p|pair = {{#ifeq:{{{1|tag}}}|!--|-->|</{{{1|tag}}}>}} | |||
}}<!-- | |||
--></code><noinclude> | |||
{{Documentation}} | |||
</noinclude> | </noinclude> |
Latest revision as of 18:42, 7 July 2021
<tag>...</tag>
This template provides a quick way to mention an XML-style tag in a preformatted way. Mainly used in discussion/help pages.
Usage
- first parameter — (mandatory) the name of the HTML tag
- second parameter — what type of tag to display:
p
orpair
– (default) display a matched pair of open-and-close tags:<font>...</font>
- To suppress the ellipsis which appears between the tags, add an empty
|content=
parameter
- To suppress the ellipsis which appears between the tags, add an empty
o
oropen
– display only the opening tag of an open-and-close pair:<span>
c
orclose
– display only the closing tag of an open-and-close pair:</span>
s
orsingle
– display a single tag:<br />
- content= — the text content of the tags
- params= — any parameters to be included in the opening tag
Examples
{{tag|ref}}
→<ref>...</ref>
{{tag|ref|content=}}
→<ref></ref>
{{tag|ref|content=hello}}
→<ref>hello</ref>
{{tag|font|content=foo}}
→<font>foo</font>
{{tag|font|open}}
→<font>
{{tag|font|open|content=hello}}
→<font>hello
{{tag|span|close|content=hello}}
→hello</span>
{{tag|span|pair|content=hello}}
→<span>hello</span>
{{tag|ref|open|params=group="note"}}
→<ref group="note">
{{tag|references|single}}
→<references />
{{tag|br|single}}
→<br />
See also
- {{HTMLElement}}
- {{XMLElement}}
- {{xtag}} adds a MediaWiki parser or extension tag that links to the extension page.
- The #tag: parserfunction generates working tags.