This site is supported by donations to The OEIS Foundation.
Template:Tag
From OeisWiki
The following documentation is located at Template:Tag/doc. [<Edit> Template:Tag/doc]
[⧼Purge⧽ Template:Tag]
[⧼Purge⧽ Template:Tag]
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.
Contents
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
orpair
(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
oropen
(display only the opening tag of an open-and-close pair, e.g.<span>
), -
c
orclose
(display only the closing tag of an open-and-close pair, e.g.</span>
), -
s
orsingle
(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 = <{{{tag|{{{1|tag}}}}}}{{#if:{{{attribs|}}}| {{{attribs}}}}}<!-- XHTML attributes is the proper term --> }}<!-- Content -->{{#switch: {{{type|{{{2|pair}}}}}} |c|close = {{{content|}}} |s|single =  /><!-- /> preceded by space (XHTML convention) --> |o|open = >{{{content|}}} |p|pair = {{#ifeq: {{{tag|{{{1|tag}}}}}} |!--| |>}}{{{content|...}}} }}<!-- Closing tag -->{{#switch: {{{type|{{{2|pair}}}}}} |s|single |o|open = <!-- nothing --> |c|close |p|pair = {{#ifeq: {{{tag|{{{1|tag}}}}}} |!--| -->|</{{{tag|{{{1|tag}}}}}}>}} }}</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>