Template talk:Tag

From Wikibooks, open books for an open world
Latest comment: 13 years ago by Adrignola in topic Update 3
Jump to navigation Jump to search

Update

[edit source]

{{editprotected}} Can the code be updated to the following? This ensures proper display of the single XHTML tags (added a space), and makes {{{content}}} also show with open and close. Updated code from en:Template:Tag. Edokter (talk) 15:45, 14 January 2011 (UTC)Reply

<code style="white-space:nowrap;">{{#switch:{{{2|pair}}}
 |close
 |single   = <!--nothing-->
 |open
 |pair
 |#default = &lt;{{{1|tag}}}{{#if:{{{params|}}}|&#32;{{{params}}}}}&gt;
}}{{#switch:{{{2|pair}}}
 |single   = <!--nothing-->
 |open
 |close
 |pair
 |#default = {{{content|}}}
}}{{#switch:{{{2|pair}}}
 |open
 |single   = <!--nothing-->
 |close
 |pair
 |#default = &lt;&#47;{{{1|tag}}}&gt;
}}{{#switch:{{{2|pair}}}
 |single   = &lt;{{{1|tag}}}{{#if:{{{params|}}}|&#32;{{{params}}}}}&#32;&#47;&gt;
}}</code><noinclude>
{{documentation}}
</noinclude>
Done. Thanks for letting us know. It's hard to track all the templates' changes at en.wiki. – Adrignola talk 15:52, 14 January 2011 (UTC)Reply

Update 2

[edit source]

{{editprotected}} Optimized code and added shortcuts. Edokter (discusscontribs) 12:45, 23 January 2011 (UTC)Reply

<code style="white-space:nowrap;">{{#switch:{{{2|pair}}}
 |c|close  = <!--nothing-->
 |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
 |p|pair   = &gt;{{{content|}}}
}}{{#switch:{{{2|pair}}}
 |s|single
 |o|open   = <!--nothing-->
 |c|close
 |p|pair   = &lt;&#47;{{{1|tag}}}&gt;
}}</code><noinclude>
{{documentation}}
</noinclude>
Done. – Adrignola discuss 17:47, 23 January 2011 (UTC)Reply

Update 3

[edit source]

{{editprotected}} Established convention uses "..." to seperate begin- and end tags with no content. Please replace:

 |o|open
 |p|pair   = >{{{content|}}}

with:

 |o|open   = >{{{content|}}}
 |p|pair   = >{{{content|...}}}

Thank you. Edokter (talk) — 23:19, 19 June 2011 (UTC)Reply

Done. – Adrignola discuss 13:18, 20 June 2011 (UTC)Reply