Difference between revisions of "Template:Tag"

From geofiction
Jump to navigation Jump to search
m (Removed redirect to Template:Tag old)
Tag: Removed redirect
m (Replaced content with "<includeonly>[https://wiki.openstreetmap.org/wiki/{{TagPagename|{{{1}}}|{{{2}}}}} <span style="background:#EEF;font-size:1em;line-height:1.6">{{#if: {{{2|}}} | {{{1}}}={{{...")
Tag: Replaced
Line 1: Line 1:
<includeonly>[https://wiki.openstreetmap.org/wiki/{{TagPagename|{{{1}}}}} something]</includeonly><noinclude>
+
<includeonly>[https://wiki.openstreetmap.org/wiki/{{TagPagename|{{{1}}}|{{{2}}}}} <span style="background:#EEF;font-size:1em;line-height:1.6">{{#if: {{{2|}}} | {{{1}}}={{{2}}} | {{{1}}} }}</span>]</includeonly><noinclude>
  
 
==Examples==
 
==Examples==
 
{{Tag|industrial}}
 
{{Tag|industrial}}
{{Tag|industrial=brewery}}
+
{{Tag|industrial|brewery}}
  
 
[[Category:Basic templates]]</noinclude>
 
[[Category:Basic templates]]</noinclude>
 
 
 
 
 
 
 
<tt dir="ltr" class="mw-content-ltr" style="background:#EEF;font-size:1em;line-height:1.6"><bdi style="white-space:nowrap"><!--Important technical note:
 
Where the result of a template or ParserFunction expansion starts with a star, colon or semicolon, an automatic newline is added:
 
https://meta.wikimedia.org/wiki/Help:Newlines_and_spaces#Automatic_newline
 
This is particularly unfortunate, as this is not what we want to do in several cases, and a newline will break what we're doing. The answer is to put something in so that the expanded text *doesn't* start with one of those characters, but which doesn't actually contribute to the final output: we choose "<nowiki/>" for that purpose.
 
Which style of key linking do we have?
 
-->{{#if:{{{:|}}}
 
|<!--Type 1: Each key part is separately linked.
 
-->[[{{TagPagename|lang={{{kl|}}}|1={{{1<noinclude>|name</noinclude>}}}}}|{{{1<noinclude>|name</noinclude>}}}]]:<!--
 
-->[[{{TagPagename|lang={{{kl:|}}}|1={{{:|}}}}}|{{{:|}}}]]<!--
 
-->{{#if:{{{::|}}}|<nowiki/>:[[{{TagPagename|lang={{{kl::|}}}|1={{{::|}}}}}|{{{::|}}}]]}}
 
|<!--Type 2: Whole key is linked to main key page.
 
-->[[{{TagPagename|lang={{{kl|}}}|1={{{1<noinclude>|name</noinclude>}}}}}|{{{1<noinclude>|name</noinclude>}}}{{#if:{{{subkey|}}}|<nowiki/>:{{{subkey|}}}{{#if:{{{subkey2|}}}|<nowiki/>:{{{subkey2|}}}}}}}]]
 
}}</bdi>=<!--There's *always* an equals sign displayed.-->{{#if:{{{2|}}}
 
|<!--If there is a value provided, we use that and link it appropriately.
 
-->[[{{TagPagename|lang={{{vl|}}}|1={{#if: {{{::|}}}|{{{::}}}|{{#if:{{{:|}}}|{{{:|}}}|{{{1<noinclude>|name</noinclude>}}}}}}}|2={{{2|}}}}}<!--
 
-->|<bdi>{{{2|}}}</bdi>]]<!--
 
If there are separate values in addition to the first value listed, these are provided in the "subval" (alias ";") and "subval2 (alias ";;") parameters.
 
-->{{#if:{{{subval|}}}{{{;|}}}|<nowiki/>;[[{{TagPagename|lang={{{vl2|}}}|1={{#if:{{{::|}}}|{{{::|}}}|{{#if:{{{:|}}}|{{{:|}}}|{{{1<noinclude>|name</noinclude>}}}}}}}|2={{{subval|}}}{{{;|}}}}}|<bdi>{{{subval|}}}{{{;|}}}</bdi>]]}}<!--
 
-->{{#if:{{{subval2|}}}{{{;;|}}}|<nowiki/>;[[{{TagPagename|lang={{{vl3|}}}|1={{#if:{{{::|}}}|{{{::|}}}|{{#if:{{{:|}}}|{{{:|}}}|{{{1<noinclude>|name</noinclude>}}}}}}}|2={{{subval2|}}}{{{;;|}}}}}|<bdi>{{{subval2|}}}{{{;;|}}}</bdi>]]}}
 
|<!--Where there is no value provided in the second numbered parameter, this is either a special link type, or simply just a key with no value, where we jsut put a star. First, do special handling of special link types for specific keys, using the optional third parameter (used for all values with external links).-->{{#switch:{{{1|}}}
 
|wikipedia={{#if:{{{3|}}}|[[w:{{#if:{{{subkey|}}}|{{{subkey|}}}:{{#if:{{{subkey2|}}}|{{{subkey2|}}}:}}}}{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|brand:wikipedia={{#if:{{{3|}}}|[[w:{{#if:{{{subkey|}}}|{{{subkey|}}}:{{#if:{{{subkey2|}}}|{{{subkey2|}}}:}}}}{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|operator:wikipedia={{#if:{{{3|}}}|[[w:{{#if:{{{subkey|}}}|{{{subkey|}}}:{{#if:{{{subkey2|}}}|{{{subkey2|}}}:}}}}{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|network:wikipedia={{#if:{{{3|}}}|[[w:{{#if:{{{subkey|}}}|{{{subkey|}}}:{{#if:{{{subkey2|}}}|{{{subkey2|}}}:}}}}{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|name:etymology:wikipedia={{#if:{{{3|}}}|[[w:{{#if:{{{subkey|}}}|{{{subkey|}}}:{{#if:{{{subkey2|}}}|{{{subkey2|}}}:}}}}{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|species:wikipedia={{#if:{{{3|}}}|[[w:{{#if:{{{subkey|}}}|{{{subkey|}}}:{{#if:{{{subkey2|}}}|{{{subkey2|}}}:}}}}{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|brand:wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|operator:wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|network:wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|name:etymology:wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|species:wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|subject:wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
|flag:wikidata={{#if:{{{3|}}}|[[d:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}
 
<!--[[special:interwiki]]allows for d: or wikidata:; wikipedia allows for w:wikidata or w:d: (same for commons: below...w:c: or w:commons:)-->
 
|commons={{#if:{{{3|}}}|[[commons:{{{3|}}}|<bdi>{{{3|}}}</bdi>]]|<nowiki/>*}}<!--
 
Quite a lot of the cases of these uses of this template currently don't match this implementation. More attention necessary (and more special links may be handled in this switch for specific tags that have authoritative description pages outside the OSM wiki: these may even be external URLs, notably for keys whose value is an external reference id, but these ids could be found by linking to Wikidata).-->
 
|url|website={{#if:{{{3|}}}|[{{{3|}}} <bdi style="white-space:normal"><!--Allow linebreaks in some long URLs (truncating the display value against width overflows is tricky)-->{{{3|}}}</bdi>]|<nowiki/>*}}
 
|#default={{#if:{{{3|}}}|<bdi>{{{3|}}}</bdi>|<nowiki/>*}}
 
}}}}</tt><noinclude>{{Wpderiv|Infobox_geopolitical_organization}}</noinclude>-->
 

Revision as of 16:13, 20 December 2022