Difference between revisions of "Template:Tlg"
From MINR.ORG WIKI
(Allow empty parameters to be specified (whatever this is good for). At least it simplifies documentation.) |
(Update linking logic so "anypage" is not needed anymore; remove unused and undocumented LANG and SISTER parameters) |
||
Line 3: | Line 3: | ||
<span style="white-space:nowrap;"> | <span style="white-space:nowrap;"> | ||
--><!-- | --><!-- | ||
+ | |||
-- begin tt style if tt=yes or code=yes given | -- begin tt style if tt=yes or code=yes given | ||
-->{{#if:{{{tt|}}}{{{code|}}}|<code>}}<!-- | -->{{#if:{{{tt|}}}{{{code|}}}|<code>}}<!-- | ||
Line 11: | Line 12: | ||
-- begin boldface if bold=yes given | -- begin boldface if bold=yes given | ||
-->{{#if:{{{bold|}}}|'''}}<!-- | -->{{#if:{{{bold|}}}|'''}}<!-- | ||
− | + | ||
− | -->{{#if:{{{nolink|}}}||{{!(}}{{!(}}{{{ | + | -- create actual link (if not nolink=yes) |
− | + | -->{{#if:{{{nolink|}}} | |
− | -->{{# | + | |<!-- nolink=yes --> |
+ | |{{#ifeq:{{padleft:|1|{{{1}}}}} <!-- check whether we have a colon at the beginning --> | ||
+ | |: | ||
+ | |{{!(}}{{!(}}:{{FULLPAGENAME:{{{1}}}}} <!-- if yes: link to article ns or assume other valid link, e.g. Interwikilink --> | ||
+ | |{{!(}}{{!(}}:{{#switch:{{NAMESPACE:{{{1}}}}} | ||
+ | |{{ns:0}}|{{ns:10}}={{ns:10}}:{{PAGENAME:{{{1}}}}} <!-- No ns given: we want to link to template ns --> | ||
+ | |#default={{FULLPAGENAME:{{{1}}}}}<!-- | ||
+ | -->}}<!-- | ||
+ | -->}}{{!}}<!-- <<--- pipe character in link | ||
+ | -->}}<!-- | ||
+ | |||
+ | -- create link text | ||
-- opening brace if braceinside=yes | -- opening brace if braceinside=yes | ||
-->{{#if:{{{braceinside|}}}|<nowiki>{{</nowiki>}}<!-- | -->{{#if:{{{braceinside|}}}|<nowiki>{{</nowiki>}}<!-- | ||
Line 23: | Line 35: | ||
-- end of link, unless nolink=yes | -- end of link, unless nolink=yes | ||
-->{{#if:{{{nolink|}}}||]]}}<!-- | -->{{#if:{{{nolink|}}}||]]}}<!-- | ||
+ | |||
-- end boldface if bold=yes given | -- end boldface if bold=yes given | ||
-->{{#if:{{{bold|}}}|'''}}<!-- | -->{{#if:{{{bold|}}}|'''}}<!-- | ||
-- begin italic style if italic=yes given | -- begin italic style if italic=yes given | ||
-->{{#if:{{{italic|}}}|<span style="font-style: italic;">}}<!-- | -->{{#if:{{{italic|}}}|<span style="font-style: italic;">}}<!-- | ||
− | + | ||
+ | -- add parameters | ||
-->{{#ifeq:{{{2|}}}|{{{2|x}}}||{{{2}}}}}<!-- | -->{{#ifeq:{{{2|}}}|{{{2|x}}}||{{{2}}}}}<!-- | ||
-->{{#ifeq:{{{3|}}}|{{{3|x}}}||{{{3}}}}}<!-- | -->{{#ifeq:{{{3|}}}|{{{3|x}}}||{{{3}}}}}<!-- | ||
Line 39: | Line 53: | ||
-->{{#ifeq:{{{11|}}}|{{{11|x}}}||{{{11}}}}}<!-- | -->{{#ifeq:{{{11|}}}|{{{11|x}}}||{{{11}}}}}<!-- | ||
-->{{#if:{{{12|}}}||''...''}}<!-- | -->{{#if:{{{12|}}}||''...''}}<!-- | ||
+ | |||
-- end italic style if italic=yes given | -- end italic style if italic=yes given | ||
-->{{#if:{{{italic|}}}|</span>}}<!-- | -->{{#if:{{{italic|}}}|</span>}}<!-- |