Difference between revisions of "Template:Tag"

From Krafties
Jump to navigation Jump to search
m
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<onlyinclude>{|style="width:90%;margin:5px auto;border:2px solid {{{background|SlateBlue}}};background:white;border-collapse:collapse;95%"
+
{{#if:{{{plain|}}}|
!style="background:{{{background|SlateBlue}}};color:{{{color|white}}};"|{{{title}}}
+
|<code style="white-space:nowrap">
|-
+
}}{{#switch:{{{2|pair}}}
|style="text-align:{{{align|center}}};padding:3px;"|{{{message}}}
+
|c|close  = <!--nothing-->
|}<br></onlyinclude>
+
|s|single
 +
|o|open
 +
|p|pair  = &lt;{{{1|tag}}}{{#if:{{{params|}}}|&#32;{{{params}}}}}
 +
}}{{#switch:{{{2|pair}}}
 +
|c|close  = {{{content|}}}
 +
|s|single = &#32;&#47;&gt;
 +
|o|open  = &gt;{{{content|}}}
 +
|p|pair  = &gt;{{{content|...}}}
 +
}}{{#switch:{{{2|pair}}}
 +
|s|single
 +
|o|open  = <!--nothing-->
 +
|c|close
 +
|p|pair  = &lt;&#47;{{{1|tag}}}&gt;
 +
}}{{#if:{{{plain|}}}|
 +
|</code>
 +
}}<noinclude>
 +
{{documentation}}
  
{|{{TemplateExplanation}}[[Category:Tag Templates]]
+
</noinclude>
This template is made to unify the overall design of all [[:Category:Tag Templates|Tag Templates]]. But each tag can customize the color design.
 
:;This tag does not add any category, can be used as a General Notice tag
 
===Default Colors - <code><nowiki>{{Tag}}</nowiki></code>===
 
:How to fill <code><nowiki>{{Tag|title=|message=}}</nowiki></code>
 
:*<code>title=</code>Tag heading
 
:*<code>message=</code>Tag content
 
:*<code>align=</code> '''optional''', lets you change the text-align of the message
 
 
 
===With Custom Color for border/title===
 
:To add custom color, just add these in the commands (no special order, just add them behind the order-sensitive commands if any)
 
:*<code><nowiki>color=</nowiki></code> font color in {{monospace|HTML colorname}}, {{monospace|HEX}} or {{monospace|rgb()}}
 
:*<code><nowiki>background=</nowiki></code> bacground/border color in {{monospace|HTML colorname}}, {{monospace|HEX}} or {{monospace|rgb()}}
 
 
 
==When creating new tag templates==
 
:Please add the [[Template:Tag/help|Tag/help]] template at the end within the [[Template:Template Explanation|Template Explanation]]
 
==See Also==
 
{{Useful Templates}}
 
|}
 

Latest revision as of 16:11, 3 May 2017

<tag>...</tag>

Documentation icon Template documentation ( view · talk · edit)
For the page status indicator Phabricator tags, see Template:ptag.

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

Usage[edit]

  • first parameter(mandatory) the name of the HTML tag
  • second parameter — what type of tag to display:
    • p or pair(default) display a matched pair of open-and-close tags: <font>...</font>
    • o or open – display only the opening tag of an open-and-close pair: <span>
    • c or close – display only the closing tag of an open-and-close pair: </span>
    • s or single – display a single tag: <br />
  • content= — the text content of the tags
  • params= — any parameters to be included in the opening tag

Examples[edit]

  • {{tag|ref}}<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 />
The above documentation is transcluded from Template:Tag/doc.
Editors can experiment in this template's sandbox
Please add categories to the /doc subpage within <includeonly>...</includeonly>