Content deleted Content added
mNo edit summary |
No edit summary |
||
Line 133:
end
function State:convertUnit(unit,
local itemID, label, target
Line 150:
target = nil
if
target = mw.wikibase.sitelink(itemID)
end
if
if target then
return " " .. "[[" .. target .. "|" .. (label or target) .. "]]"
Line 193:
end
function State:getValue(snak,
if snak.snaktype == 'value' then
Line 210:
local value = mw.ustring.gsub(snak.datavalue.value['amount'], "^\+(.+)$", "%1")
if
local unit = self:convertUnit(snak.datavalue.value['unit'],
if unit then
value = value .. unit
Line 255:
yRound = math.ceil(yDiv)
if
if precision == 6 then
suffix = " millennium"
Line 264:
suffix = self:getOrdinalSuffix(yRound) .. suffix
else
-- if
-- (e.g. 1901 for 20th century or 2001 for 3rd millennium)
yRound = (yRound - 1) * yFactor + 1
Line 273:
yRound = math.floor(yDiv) * yFactor
if
suffix = "s"
end
end
if
-- if BCE then compensate for "counting backwards"
-- (e.g. -2019 for 2010s BCE, -2000 for 20th century BCE or -3000 for 3rd millennium BCE)
Line 338:
end
if
if precision == 3 then
suffix = " million years"
Line 364:
if calendarID and calendarID == aliasesQ.prolepticJulianCalendar then
if
if
calendar = " ([[Julian calendar|Julian]])"
else
Line 376:
end
if
local ce = nil
Line 386:
if ce then
if
ce = "[[Common Era|" .. ce .. "]]"
end
Line 430:
local partsGlue = ", "
if
degSymbol = "/"
minSymbol = "/"
Line 492:
value = latValue .. partsGlue .. lonValue
if
globe = self:parseWikidataURL(snak.datavalue.value['globe'])
Line 507:
elseif snak.datavalue.type == 'wikibase-entityid' then
local value = ""
local target = nil▼
local itemID = "Q" .. snak.datavalue.value['numeric-id']▼
if
▲ local target = nil
▲ local itemID = "Q" .. snak.datavalue.value['numeric-id']
end▼
if
value =
end
if
end
if
▲ end
value = "[[" .. target .. "|" .. (value or target) .. "]]"▼
if link then
if target then
▲ value = "[[" .. target .. "|" .. (value or target) .. "]]"
elseif not value then▼
value = "[[:d:" .. itemID .. "|" .. itemID .. "]]"
end
elseif not value then
value =
end
else
▲ elseif not value then
value =
end
Line 547 ⟶ 552:
function State:getRawValue(snak)
if snak.snaktype == 'value' and snak.datavalue.type == 'wikibase-entityid' then
elseif snak.snaktype == 'somevalue' then
return " " -- single space represents 'somevalue'
|