This site is supported by donations to The OEIS Foundation.

Template:Tag

From OeisWiki
Jump to: navigation, search


The {{tag}} typing-aid template provides a quick way to mention an XHTML (XML-style HTML) tag in a preformatted way. Mainly used in discussion/help pages.

Usage

{{tag|tag|type}}

or

{{tag|tag|type|content = content|attribs = attribs}}

or

{{tag|tag = tag|type = type|content = content|attribs = attribs}}

where

  • first parameter or tag (mandatory): the name of the XHTML tag (or of the comment start !--);
  • second parameter or type: what type of tag to display, i.e.
    • p or pair (default) (display a matched pair of open-and-close tags, e.g. <font>...</font>)
    (to suppress the ellipsis which appears between the tags, add an empty content = parameter),
    • o or open (display only the opening tag of an open-and-close pair, e.g. <span>),
    • c or close (display only the closing tag of an open-and-close pair, e.g. </span>),
    • s or single (display a single tag, e.g. <br />);
  • content: the text content of the tags;
  • attribs: any attributes to be included in the opening tag.

Examples

Code Result
{{tag|!--}} <!-- ... -->
{{tag|!--|content =}} <!-- -->
{{tag|!--|content = Really!}} <!-- Really! -->
{{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|attribs = group="note"}} <ref group="note">
{{tag|references|single}} <references />
{{tag|br|single}} <br />
{{tag|table|attribs = width="90%" height="512px"}} <table width="90%" height="512px">...</table>

Code

<noinclude>{{Documentation}}</noinclude><!--

  From Wikipedia (slightly edited, e.g. attribs (XHTML attributes is the proper term) instead of params)

--><code style="white-space: nowrap;"><!--

  Opening tag

-->{{#switch: {{{type|{{{2|pair}}}}}}
 |c|close  = <!-- nothing -->
 |s|single
 |o|open
 |p|pair   = &lt;{{{tag|{{{1|tag}}}}}}{{#if:{{{attribs|}}}|&#32;{{{attribs}}}}}<!-- XHTML attributes is the proper term -->
}}<!--

  Content

-->{{#switch: {{{type|{{{2|pair}}}}}}
 |c|close  = {{{content|}}}
 |s|single = &#32;&#47;&gt;<!-- /> preceded by space (XHTML convention) -->
 |o|open   = &gt;{{{content|}}}
 |p|pair   = {{#ifeq: {{{tag|{{{1|tag}}}}}} |!--|&#32;|&gt;}}{{{content|...}}}
}}<!--

  Closing tag

-->{{#switch: {{{type|{{{2|pair}}}}}}
 |s|single
 |o|open   = <!-- nothing -->
 |c|close
 |p|pair   = {{#ifeq: {{{tag|{{{1|tag}}}}}} |!--|&#32;--&gt;|&lt;&#47;{{{tag|{{{1|tag}}}}}}&gt;}}
}}</code>

See also

  • {{HTML Element}}
  • {{XML Element}}
  • {{xtag}} adds a MediaWiki parser (or parser extension) tag that links to the parser (or parser extension) page.
  • The #tag: parser function generates delayed XHTML tags, which allows templates, parser functions and magic words to be used inside a tag that normally doesn't, e.g. the <math>...</math> tag.<tag>...</tag>