Revision as of 16:50, 14 December 2014 editSardanaphalus (talk | contribs)119,752 editsm →Parameters: precedence, indentation← Previous edit | Revision as of 18:00, 14 December 2014 edit undoEdokter (talk | contribs)Extended confirmed users55,830 edits Rv; tables are too wide, even at 1280px wide!Next edit → | ||
Line 2: | Line 2: | ||
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --> | <!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --> | ||
: {{tc|tag |''name'' (|''type'') (|content=''text'') (|params=''parameters'')}} | |||
This template provides a quick way to mention an ]/]-style tag in a preformatted way. Mainly used |
This template provides a quick way to mention an ]/]-style tag in a preformatted way. Mainly used in discussion/help pages. | ||
===Syntax examples=== | |||
{{Syntax descriptions/three columns | |||
|style=background:ghostwhite; | |||
|col3style=padding-left:0;text-align:left; | |||
| {{sans-serif|'''Code'''<hr/>}} | <hr/> | '''Code's output'''<hr/> | |||
| <nowiki>{{tag|span}}</nowiki> | |||
| Simplest use. | |||
| {{tag|span}} | |||
| <nowiki>{{tag|span|type=close}}</nowiki> | |||
| Specifying either the open (start) or close (end) version of a tag. | |||
| {{tag|span|type=close}} | |||
| <nowiki>{{tag|span|params=class="nowrap"}}</nowiki> | |||
| To include (instances of) parameters taken by the tag. | |||
| {{tag|span|params=class="nowrap"}} | |||
| <nowiki>{{tag|span|content=some content}}</nowiki> | |||
| Adding content (text) between a tag pair or after/before the open/close version of the tag. | |||
| {{tag|span|content=some content}} | |||
| <nowiki>{{tag|style=plain|span}}</nowiki> | |||
| To set a plain(er) output or one customized using ]. | |||
| {{tag|style=plain|span}} | |||
| <hr/> | <hr/> | <hr/> | |||
}} | |||
The name of the tag (as {{mono|{{!}}name{{=}}}} or the first unnamed parameter) is required; combinations of the other parameters may be included or omitted. | |||
; Full syntax : {{tc|tag (|style=) |(name=)'''{{big|''name''}}''' (|(type=)''type'') (|params=''parameters'') (|content=''content'')}} | |||
===Parameters=== | ===Parameters=== | ||
Required parameters shown in '''''bold italics'''''. | |||
{{Parameter descriptions/with examples | |||
|class=wikitable |style=<!--background:ghostwhite;-->margin-bottom:0.75em; | |||
|colheadings=font-size:115%;text-align:left;font-weight:normal; | |||
| '''{{sans-serif|first unnamed}}''' ('''name''') | |||
| ''('''required''')'' The XML/HTML tag's name. | |||
| <nowiki>|code</nowiki>{{int:dot-separator}}<nowiki>|name=ref</nowiki> | |||
| {{bigger|type}} {{sans-serif|(second unnamed)}} | |||
:: p / pair | |||
:: o / open | |||
:: c / close | |||
:: s / single | |||
⚫ | |||
: {{nowrap|''(default)'' Complementary open (start) and close (end) tag versions.{{sup|a}}}} | |||
: Open (start) version. | |||
: Close (end) version. | |||
: Single instance. | |||
| <br/> | |||
: {{nowrap|<nowiki>|type=pair</nowiki> ({{thinsp|=}}{{!}}pair {{sans-serif|as the second unnamed parameter}}{{thinsp|=}}{{sans-serif|omitting the parameter)}}}} | |||
: <nowiki>|type=open |open </nowiki>{{sans-serif|(as second unnamed parameter)}} | |||
: <nowiki>|type=close |close </nowiki>{{sans-serif|( " )}} | |||
: <nowiki>|type=single |single </nowiki>{{sans-serif|( " )}} | |||
| params | |||
⚫ | |||
| | |||
| content | |||
⚫ | |||
| | |||
; {{bigger|''first unnamed''}} {{nobold| (''name'' above)}} : The XML/HTML tag's name (e.g. {{mono|100%|code}}, {{mono|100%|ref}}, etc). | |||
| style | |||
⚫ | ; {{bigger|second unnamed}} {{nobold| (''type'' above)}} : To indicate which of the tag's types is/are presented: | ||
| Set {{mono|{{!}}style{{=}}plain}} or {{mono|plainer}} to remove the border and non-transparent background from the default output, or set as one or more CSS styles to specify another customization. | |||
:: <kbd>p</kbd> (pair) ''(default)'' | |||
| | |||
::: A matching pair of open/start and close/end tags (e.g. {{tag|div|pair}}).<br/>To suppress the ellipsis ("...") between the tags, add an empty {{para|content}} parameter. | |||
:: <kbd>o</kbd> (open) | |||
::: An open/start tag (e.g. {{tag|span|open}}). | |||
:: <kbd>c</kbd> (close) | |||
::: A close/end tag (e.g. {{tag|span|close}}). | |||
:: <kbd>s</kbd> (single) | |||
::: A single tag (e.g. {{tag|hr|single}}). | |||
⚫ | ; {{bigger|content=}} : Text to place between open/start and close/end tags. | ||
⚫ | ; {{bigger|params=}} : Parameters to be included as part of an open/start tag. | ||
===Examples=== | ===Examples=== | ||
Line 80: | Line 27: | ||
| <nowiki>{{tag|ref|content=hello}}</nowiki> | {{tag|ref|content=hello}} | | <nowiki>{{tag|ref|content=hello}}</nowiki> | {{tag|ref|content=hello}} | ||
| <nowiki>{{tag|font|content=foo}}</nowiki> | {{tag|font|content=foo}} | | <nowiki>{{tag|font|content=foo}}</nowiki> | {{tag|font|content=foo}} | ||
| <nowiki>{{tag|font| |
| <nowiki>{{tag|font|open}}</nowiki> | {{tag|font|open}} | ||
| <nowiki>{{tag|font| |
| <nowiki>{{tag|font|open|content=hello}}</nowiki> | {{tag|font|open|content=hello}} | ||
| <nowiki>{{tag|span| |
| <nowiki>{{tag|span|close|content=hello}}</nowiki> | {{tag|span|close|content=hello}} | ||
| <nowiki>{{tag|span| |
| <nowiki>{{tag|span|pair|content=hello}}</nowiki> | {{tag|span|pair|content=hello}} | ||
| <nowiki>{{tag|ref| |
| <nowiki>{{tag|ref|open|params=group="note"}}</nowiki> | {{tag|ref|open|params=group="note"}} | ||
| <nowiki>{{tag|references|single}}</nowiki> | {{tag|references|single}} | | <nowiki>{{tag|references|single}}</nowiki> | {{tag|references|single}} | ||
| <nowiki>{{tag|br|single}}</nowiki> | {{tag|br|single}} | | <nowiki>{{tag|br|single}}</nowiki> | {{tag|br|single}} |
Revision as of 18:00, 14 December 2014
This is a documentation subpage for Template:Tag. It may contain usage information, categories and other content that is not part of the original template page. |
{{tag |name (|type) (|content=text) (|params=parameters)}}
This template provides a quick way to mention an XML/HTML-style tag in a preformatted way. Mainly used in discussion/help pages.
Parameters
Required parameters shown in bold italics.
- first unnamed (name above)
- The XML/HTML tag's name (e.g. code, ref, etc).
- second unnamed (type above)
- To indicate which of the tag's types is/are presented:
- p (pair) (default)
- A matching pair of open/start and close/end tags (e.g.
<div>...</div>
).
To suppress the ellipsis ("...") between the tags, add an empty|content=
parameter.
- A matching pair of open/start and close/end tags (e.g.
- o (open)
- An open/start tag (e.g.
<span>
).
- An open/start tag (e.g.
- c (close)
- A close/end tag (e.g.
</span>
).
- A close/end tag (e.g.
- s (single)
- A single tag (e.g.
<hr />
).
- A single tag (e.g.
- p (pair) (default)
- content=
- Text to place between open/start and close/end tags.
- params=
- Parameters to be included as part of an open/start tag.
Examples
Markup | Renders as |
---|---|
{{tag|ref}} |
|
{{tag|ref|content=}} |
|
{{tag|ref|content=hello}} |
|
{{tag|font|content=foo}} |
|
{{tag|font|open}} |
|
{{tag|font|open|content=hello}} |
|
{{tag|span|close|content=hello}} |
|
{{tag|span|pair|content=hello}} |
|
{{tag|ref|open|params=group="note"}} |
|
{{tag|references|single}} |
|
{{tag|br|single}} |
|
{{tag|!--|content=comment}} |
|
See also
- {{HTMLElement}}
- {{XMLElement}}
- {{xtag}} adds a MediaWiki parser or extension tag that links to the extension page.
- #tag:, the parser function that generates working tags.