5 <n from="Template:context" to="Template:Context" />
8 <page pageid="279373" ns="0" title="Template:Context">
10 <rev timestamp="2011-08-29T20:15:35Z" contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve"><includeonly><!--
11 if not in a sub call, open paren, content span
12 -->{{#if:{{{sub|}}}||<span class="ib-brac"><span class="qualifier-brac">(</span></span><span class="ib-content"><span class="qualifier-content">}}<!--
14 -->{{#if:{{{label|}}}|{{{label}}}}}<!--
15 if special follows, generate it, no space at end or before explicit comma
16 -->{{#switch:{{{1|x}}}|,=<span class="ib-comma"><span class="qualifier-comma">,</span></span>&#32;|or=&#32;or&#32;|and=&#32;and&#32;|_={{#switch:{{{2|x}}}|,|=|&#32;}}}}<!--
17 do cats before recursion, so in order given; if in namespace 0, if topic category
18 -->{{#switch:{{NAMESPACE}}|Appendix|={{#if:{{{topcat|}}}|{{#if:{{{skey|}}}|
19 [[Category:{{#if:{{{lang|}}}|{{{lang}}}:|en:}}{{{topcat|}}}|{{{skey}}} {{SUBPAGENAME}}]]{{#if:{{{script|}}}|[[Category:{{#if:{{{lang|}}}|{{{lang}}}:|en:}}{{{topcat|}}} in {{{script}}} script|{{{skey}}} {{SUBPAGENAME}}]]}}{{#if:{{{script2|}}}|[[Category:{{#if:{{{lang|}}}|{{{lang}}}:|en:}}{{{topcat|}}} in {{{script2}}} script|{{{skey2}}} {{SUBPAGENAME}}]]}}|
20 [[Category:{{#if:{{{lang|}}}|{{{lang}}}:|en:}}{{{topcat|}}}|{{SUBPAGENAME}}]]{{#if:{{{script|}}}|[[Category:{{#if:{{{lang|}}}|{{{lang}}}:|en:}}{{{topcat|}}} in {{{script}}} script|{{SUBPAGENAME}}]]}}{{#if:{{{script2|}}}|[[Category:{{#if:{{{lang|}}}|{{{lang}}}:|en:}}{{{topcat|}}} in {{{script2}}} script|{{SUBPAGENAME}}]]}}}}}}<!--
21 if pos or pos-like cat
22 -->{{#if:{{{poscat|}}}|{{#if:{{{skey|}}}|
23 [[Category:{{{{#if:{{{poscat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}}|{{{skey}}} {{SUBPAGENAME}}]]{{#if:{{{script|}}}|[[Category:{{{{#if:{{{poscat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}} in {{{script}}} script|{{{skey}}} {{SUBPAGENAME}}]]}}{{#if:{{{script2|}}}|[[Category:{{{{#if:{{{poscat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}} in {{{script2}}} script|{{{skey2}}} {{SUBPAGENAME}}]]}}|
24 [[Category:{{{{#if:{{{poscat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}}|{{SUBPAGENAME}}]]{{#if:{{{script|}}}|[[Category:{{{{#if:{{{poscat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}} in {{{script}}} script|{{SUBPAGENAME}}]]}}{{#if:{{{script2|}}}|[[Category:{{{{#if:{{{poscat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} {{{poscat|}}} in {{{script2}}} script|{{SUBPAGENAME}}]]}}}}}}<!--
26 -->{{#if:{{{regcat|}}}|{{#if:{{{skey|}}}|
27 [[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}}|{{{skey}}} {{SUBPAGENAME}}]]{{#if:{{{script|}}}|[[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} in {{{script}}} script|{{{skey}}} {{SUBPAGENAME}}]]}}{{#if:{{{script2|}}}|[[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} in {{{script2}}} script|{{{skey2}}} {{SUBPAGENAME}}]]}}|
28 [[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}}|{{SUBPAGENAME}}]]{{#if:{{{script|}}}|[[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} in {{{script}}} script|{{SUBPAGENAME}}]]}}{{#if:{{{script2|}}}|[[Category:{{{regcat}}} {{{{#if:{{{regcat|}}}|languagex|ns:0}}|{{#if:{{{lang|}}}|{{{lang}}}|en}}}} in {{{script2}}} script|{{SUBPAGENAME}}]]}}}}}}<!--
30 -->{{#if:{{{cat|}}}|{{#if:{{{skey|}}}|
31 [[Category:{{{cat}}}|{{{skey}}} {{SUBPAGENAME}}]]|
32 [[Category:{{{cat}}}|{{SUBPAGENAME}}]]}}}} }}<!--
33 if something follows that is a special, recall on next parameter (ignore case of special on the end)
34 -->{{#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|}}} }}<!--
35 default case(s) from switch, we have a template or string, generate comma if we had a label
36 -->{{#switch:{{{1}}}|,|or|and|_=|#default={{#if:{{{label|}}}|<span class="ib-comma"><span class="qualifier-comma">,</span></span>&#32;}}<!--
37 if template exists and is a context template, else call it, else call ourselves, avoid extra expansion by conditional on name
38 -->{{ {{#if:{{{1|}}}|{{#if:{{#ifexist:Template:{{{1}}}|{{#ifeq:{{{{{1}}}|sub=}}|{{{{{1}}}|sub=1}}||+}}}}|{{{1}}}|context {{#expr:{{{sub|0}}}+1}}}}|ns:0}} |label={{{1}}}
39 |sub={{#expr:{{{sub|0}}}+1}}|lang={{{lang|}}}|skey={{{skey|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}} }}<!--
40 -->}}}}<!-- end switch, if {1}
41 if not in sub, close content span, paren
42 -->{{#if:{{{sub||}}}||</span></span><span class="ib-brac"><span class="qualifier-brac">)</span></span>}}<!--
43 now cat templates themselves, trick for only when sub is blank
44 -->{{#ifeq:{{NAMESPACE}}{{{sub|}}}|{{ns:template}}|[[Category:{{ucfirst:{{{tcat|{{#if:{{{topcat|}}}|topical|
45 {{#if:{{{poscat|}}}|usage|
46 {{#if:{{{regcat|}}}|regional|
47 {{#ifeq:{{{1|}}}{{{2|}}}|_|qualifier}}}}}}}} }}} context labels}}|{{PAGENAME}}]]}}</includeonly><noinclude>{{documentation}}<noinclude></rev>