|
|
Line 1: |
Line 1: |
| <noinclude>This template is used to create context labels, such as [[Template:countable]]. | | <noinclude>This template is used to create context labels, such as [[Template:countable]]. |
| </noinclude><includeonly><!-- | | </noinclude><includeonly>(<span style="color:green;">''{{{1|}}}''</span>[[Category:Context labels|{{PAGENAME}}]]{{#if:{{{2|}}}|[[Category:{{{2|}}}|{{PAGENAME}}]]}}{{#if:{{{3|}}}|[[Category:{{{3|}}}|{{PAGENAME}}]]}}</includeonly> |
| if not in a sub call, open paren, content span
| |
| -->{{#if:{{{sub|}}}||<span class="ib-brac"><span class="qualifier-brac">(</span></span><span class="ib-content"><span class="qualifier-content">}}<!--
| |
| if label, generate it
| |
| -->{{#if:{{{label|}}}|{{{label}}}}}<!--
| |
| if special follows, generate it
| |
| -->{{#switch:{{{1|x}}}|,=<span class="ib-comma"><span class="qualifier-comma">,</span></span> |or= or |and= and |_= }}<!--
| |
| if something follows that is a special, recall on next parameter (ignore case of special on the end)
| |
| -->{{#if:{{{1|}}}| {{{{#switch:{{{1}}}|,|or|and|_=context {{#expr:{{{sub|0}}}+1}}|ns:0}}|sub={{#expr:{{{sub|0}}}+1}}|lang={{{lang|}}}|skey={{{skey|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}} }}<!--
| |
| default case(s) from switch, we have a template or string, generate comma if we had a label
| |
| -->{{#switch:{{{1}}}|,|or|and|_=|#default={{#if:{{{label|}}}|<span class="ib-comma"><span class="qualifier-comma">,</span></span> }}<!--
| |
| if template exists, call it, else call ourselves, avoid extra expansion by conditional on name
| |
| -->{{ {{#if:{{{1|}}}|{{#ifexist:Template:{{{1}}}|{{{1}}}|context {{#expr:{{{sub|0}}}+1}}}}|ns:0}} |label={{{1}}}
| |
| |sub={{#expr:{{{sub|0}}}+1}}|lang={{{lang|}}}|skey={{{skey|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}} }}<!--
| |
| -->}}}}<!-- end switch, if {1}
| |
| if not in sub, close content span, paren
| |
| -->{{#if:{{{sub||}}}||</span></span><span class="ib-brac"><span class="qualifier-brac">)</span></span>}}<!--
| |
| if in namespace 0, if topic category
| |
| -->{{#if:{{NAMESPACE}}||{{#if:{{{topcat|}}}|{{#if:{{{skey|}}}|
| |
| [[Category:{{#if:{{{lang|}}}|{{#ifeq:{{{lang}}}|en||{{{lang}}}:}}}}{{{topcat|}}}|{{{skey}}} {{PAGENAME}}]]| | |
| [[Category:{{#if:{{{lang|}}}|{{#ifeq:{{{lang}}}|en||{{{lang}}}:}}}}{{{topcat|}}}]]}}}}<!--
| |
| if pos or pos-like cat
| |
| -->{{#if:{{{poscat|}}}|{{#if:{{{skey|}}}|
| |
| [[Category:{{{{#if:{{{poscat|}}}|language|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}}|{{{skey}}} {{PAGENAME}}]]| | |
| [[Category:{{{{#if:{{{poscat|}}}|language|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}}]]}}}}<!--
| |
| regional templates
| |
| -->{{#if:{{{regcat|}}}|{{#if:{{{skey|}}}|
| |
| [[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|language|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}}]]| | |
| [[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|language|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}}]]}}}} }}<!--
| |
| cat templates themselves
| |
| -->{{#ifeq:{{NAMESPACE}}|{{ns:template}}|
| |
| {{#if:{{{topcat|}}}|[[Category:{{{topcat}}}| ]]}}<!--
| |
| -->{{#if:{{{poscat|}}}|[[Category:English {{{poscat}}}| ]]}}<!--
| |
| -->{{#if:{{{regcat|}}}|[[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|language|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}}| ]]}}<!--
| |
| -->[[Category:Context labels|{{PAGENAME}}]]}}</includeonly>
| |
This template is used to create context labels, such as Template:countable.