אונטערשייד צווישן ווערסיעס פון "יחידה:Coordinates"

255 בייטן צוגעלייגט ,  פֿאַר 2 יאָר
קיין רעדאגירונג באמערקונג
אין תקציר עריכה
אין תקציר עריכה
שורה 33: שורה 33:
function displaytitle (s, notes)
function displaytitle (s, notes)
local l = "[[געאגראפישע קאארדינאטן|קאארדינאטן]]: " .. s
local l = "[[געאגראפישע קאארדינאטן|קאארדינאטן]]: " .. s
local co = '<span id="coordinates">' .. l .. notes .. '</span>';
local co = '<span id="coordinates" style="font-size: small;">' .. l .. notes .. '</span>';
return '<span style="font-size: small;">' .. co .. '</span>';
return globalFrame:extensionTag{
name = 'indicator',
content = co,
args = { name = '0-coord' }
};
end
end


שורה 601: שורה 606:
text = text .. displaytitle(contents, Notes)
text = text .. displaytitle(contents, Notes)
-- Add a Wikidata category for mainspace pages.
-- Add a Wikidata category for mainspace pages.
if mw.wikibase and current_page.namespace == 0 then
if mw.wikibase and current_page.namespace == 0 and mw.wikibase.getEntityIdForCurrentPage() then
local wikidata_cat
local wikidata_cat
local entity = mw.wikibase.getEntityObject()
local wd_coord = mw.wikibase.getBestStatements( mw.wikibase.getEntityIdForCurrentPage(), 'P625' )
if entity and entity.claims and entity.claims.P625 then
local snaktype
local snaktype = entity.claims.P625[1].mainsnak.snaktype
-- fallback to P159
if snaktype == 'value' then
if not (wd_coord and wd_coord[1]) then
wikidata_cat = '[[קאטעגאריע:קאארדינאטן אויף וויקידאטא]]' -- coordinates exist both here and on Wikidata, and can be compared
wd_coord = mw.wikibase.getBestStatements( mw.wikibase.getEntityIdForCurrentPage(), 'P159' )
--elseif snaktype == 'somevalue' then
if #wd_coord > 0 and wd_coord[1].qualifiers and wd_coord[1].qualifiers and wd_coord[1].qualifiers['P625'] then
-- wikidata_cat = '[[Category:Coordinates on Wikidata set to unknown value]]'
snaktype = wd_coord[1].qualifiers['P625'][1].snaktype
--elseif snaktype == 'novalue' then
-- wikidata_cat = '[[קאטעגאריע:דפים עם נקודות ציון חסרות ערך בוויקינתונים]]'
end
end
else
snaktype= wd_coord[1].mainsnak.snaktype
end
if snaktype == 'value' then
wikidata_cat = '[[קאטעגאריע:קאארדינאטן אויף וויקידאטא]]' -- coordinates exist both here and on Wikidata, and can be compared
else
else
wikidata_cat = '[[קאטעגאריע:קאארדינאטן נישט אויף וויקידאטא]]' -- we have to either import the coordinates to Wikidata or remove them here
wikidata_cat = '[[קאטעגאריע:קאארדינאטן נישט אויף וויקידאטא]]' -- we have to either import the coordinates to Wikidata or remove them here
שורה 635: שורה 643:
if frame.args[1] == "latitude" or frame.args[1] == "longitude" or frame.args[1] == "precision" or frame.args[1] == "dimension" or frame.args[1] == "globe" then
if frame.args[1] == "latitude" or frame.args[1] == "longitude" or frame.args[1] == "precision" or frame.args[1] == "dimension" or frame.args[1] == "globe" then
local claimName = args['claim'] or 'P625'
local claimName = args['claim'] or 'P625'
local entityId = mw.wikibase.getEntityIdForCurrentPage()
if entityId == nil then return nil end
local wd_coord = mw.wikibase.getBestStatements( entityId, claimName )
if wd_coord==nil or #wd_coord==0 then return nil end
myValue = wd_coord[1]
local qualifierId = args['qualifier']
if qualifierId then
myValue = myValue.qualifiers[qualifierId][1].datavalue.value[frame.args[1]]
else
myValue = myValue.mainsnak.datavalue.value[frame.args[1]]
end
if frame.args[1] == "globe" then
globeId = mw.ustring.match( myValue, "Q%d+" )
myValue = myGlobes[globeId]
end
return myValue
if mw.wikibase.getEntityObject().claims[claimName] == nil then
return nil
else myValue = mw.wikibase.getEntityObject().claims[claimName][1]
local qualifierId = args['qualifier']
if qualifierId then
myValue = myValue.qualifiers[qualifierId][1].datavalue.value[frame.args[1]]
else
myValue = myValue.mainsnak.datavalue.value[frame.args[1]]
end
if frame.args[1] == "globe" then
globeId = mw.ustring.match( myValue, "Q%d+" )
myValue = myGlobes[globeId]
end
return myValue
end
else
else
return nil
return nil