Template:Xtag/doc
{{Ptag}}
.File:Farm-Fresh css add.svg | This template uses TemplateStyles: |
This template adds a formatted MediaWiki parser or extension tag that links to the help or extension page. This template is similar to {{tag}}, but it links the tag and defaults to open.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Tag | 1 | The name of the Extension tag.
| Line | required |
Type | 2 | What type of tag to display, see documentation for possible values.
| String | optional |
Content | content | The text content of the tag. By default “...” for pair type, empty for others; unused if type is single. | Content | optional |
Parameters | params | Parameters (attributes) for the opening tag, unused in close type.
| Line | optional |
Plain display | plain | Avoid using monospace font and grey background for the tag.
| Boolean | optional |
Wrap? | wrap | Whether to not add `style="white-space: nowrap;"` to the enclosing <code> tag.
| Boolean | optional |
Parameters
- first parameter (mandatory): the name of the HTML tag
- second parameter: what type of tag to display:
p
orpair
: display a matched pair of open-and-close tags- To suppress the ellipsis which appears between the tags, add an empty
|content=
parameter
- To suppress the ellipsis which appears between the tags, add an empty
o
oropen
(default): display only the opening tag of an open-and-close pairc
orclose
: display only the closing tag of an open-and-close pairs
orsingle
: display a single tag
- content= the text content of the tags
- params= any parameters to be included in the opening tag
Examples
{{| style="table-layout: fixed; width: 100%; border-width: medium; margin-left: 0em;"
! style="width:50%" scope="col" | Markup
! style="width:50%" scope="col" | Renders as
|-
{{xtag|nowiki}}
| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | <nowiki>
|-
{{xtag|nowiki|close | content = <nowiki>{{{content}}}</nowiki> | params = {{attr|foo|"bar"}} }}
| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | {{{content}}}</nowiki>
|-
{{xtag|nowiki|single | content = <nowiki>{{{content}}}</nowiki> | params = {{attr|foo|"bar"}} }}
| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | <nowiki foo="bar" />
|-
{{xtag|nowiki|open | content = <nowiki>{{{content}}}</nowiki> | params = {{attr|foo|"bar"}} }}
| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | <nowiki foo="bar">{{{content}}}
|-
{{xtag|nowiki|pair | content = <nowiki>{{{content}}}</nowiki> | params = {{attr|foo|"bar"}} }}
| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | <nowiki foo="bar">{{{content}}}</nowiki>
|-
| style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |
| style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |
|}}
Markup → Renders as:
{{xtag|templatestyles|s|params=
→{{attr|lang|"Template:Uses TemplateStyles/example.css"}}
}}<templatestyles src="Template:Uses TemplateStyles/example.css" />
{{xtag|syntaxhighlight|p|params=
→{{attr|lang|"text"}}
}}<syntaxhighlight lang="text">...</syntaxhighlight>
This is the documentation page, it should be transcluded into the main template page. See Template:Doc for more information.