Template:Tag/doc

From MozillaWiki
Jump to: navigation, search
Edit-copy green.svg
This is a documentation subpage for Template:Tag.
It contains usage information, categories and other content that is not part of the original template page.

Usage

This template provides a quick way to mention an XML/HTML-style tag in a preformatted way. Mainly used in discussion/help pages.

Parameters

The template has one unnamed required parameter, and three optional ones of which one is unnamed and two are named.

Required parameter

Tag name

  • 1: The XML/HTML tag's name

Enter the name of the XML/HTML tag (e.g. div, code, ref, …). Do not include the < and > brackets. No parameter name needs to be entered.

Usage:

  • {{tag|1}}

Optional parameters

Tag type

  • 2: The type of tag
p  (pair) (default)
A matching pair of open/start and close/end tags (e.g. <div>...</div>).
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. <br />).

Enter the full type name (pair, open, close or single) or the abbreviation (p, o, c or s). No parameter name needs to be entered.

Usage:

  • {{tag|1|2}}

Enclosed text

  • content: Custom text

You can provide a custom text to be enclosed by the tag you present. By default, if the {tlc|content}} parameter is left out, a tag pair (the type parameter value pair, see above) will wrap around an ellipsis ("…"). This parameter will replace the ellipsis with the provided text string. If you want to show the tag pair with neither enclosed text nor an ellipsis, include the parameter (content=), but don't enter any value (leave it empty).

Usage:

  • {{tag|1|2|content=text}}
    to display "text" enclosed by the tag pair, or
  • {{tag|1|2|content=}}
    to suppress the ellipsis ("…") between the tags

Tag parameters

  • params: Tag parameters to be included

Use this to include tag parameters (e.g. align=, class=, group=, …).

Usage:

  • {{tag|1|2|content=text|params=parameters}}

Copy-paste

You can copy the examples below for easy use. Text in italic needs to be substituted with appropriate parameter values (see above).

Description For copying
Name tagname }}
Name + type tagname |tagtype }}
Name + content tagname |content= }}
Name + content + params tagname |content= |params=}}
Full tagname |tagtype |content= |params=}}

Examples

Example case What you write What you see
Default ellipsis {{tag|ref}} <ref>...</ref>
Suppressed ellipsis {{tag|ref|content=}} <ref></ref>
Name + content {{tag|ref|content=hello}} <ref>hello</ref>
Name + type open {{tag|ref|open}} <ref>
Name + type open + content {{tag|ref|open|content=hello}} <ref>hello
Name + type close + content {{tag|span|close|content=hello}} hello</span>
Name + type pair + content {{tag|span|pair|content=hello}} <span>hello</span>
Name + type open + params {{tag|ref|open|params=group="note"}} <ref group="note">
Name + type single {{tag|br|single}} <br />

See also