Template:Wikidata location: Difference between revisions

From Random Island Wiki
Jump to navigation Jump to search
>Mike Peel
(Adding US-specific logic)
>Mike Peel
(Also handle cases where we want to link to e.g. "Mountain, State".)
Line 1: Line 1:
{{#if:{{{location|}}}|{{{location|}}}|{{comma separated values
{{#if:{{{location|}}}|{{{location|}}}|{{#if:{{#invoke:WikidataIB|checkBlacklist|name=location|suppressfields={{{suppressfields|}}} }}|{{comma separated values
| 1 = {{#invoke:WikidataIB|getValue|P706|name=location|suppressfields={{{suppressfields|}}}|fetchwikidata={{{fetchwikidata|ALL}}}|onlysourced={{{onlysourced|no}}}|noicon=yes|{{{terrainfeature|}}}}}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P706}}}}
| 1 = {{#if:{{#Property:P706}}|{{#ifexist:{{#invoke:Wikidata|getRawValue|P706|onlysourced=no|FETCH_WIKIDATA}}, {{#invoke:Wikidata|getRawValue|P131|onlysourced=no|FETCH_WIKIDATA}} | [[{{#invoke:Wikidata|getRawValue|P706|onlysourced=no|FETCH_WIKIDATA}}, {{#invoke:Wikidata|getRawValue|P131|onlysourced=no|FETCH_WIKIDATA}}]] | {{#invoke:WikidataIB|getValue|P706|name=location|suppressfields={{{suppressfields|}}}|fetchwikidata={{{fetchwikidata|ALL}}}|onlysourced={{{onlysourced|no}}}|noicon=yes|{{{terrainfeature|}}}}} }}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P706}}}}}}
| 2 = {{#invoke:WikidataIB|getValue|P276|name=location|suppressfields={{{suppressfields|}}}|fetchwikidata={{{fetchwikidata|ALL}}}|onlysourced={{{onlysourced|no}}}|noicon=yes|{{{location|}}}}}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P276}}}}
| 2 = {{#invoke:WikidataIB|getValue|P276|name=location|suppressfields={{{suppressfields|}}}|fetchwikidata={{{fetchwikidata|ALL}}}|onlysourced={{{onlysourced|no}}}|noicon=yes|{{{location|}}}}}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P276}}}}
| 3 = {{#ifexist:{{#invoke:Wikidata|getRawValue|P131|onlysourced=no|FETCH_WIKIDATA}} | [[{{#invoke:Wikidata|getRawValue|P131|onlysourced=no|{{{area|FETCH_WIKIDATA}}}}}]] | {{#invoke:WikidataIB|getValue|P131|name=location|suppressfields={{{suppressfields|}}}|fetchwikidata={{{fetchwikidata|ALL}}}|onlysourced={{{onlysourced|no}}}|noicon=yes|{{{area|}}}}} }}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P131}}}}
| 3 = {{#ifexist:{{#invoke:Wikidata|getRawValue|P706|onlysourced=no|FETCH_WIKIDATA}}, {{#invoke:Wikidata|getRawValue|P131|onlysourced=no|FETCH_WIKIDATA}}||{{#ifexist:{{#invoke:Wikidata|getRawValue|P131|onlysourced=no|FETCH_WIKIDATA}} | [[{{#invoke:Wikidata|getRawValue|P131|onlysourced=no|{{{area|FETCH_WIKIDATA}}}}}]] | {{#invoke:WikidataIB|getValue|P131|name=location|suppressfields={{{suppressfields|}}}|fetchwikidata={{{fetchwikidata|ALL}}}|onlysourced={{{onlysourced|no}}}|noicon=yes|{{{area|}}}}} }}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P131}}}}}}
| 4 = {{#ifeq:{{#Property:P17}}|United States of America|{{#if:{{#Property:P706}}{{#Property:P276}}{{#Property:P131}}|US|United States}}|{{#ifeq:{{#Property:P17}}|no value|{{#if:{{#Property:P30}}|{{#if:{{#invoke:WikidataIB|checkBlacklist|name=location|suppressfields={{{suppressfields|}}} }}|{{#Property:P30|from={{{qid|}}} }}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P30}} }} {{EditAtWikidata|pid=P17|qid={{{qid|}}} }} }} }}|{{#if:{{#Property:P17}}|{{#if:{{#invoke:WikidataIB|checkBlacklist|name=location|suppressfields={{{suppressfields|}}} }}|{{#Property:P17|from={{{qid|}}} }}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P17}} }} {{EditAtWikidata|pid=P17|qid={{{qid|}}} }} }} }} }} }}
| 4 = {{#ifeq:{{#Property:P17}}|United States of America|{{#if:{{#Property:P706}}{{#Property:P276}}{{#Property:P131}}|US|United States}}|{{#ifeq:{{#Property:P17}}|no value|{{#if:{{#Property:P30}}|{{#Property:P30|from={{{qid|}}}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P30}} }} {{EditAtWikidata|pid=P17|qid={{{qid|}}} }} }} }}|{{#if:{{#Property:P17}}|{{#if:{{#invoke:WikidataIB|checkBlacklist|name=location|suppressfields={{{suppressfields|}}} }}|{{#Property:P17|from={{{qid|}}} }}{{#ifeq:{{{refs|yes}}}|yes|{{wikidata|references|normal+|{{{qid|}}}|P17}} }} {{EditAtWikidata|pid=P17|qid={{{qid|}}} }} }} }} }} }}
}}}}<noinclude>
}}}}|}}<noinclude>
{{documentation}}
{{documentation}}
</noinclude>
</noinclude>

Revision as of 17:38, 8 July 2017