ק
rv
ק (הוספת התנאי חזרה) |
ק (rv) צייכן: צוריקגעשטעלט |
||
| שורה 1: | שורה 1: | ||
--[[Adapted from ro:Modul:LocationAndCountry with changes: | --[[Adapted from ro:Modul:LocationAndCountry with changes: | ||
* Using PropertyLink for linking format | * Using PropertyLink for linking format | ||
* No use of external modules that exist in rowiki but have different version in | * No use of external modules that exist in rowiki but have different version in yiwiki such as wikidata and date modules | ||
* findLinkToItem/findDateValues/findClaimForTimestamp is local instead of wikidata module | * findLinkToItem/findDateValues/findClaimForTimestamp is local instead of wikidata module | ||
* disabled capabilities: | * disabled capabilities: | ||
| שורה 15: | שורה 15: | ||
-- the fifth argument specifies the separator to use when displaying multiple values | -- the fifth argument specifies the separator to use when displaying multiple values | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
local HeDateUtils = require('Module: | local HeDateUtils = require('Module:דאטע') | ||
local TableTools = require('Module:TableTools') | local TableTools = require('Module:TableTools') | ||
local PropertyLink = require('Module:PropertyLink') | local PropertyLink = require('Module:PropertyLink') | ||
| שורה 150: | שורה 150: | ||
local function missingLabelCategory(propertyName) | local function missingLabelCategory(propertyName) | ||
return '[[ | return '[[קאטעגאריע:וויקידאטן עטיקעט פעלט אין יידיש: ' .. (mw.wikibase.label( propertyName) or propertyName) .. ']][[קאטעגאריע:וויקידאטן עטיקעט פעלט אין יידיש]]' | ||
end | end | ||
| שורה 157: | שורה 157: | ||
local claims = nil | local claims = nil | ||
local workingEntityId = nil | local workingEntityId = nil | ||
if type(entity) == 'table' then | if type(entity) == 'table' then | ||
workingEntityId = entity.id | workingEntityId = entity.id | ||
| שורה 183: | שורה 181: | ||
--attempt to also load administrative unit, but only if present as a qualifier | --attempt to also load administrative unit, but only if present as a qualifier | ||
local unitQualifier = actualClaim.qualifiers and actualClaim.qualifiers[ | local unitQualifier = actualClaim.qualifiers and actualClaim.qualifiers['P131'] and actualClaim.qualifiers['P131'][1] | ||
if unitQualifier and unitQualifier.snaktype == 'value' then | if unitQualifier and unitQualifier.snaktype == 'value' then | ||
table.insert(locationEntitiesIds, unitQualifier.datavalue.value.id) | table.insert(locationEntitiesIds, unitQualifier.datavalue.value.id) | ||
| שורה 190: | שורה 188: | ||
-- attempt to identify country in the qualifier first, but if it's not, go to the entity | -- attempt to identify country in the qualifier first, but if it's not, go to the entity | ||
local countryQualifier = actualClaim.qualifiers and actualClaim.qualifiers[ | local countryQualifier = actualClaim.qualifiers and actualClaim.qualifiers['P17'] and actualClaim.qualifiers['P17'][1] | ||
local countryId = nil | local countryId = nil | ||
local ts = nil | local ts = nil | ||
| שורה 220: | שורה 218: | ||
end | end | ||
countryClaim = findClaimForTimestamp(locationEntityId, | countryClaim = findClaimForTimestamp(locationEntityId, 'P17', ts) | ||
if countryClaim and countryClaim.mainsnak and countryClaim.mainsnak.snaktype == 'value' then | if countryClaim and countryClaim.mainsnak and countryClaim.mainsnak.snaktype == 'value' then | ||
countryId = countryClaim.mainsnak.datavalue.value.id | countryId = countryClaim.mainsnak.datavalue.value.id | ||
| שורה 247: | שורה 245: | ||
]] | ]] | ||
end | end | ||
if not missingEntityLabel then | if not missingEntityLabel then | ||
table.insert(locationNamesList, locationNames[eachLocationId]) | table.insert(locationNamesList, locationNames[eachLocationId]) | ||