Misplaced Pages

Template:Tag/doc: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< Template:Tag Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
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&#32;|''name''&#32;(|''type'')&#32;(|content&#61;''text'')&#32;(|params&#61;''parameters'')}}
This template provides a quick way to mention an ]/]-style tag in a preformatted way. Mainly used on discussion/help pages. 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/>}} | &nbsp;<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&#32;(|style&#61;)&#32;|(name&#61;)'''{{big|''name''}}'''&#32;(|(type&#61;)''type'')&#32;(|params&#61;''parameters'')&#32;(|content&#61;''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''')''&nbsp; 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
| To indicate which of the tag's types/versions is/are presented:
: {{nowrap|''(default)''&nbsp; 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|&#61;}}{{!}}pair {{sans-serif|as the second unnamed parameter}}{{thinsp|&#61;}}{{sans-serif|omitting the parameter)}}}}
: <nowiki>|type=open |open </nowiki>{{sans-serif|(as second unnamed parameter)}}
: <nowiki>|type=close |close </nowiki>{{sans-serif|(&nbsp;"&nbsp;)}}
: <nowiki>|type=single |single </nowiki>{{sans-serif|(&nbsp;"&nbsp;)}}

| params
| Parameters to be included as part of an open/start tag.
|

| content
| Content to place between open/start and close/end tags, or after/before a single open/close tag.
|


; {{bigger|''first unnamed''}} {{nobold|&nbsp;(''name'' above)}} : The XML/HTML tag's name (e.g. {{mono|100%|code}}, {{mono|100%|ref}}, etc).
| style
; {{bigger|second unnamed}} {{nobold|&nbsp;(''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> &nbsp;(pair) ''(default)''
|
}} {{sup|a}} To suppress the ellipsis ("...") between the tags, add an empty {{mono|content}} parameter ({{thinsp|{{mono|... {{!}}content{{=}}{{))}}}}}}). ::: 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> &nbsp;(open)
::: An open/start tag (e.g. {{tag|span|open}}).
:: <kbd>c</kbd> &nbsp;(close)
::: A close/end tag (e.g. {{tag|span|close}}).
:: <kbd>s</kbd> &nbsp;(single)
::: A single tag (e.g. {{tag|hr|single}}).
; {{bigger|content&#61;}} : Text to place between open/start and close/end tags.
; {{bigger|params&#61;}} : 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|type=open}}</nowiki> | {{tag|font|type=open}} | <nowiki>{{tag|font|open}}</nowiki> | {{tag|font|open}}
| <nowiki>{{tag|font|type=open|content=hello}}</nowiki> | {{tag|font|type=open|content=hello}} | <nowiki>{{tag|font|open|content=hello}}</nowiki> | {{tag|font|open|content=hello}}
| <nowiki>{{tag|span|type=close|content=hello}}</nowiki> | {{tag|span|type=close|content=hello}} | <nowiki>{{tag|span|close|content=hello}}</nowiki> | {{tag|span|close|content=hello}}
| <nowiki>{{tag|span|type=pair|content=hello}}</nowiki> | {{tag|span|type=pair|content=hello}} | <nowiki>{{tag|span|pair|content=hello}}</nowiki> | {{tag|span|pair|content=hello}}
| <nowiki>{{tag|ref|type=open|params=group="note"}}</nowiki> | {{tag|ref|type=open|params=group="note"}} | <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.
o  (open)
An open/start tag (e.g. <span>).
c  (close)
A close/end tag (e.g. </span>).
s  (single)
A single tag (e.g. <hr />).
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}}

<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 />

{{tag|!--|content=comment}}

<!--comment-->

See also

Template:Interwikitmp-grp