Wikipedia tumwiki https://tum.wikipedia.org/wiki/Jani_likulu MediaWiki 1.47.0-wmf.6 first-letter Media Special Talk User User talk Wikipedia Wikipedia talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk TimedText TimedText talk Module Module talk Event Event talk Module:Wd 828 13418 116447 105254 2026-06-17T02:29:01Z Viyowoyero-vya-Malaŵi 11606 116447 Scribunto text/plain -- Original module located at [[:en:Module:Wd]] and [[:en:Module:Wd/i18n]]. require("strict") local p = {} local module_arg = ... local i18n local i18nPath local function loadI18n(aliasesP, frame) local title if frame then -- current module invoked by page/template, get its title from frame title = frame:getTitle() else -- current module included by other module, get its title from ... title = module_arg end if not i18n then i18nPath = title .. "/i18n" i18n = require(i18nPath).init(aliasesP) end end p.claimCommands = { property = "property", properties = "properties", qualifier = "qualifier", qualifiers = "qualifiers", reference = "reference", references = "references" } p.generalCommands = { label = "label", title = "title", description = "description", alias = "alias", aliases = "aliases", badge = "badge", badges = "badges" } p.flags = { linked = "linked", short = "short", raw = "raw", multilanguage = "multilanguage", unit = "unit", ------------- preferred = "preferred", normal = "normal", deprecated = "deprecated", best = "best", future = "future", current = "current", former = "former", edit = "edit", editAtEnd = "edit@end", mdy = "mdy", single = "single", sourced = "sourced" } p.args = { eid = "eid", page = "page", date = "date", globalSiteId = "globalSiteId" } local aliasesP = { coord = "P625", ----------------------- image = "P18", author = "P50", authorNameString = "P2093", publisher = "P123", importedFrom = "P143", wikimediaImportURL = "P4656", statedIn = "P248", pages = "P304", language = "P407", hasPart = "P527", publicationDate = "P577", startTime = "P580", endTime = "P582", chapter = "P792", retrieved = "P813", referenceURL = "P854", sectionVerseOrParagraph = "P958", archiveURL = "P1065", title = "P1476", formatterURL = "P1630", quote = "P1683", shortName = "P1813", definingFormula = "P2534", archiveDate = "P2960", inferredFrom = "P3452", typeOfReference = "P3865", column = "P3903", subjectNamedAs = "P1810", wikidataProperty = "P1687", publishedIn = "P1433", lastUpdate = "P5017" } local aliasesQ = { percentage = "Q11229", prolepticJulianCalendar = "Q1985786", citeWeb = "Q5637226", citeQ = "Q22321052" } local parameters = { property = "%p", qualifier = "%q", reference = "%r", alias = "%a", badge = "%b", separator = "%s", general = "%x" } local formats = { property = "%p[%s][%r]", qualifier = "%q[%s][%r]", reference = "%r", propertyWithQualifier = "%p[ <span style=\"font-size:85\\%\">(%q)</span>][%s][%r]", alias = "%a[%s]", badge = "%b[%s]" } local hookNames = { -- {level_1, level_2} [parameters.property] = {"getProperty"}, [parameters.reference] = {"getReferences", "getReference"}, [parameters.qualifier] = {"getAllQualifiers"}, [parameters.qualifier.."\\d"] = {"getQualifiers", "getQualifier"}, [parameters.alias] = {"getAlias"}, [parameters.badge] = {"getBadge"} } -- default value objects, should NOT be mutated but instead copied local defaultSeparators = { ["sep"] = {" "}, ["sep%s"] = {","}, ["sep%q"] = {"; "}, ["sep%q\\d"] = {", "}, ["sep%r"] = nil, -- none ["punc"] = nil -- none } local rankTable = { ["preferred"] = 1, ["normal"] = 2, ["deprecated"] = 3 } local function replaceAlias(id) if aliasesP[id] then id = aliasesP[id] end return id end local function errorText(code, ...) local text = i18n["errors"][code] if arg then text = mw.ustring.format(text, unpack(arg)) end return text end local function throwError(errorMessage, ...) error(errorText(errorMessage, unpack(arg))) end local function replaceDecimalMark(num) return mw.ustring.gsub(num, "[.]", i18n['numeric']['decimal-mark'], 1) end local function padZeros(num, numDigits) local numZeros local negative = false if num < 0 then negative = true num = num * -1 end num = tostring(num) numZeros = numDigits - num:len() for _ = 1, numZeros do num = "0"..num end if negative then num = "-"..num end return num end local function replaceSpecialChar(chr) if chr == '_' then -- replace underscores with spaces return ' ' else return chr end end local function replaceSpecialChars(str) local chr local esc = false local strOut = "" for i = 1, #str do chr = str:sub(i,i) if not esc then if chr == '\\' then esc = true else strOut = strOut .. replaceSpecialChar(chr) end else strOut = strOut .. chr esc = false end end return strOut end local function buildWikilink(target, label) if not label or target == label then return "[[" .. target .. "]]" else return "[[" .. target .. "|" .. label .. "]]" end end -- used to make frame.args mutable, to replace #frame.args (which is always 0) -- with the actual amount and to simply copy tables local function copyTable(tIn) if not tIn then return nil end local tOut = {} for i, v in pairs(tIn) do tOut[i] = v end return tOut end -- used to merge output arrays together; -- note that it currently mutates the first input array local function mergeArrays(a1, a2) for i = 1, #a2 do a1[#a1 + 1] = a2[i] end return a1 end local function split(str, del) local out = {} local i, j = str:find(del) if i and j then out[1] = str:sub(1, i - 1) out[2] = str:sub(j + 1) else out[1] = str end return out end local function parseWikidataURL(url) local id if url:match('^http[s]?://') then id = split(url, "Q") if id[2] then return "Q" .. id[2] end end return nil end local function parseDate(dateStr, precision) precision = precision or "d" local i, j, index, ptr local parts = {nil, nil, nil} if dateStr == nil then return parts[1], parts[2], parts[3] -- year, month, day end -- 'T' for snak values, '/' for outputs with '/Julian' attached i, j = dateStr:find("[T/]") if i then dateStr = dateStr:sub(1, i-1) end local from = 1 if dateStr:sub(1,1) == "-" then -- this is a negative number, look further ahead from = 2 end index = 1 ptr = 1 i, j = dateStr:find("-", from) if i then -- year parts[index] = tonumber(dateStr:sub(ptr, i-1), 10) -- explicitly give base 10 to prevent error if parts[index] == -0 then parts[index] = tonumber("0") -- for some reason, 'parts[index] = 0' may actually store '-0', so parse from string instead end if precision == "y" then -- we're done return parts[1], parts[2], parts[3] -- year, month, day end index = index + 1 ptr = i + 1 i, j = dateStr:find("-", ptr) if i then -- month parts[index] = tonumber(dateStr:sub(ptr, i-1), 10) if precision == "m" then -- we're done return parts[1], parts[2], parts[3] -- year, month, day end index = index + 1 ptr = i + 1 end end if dateStr:sub(ptr) ~= "" then -- day if we have month, month if we have year, or year parts[index] = tonumber(dateStr:sub(ptr), 10) end return parts[1], parts[2], parts[3] -- year, month, day end local function datePrecedesDate(aY, aM, aD, bY, bM, bD) if aY == nil or bY == nil then return nil end aM = aM or 1 aD = aD or 1 bM = bM or 1 bD = bD or 1 if aY < bY then return true end if aY > bY then return false end if aM < bM then return true end if aM > bM then return false end if aD < bD then return true end return false end local function getHookName(param, index) if hookNames[param] then return hookNames[param][index] elseif param:len() > 2 then return hookNames[param:sub(1, 2).."\\d"][index] else return nil end end local function alwaysTrue() return true end -- The following function parses a format string. -- -- The example below shows how a parsed string is structured in memory. -- Variables other than 'str' and 'child' are left out for clarity's sake. -- -- Example: -- "A %p B [%s[%q1]] C [%r] D" -- -- Structure: -- [ -- { -- str = "A " -- }, -- { -- str = "%p" -- }, -- { -- str = " B ", -- child = -- [ -- { -- str = "%s", -- child = -- [ -- { -- str = "%q1" -- } -- ] -- } -- ] -- }, -- { -- str = " C ", -- child = -- [ -- { -- str = "%r" -- } -- ] -- }, -- { -- str = " D" -- } -- ] -- local function parseFormat(str) local chr, esc, param, root, cur, prev, new local params = {} local function newObject(array) local obj = {} -- new object obj.str = "" array[#array + 1] = obj -- array{object} obj.parent = array return obj end local function endParam() if param > 0 then if cur.str ~= "" then cur.str = "%"..cur.str cur.param = true params[cur.str] = true cur.parent.req[cur.str] = true prev = cur cur = newObject(cur.parent) end param = 0 end end root = {} -- array root.req = {} cur = newObject(root) prev = nil esc = false param = 0 for i = 1, #str do chr = str:sub(i,i) if not esc then if chr == '\\' then endParam() esc = true elseif chr == '%' then endParam() if cur.str ~= "" then cur = newObject(cur.parent) end param = 2 elseif chr == '[' then endParam() if prev and cur.str == "" then table.remove(cur.parent) cur = prev end cur.child = {} -- new array cur.child.req = {} cur.child.parent = cur cur = newObject(cur.child) elseif chr == ']' then endParam() if cur.parent.parent then new = newObject(cur.parent.parent.parent) if cur.str == "" then table.remove(cur.parent) end cur = new end else if param > 1 then param = param - 1 elseif param == 1 then if not chr:match('%d') then endParam() end end cur.str = cur.str .. replaceSpecialChar(chr) end else cur.str = cur.str .. chr esc = false end prev = nil end endParam() -- make sure that at least one required parameter has been defined if not next(root.req) then throwError("missing-required-parameter") end -- make sure that the separator parameter "%s" is not amongst the required parameters if root.req[parameters.separator] then throwError("extra-required-parameter", parameters.separator) end return root, params end local function sortOnRank(claims) local rankPos local ranks = {{}, {}, {}, {}} -- preferred, normal, deprecated, (default) local sorted = {} for _, v in ipairs(claims) do rankPos = rankTable[v.rank] or 4 ranks[rankPos][#ranks[rankPos] + 1] = v end sorted = ranks[1] sorted = mergeArrays(sorted, ranks[2]) sorted = mergeArrays(sorted, ranks[3]) return sorted end local function isValueInTable(searchedItem, inputTable) for _, item in pairs(inputTable) do if item == searchedItem then return true end end return false end local Config = {} -- allows for recursive calls function Config:new() local cfg = {} setmetatable(cfg, self) self.__index = self cfg.separators = { -- single value objects wrapped in arrays so that we can pass by reference ["sep"] = {copyTable(defaultSeparators["sep"])}, ["sep%s"] = {copyTable(defaultSeparators["sep%s"])}, ["sep%q"] = {copyTable(defaultSeparators["sep%q"])}, ["sep%r"] = {copyTable(defaultSeparators["sep%r"])}, ["punc"] = {copyTable(defaultSeparators["punc"])} } cfg.entity = nil cfg.entityID = nil cfg.propertyID = nil cfg.propertyValue = nil cfg.qualifierIDs = {} cfg.qualifierIDsAndValues = {} cfg.bestRank = true cfg.ranks = {true, true, false} -- preferred = true, normal = true, deprecated = false cfg.foundRank = #cfg.ranks cfg.flagBest = false cfg.flagRank = false cfg.periods = {true, true, true} -- future = true, current = true, former = true cfg.flagPeriod = false cfg.atDate = {parseDate(os.date('!%Y-%m-%d'))} -- today as {year, month, day} cfg.mdyDate = false cfg.singleClaim = false cfg.sourcedOnly = false cfg.editable = false cfg.editAtEnd = false cfg.inSitelinks = false cfg.langCode = mw.language.getContentLanguage().code cfg.langName = mw.language.fetchLanguageName(cfg.langCode, cfg.langCode) cfg.langObj = mw.language.new(cfg.langCode) cfg.siteID = mw.wikibase.getGlobalSiteId() cfg.states = {} cfg.states.qualifiersCount = 0 cfg.curState = nil cfg.prefetchedRefs = nil return cfg end local State = {} function State:new(cfg, type) local stt = {} setmetatable(stt, self) self.__index = self stt.conf = cfg stt.type = type stt.results = {} stt.parsedFormat = {} stt.separator = {} stt.movSeparator = {} stt.puncMark = {} stt.linked = false stt.rawValue = false stt.shortName = false stt.anyLanguage = false stt.unitOnly = false stt.singleValue = false return stt end -- if id == nil then item connected to current page is used function Config:getLabel(id, raw, link, short) local label = nil local prefix, title= "", nil if not id then id = mw.wikibase.getEntityIdForCurrentPage() if not id then return "" end end id = id:upper() -- just to be sure if raw then -- check if given id actually exists if mw.wikibase.isValidEntityId(id) and mw.wikibase.entityExists(id) then label = id end prefix, title = "d:Special:EntityPage/", label -- may be nil else -- try short name first if requested if short then label = p._property{aliasesP.shortName, [p.args.eid] = id} -- get short name if label == "" then label = nil end end -- get label if not label then label = mw.wikibase.getLabel(id) end end if not label then label = "" elseif link then -- build a link if requested if not title then if id:sub(1,1) == "Q" then title = mw.wikibase.getSitelink(id) elseif id:sub(1,1) == "P" then -- properties have no sitelink, link to Wikidata instead prefix, title = "d:Special:EntityPage/", id end end label = mw.text.nowiki(label) -- escape raw label text so it cannot be wikitext markup if title then label = buildWikilink(prefix .. title, label) end end return label end function Config:getEditIcon() local value = "" local prefix = "" local front = "&nbsp;" local back = "" if self.entityID:sub(1,1) == "P" then prefix = "Property:" end if self.editAtEnd then front = '<span style="float:' if self.langObj:isRTL() then front = front .. 'left' else front = front .. 'right' end front = front .. '">' back = '</span>' end value = "[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=" .. i18n['info']['edit-on-wikidata'] .. "|link=https://www.wikidata.org/wiki/" .. prefix .. self.entityID .. "?uselang=" .. self.langCode if self.propertyID then value = value .. "#" .. self.propertyID elseif self.inSitelinks then value = value .. "#sitelinks-wikipedia" end value = value .. "|" .. i18n['info']['edit-on-wikidata'] .. "]]" return front .. value .. back end -- used to create the final output string when it's all done, so that for references the -- function extensionTag("ref", ...) is only called when they really ended up in the final output function Config:concatValues(valuesArray) local outString = "" local j, skip for i = 1, #valuesArray do -- check if this is a reference if valuesArray[i].refHash then j = i - 1 skip = false -- skip this reference if it is part of a continuous row of references that already contains the exact same reference while valuesArray[j] and valuesArray[j].refHash do if valuesArray[i].refHash == valuesArray[j].refHash then skip = true break end j = j - 1 end if not skip then -- add <ref> tag with the reference's hash as its name (to deduplicate references) outString = outString .. mw.getCurrentFrame():extensionTag("ref", valuesArray[i][1], {name = valuesArray[i].refHash}) end else outString = outString .. valuesArray[i][1] end end return outString end function Config:convertUnit(unit, raw, link, short, unitOnly) local space = " " local label = "" local itemID if unit == "" or unit == "1" then return nil end if unitOnly then space = "" end itemID = parseWikidataURL(unit) if itemID then if itemID == aliasesQ.percentage then return "%" else label = self:getLabel(itemID, raw, link, short) if label ~= "" then return space .. label end end end return "" end function State:getValue(snak) return self.conf:getValue(snak, self.rawValue, self.linked, self.shortName, self.anyLanguage, self.unitOnly, false, self.type:sub(1,2)) end function Config:getValue(snak, raw, link, short, anyLang, unitOnly, noSpecial, type) if snak.snaktype == 'value' then local datatype = snak.datavalue.type local subtype = snak.datatype local datavalue = snak.datavalue.value if datatype == 'string' then if subtype == 'url' and link then -- create link explicitly if raw then -- will render as a linked number like [1] return "[" .. datavalue .. "]" else return "[" .. datavalue .. " " .. datavalue .. "]" end elseif subtype == 'commonsMedia' then if link then return buildWikilink("c:File:" .. datavalue, datavalue) elseif not raw then return "[[File:" .. datavalue .. "]]" else return datavalue end elseif subtype == 'geo-shape' and link then return buildWikilink("c:" .. datavalue, datavalue) elseif subtype == 'math' and not raw then local attribute = nil if (type == parameters.property or (type == parameters.qualifier and self.propertyID == aliasesP.hasPart)) and snak.property == aliasesP.definingFormula then attribute = {qid = self.entityID} end return mw.getCurrentFrame():extensionTag("math", datavalue, attribute) elseif subtype == 'external-id' and link then local url = p._property{aliasesP.formatterURL, [p.args.eid] = snak.property} -- get formatter URL if url ~= "" then url = mw.ustring.gsub(url, "$1", datavalue) return "[" .. url .. " " .. datavalue .. "]" else return datavalue end else return datavalue end elseif datatype == 'monolingualtext' then if anyLang or datavalue['language'] == self.langCode then return datavalue['text'] else return nil end elseif datatype == 'quantity' then local value = "" local unit if not unitOnly then -- get value and strip + signs from front value = mw.ustring.gsub(datavalue['amount'], "^%+(.+)$", "%1") if raw then return value end -- replace decimal mark based on locale value = replaceDecimalMark(value) -- add delimiters for readability value = i18n.addDelimiters(value) end unit = self:convertUnit(datavalue['unit'], raw, link, short, unitOnly) if unit then value = value .. unit end return value elseif datatype == 'time' then local y, m, d, p, yDiv, yRound, yFull, value, calendarID, dateStr local yFactor = 1 local sign = 1 local prefix = "" local suffix = "" local mayAddCalendar = false local calendar = "" local precision = datavalue['precision'] if precision == 11 then p = "d" elseif precision == 10 then p = "m" else p = "y" yFactor = 10^(9-precision) end y, m, d = parseDate(datavalue['time'], p) if y < 0 then sign = -1 y = y * sign end -- if precision is tens/hundreds/thousands/millions/billions of years if precision <= 8 then yDiv = y / yFactor -- if precision is tens/hundreds/thousands of years if precision >= 6 then mayAddCalendar = true if precision <= 7 then -- round centuries/millenniums up (e.g. 20th century or 3rd millennium) yRound = math.ceil(yDiv) if not raw then if precision == 6 then suffix = i18n['datetime']['suffixes']['millennium'] else suffix = i18n['datetime']['suffixes']['century'] end suffix = i18n.getOrdinalSuffix(yRound) .. suffix else -- if not verbose, take the first year of the century/millennium -- (e.g. 1901 for 20th century or 2001 for 3rd millennium) yRound = (yRound - 1) * yFactor + 1 end else -- precision == 8 -- round decades down (e.g. 2010s) yRound = math.floor(yDiv) * yFactor if not raw then prefix = i18n['datetime']['prefixes']['decade-period'] suffix = i18n['datetime']['suffixes']['decade-period'] end end if raw and sign < 0 then -- if BCE then compensate for "counting backwards" -- (e.g. -2019 for 2010s BCE, -2000 for 20th century BCE or -3000 for 3rd millennium BCE) yRound = yRound + yFactor - 1 end else local yReFactor, yReDiv, yReRound -- round to nearest for tens of thousands of years or more yRound = math.floor(yDiv + 0.5) if yRound == 0 then if precision <= 2 and y ~= 0 then yReFactor = 1e6 yReDiv = y / yReFactor yReRound = math.floor(yReDiv + 0.5) if yReDiv == yReRound then -- change precision to millions of years only if we have a whole number of them precision = 3 yFactor = yReFactor yRound = yReRound end end if yRound == 0 then -- otherwise, take the unrounded (original) number of years precision = 5 yFactor = 1 yRound = y mayAddCalendar = true end end if precision >= 1 and y ~= 0 then yFull = yRound * yFactor yReFactor = 1e9 yReDiv = yFull / yReFactor yReRound = math.floor(yReDiv + 0.5) if yReDiv == yReRound then -- change precision to billions of years if we're in that range precision = 0 yFactor = yReFactor yRound = yReRound else yReFactor = 1e6 yReDiv = yFull / yReFactor yReRound = math.floor(yReDiv + 0.5) if yReDiv == yReRound then -- change precision to millions of years if we're in that range precision = 3 yFactor = yReFactor yRound = yReRound end end end if not raw then if precision == 3 then suffix = i18n['datetime']['suffixes']['million-years'] elseif precision == 0 then suffix = i18n['datetime']['suffixes']['billion-years'] else yRound = yRound * yFactor if yRound == 1 then suffix = i18n['datetime']['suffixes']['year'] else suffix = i18n['datetime']['suffixes']['years'] end end else yRound = yRound * yFactor end end else yRound = y mayAddCalendar = true end if mayAddCalendar then calendarID = parseWikidataURL(datavalue['calendarmodel']) if calendarID and calendarID == aliasesQ.prolepticJulianCalendar then if not raw then if link then calendar = " ("..buildWikilink(i18n['datetime']['julian-calendar'], i18n['datetime']['julian'])..")" else calendar = " ("..i18n['datetime']['julian']..")" end else calendar = "/"..i18n['datetime']['julian'] end end end if not raw then local ce = nil if sign < 0 then ce = i18n['datetime']['BCE'] elseif precision <= 5 then ce = i18n['datetime']['CE'] end if ce then if link then ce = buildWikilink(i18n['datetime']['common-era'], ce) end suffix = suffix .. " " .. ce end value = tostring(yRound) if m then dateStr = self.langObj:formatDate("F", "1-"..m.."-1") if d then if self.mdyDate then dateStr = dateStr .. " " .. d .. "," else dateStr = d .. " " .. dateStr end end value = dateStr .. " " .. value end value = prefix .. value .. suffix .. calendar else value = padZeros(yRound * sign, 4) if m then value = value .. "-" .. padZeros(m, 2) if d then value = value .. "-" .. padZeros(d, 2) end end value = value .. calendar end return value elseif datatype == 'globecoordinate' then -- logic from https://github.com/DataValues/Geo (v4.0.1) local precision, unitsPerDegree, numDigits, strFormat, value, globe local latitude, latConv, latValue, latLink local longitude, lonConv, lonValue, lonLink local latDirection, latDirectionN, latDirectionS, latDirectionEN local lonDirection, lonDirectionE, lonDirectionW, lonDirectionEN local degSymbol, minSymbol, secSymbol, separator local latDegrees = nil local latMinutes = nil local latSeconds = nil local lonDegrees = nil local lonMinutes = nil local lonSeconds = nil local latDegSym = "" local latMinSym = "" local latSecSym = "" local lonDegSym = "" local lonMinSym = "" local lonSecSym = "" local latDirectionEN_N = "N" local latDirectionEN_S = "S" local lonDirectionEN_E = "E" local lonDirectionEN_W = "W" if not raw then latDirectionN = i18n['coord']['latitude-north'] latDirectionS = i18n['coord']['latitude-south'] lonDirectionE = i18n['coord']['longitude-east'] lonDirectionW = i18n['coord']['longitude-west'] degSymbol = i18n['coord']['degrees'] minSymbol = i18n['coord']['minutes'] secSymbol = i18n['coord']['seconds'] separator = i18n['coord']['separator'] else latDirectionN = latDirectionEN_N latDirectionS = latDirectionEN_S lonDirectionE = lonDirectionEN_E lonDirectionW = lonDirectionEN_W degSymbol = "/" minSymbol = "/" secSymbol = "/" separator = "/" end latitude = datavalue['latitude'] longitude = datavalue['longitude'] if latitude < 0 then latDirection = latDirectionS latDirectionEN = latDirectionEN_S latitude = math.abs(latitude) else latDirection = latDirectionN latDirectionEN = latDirectionEN_N end if longitude < 0 then lonDirection = lonDirectionW lonDirectionEN = lonDirectionEN_W longitude = math.abs(longitude) else lonDirection = lonDirectionE lonDirectionEN = lonDirectionEN_E end precision = datavalue['precision'] if not precision or precision <= 0 then precision = 1 / 3600 -- precision not set (correctly), set to arcsecond end -- remove insignificant detail latitude = math.floor(latitude / precision + 0.5) * precision longitude = math.floor(longitude / precision + 0.5) * precision if precision >= 1 - (1 / 60) and precision < 1 then precision = 1 elseif precision >= (1 / 60) - (1 / 3600) and precision < (1 / 60) then precision = 1 / 60 end if precision >= 1 then unitsPerDegree = 1 elseif precision >= (1 / 60) then unitsPerDegree = 60 else unitsPerDegree = 3600 end numDigits = math.ceil(-math.log10(unitsPerDegree * precision)) if numDigits <= 0 then numDigits = tonumber("0") -- for some reason, 'numDigits = 0' may actually store '-0', so parse from string instead end strFormat = "%." .. numDigits .. "f" if precision >= 1 then latDegrees = strFormat:format(latitude) lonDegrees = strFormat:format(longitude) if not raw then latDegSym = replaceDecimalMark(latDegrees) .. degSymbol lonDegSym = replaceDecimalMark(lonDegrees) .. degSymbol else latDegSym = latDegrees .. degSymbol lonDegSym = lonDegrees .. degSymbol end else latConv = math.floor(latitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits lonConv = math.floor(longitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits if precision >= (1 / 60) then latMinutes = latConv lonMinutes = lonConv else latSeconds = latConv lonSeconds = lonConv latMinutes = math.floor(latSeconds / 60) lonMinutes = math.floor(lonSeconds / 60) latSeconds = strFormat:format(latSeconds - (latMinutes * 60)) lonSeconds = strFormat:format(lonSeconds - (lonMinutes * 60)) if not raw then latSecSym = replaceDecimalMark(latSeconds) .. secSymbol lonSecSym = replaceDecimalMark(lonSeconds) .. secSymbol else latSecSym = latSeconds .. secSymbol lonSecSym = lonSeconds .. secSymbol end end latDegrees = math.floor(latMinutes / 60) lonDegrees = math.floor(lonMinutes / 60) latDegSym = latDegrees .. degSymbol lonDegSym = lonDegrees .. degSymbol latMinutes = latMinutes - (latDegrees * 60) lonMinutes = lonMinutes - (lonDegrees * 60) if precision >= (1 / 60) then latMinutes = strFormat:format(latMinutes) lonMinutes = strFormat:format(lonMinutes) if not raw then latMinSym = replaceDecimalMark(latMinutes) .. minSymbol lonMinSym = replaceDecimalMark(lonMinutes) .. minSymbol else latMinSym = latMinutes .. minSymbol lonMinSym = lonMinutes .. minSymbol end else latMinSym = latMinutes .. minSymbol lonMinSym = lonMinutes .. minSymbol end end latValue = latDegSym .. latMinSym .. latSecSym .. latDirection lonValue = lonDegSym .. lonMinSym .. lonSecSym .. lonDirection value = latValue .. separator .. lonValue if link then globe = parseWikidataURL(datavalue['globe']) if globe then globe = mw.wikibase.getLabelByLang(globe, "en"):lower() else globe = "earth" end latLink = table.concat({latDegrees, latMinutes, latSeconds}, "_") lonLink = table.concat({lonDegrees, lonMinutes, lonSeconds}, "_") value = "[https://geohack.toolforge.org/geohack.php?language="..self.langCode.."&params="..latLink.."_"..latDirectionEN.."_"..lonLink.."_"..lonDirectionEN.."_globe:"..globe.." "..value.."]" end return value elseif datatype == 'wikibase-entityid' then local label local itemID = datavalue['numeric-id'] if subtype == 'wikibase-item' then itemID = "Q" .. itemID elseif subtype == 'wikibase-property' then itemID = "P" .. itemID else return '<strong class="error">' .. errorText('unknown-data-type', subtype) .. '</strong>' end label = self:getLabel(itemID, raw, link, short) if label == "" then label = nil end return label else return '<strong class="error">' .. errorText('unknown-data-type', datatype) .. '</strong>' end elseif snak.snaktype == 'somevalue' and not noSpecial then if raw then return " " -- single space represents 'somevalue' else return i18n['values']['unknown'] end elseif snak.snaktype == 'novalue' and not noSpecial then if raw then return "" -- empty string represents 'novalue' else return i18n['values']['none'] end else return nil end end function Config:getSingleRawQualifier(claim, qualifierID) local qualifiers if claim.qualifiers then qualifiers = claim.qualifiers[qualifierID] end if qualifiers and qualifiers[1] then return self:getValue(qualifiers[1], true) -- raw = true else return nil end end function Config:snakEqualsValue(snak, value) local snakValue = self:getValue(snak, true) -- raw = true if snakValue and snak.snaktype == 'value' and snak.datavalue.type == 'wikibase-entityid' then value = value:upper() end return snakValue == value end function Config:setRank(rank) local rankPos if rank == p.flags.best then self.bestRank = true self.flagBest = true -- mark that 'best' flag was given return end if rank:sub(1,9) == p.flags.preferred then rankPos = 1 elseif rank:sub(1,6) == p.flags.normal then rankPos = 2 elseif rank:sub(1,10) == p.flags.deprecated then rankPos = 3 else return end -- one of the rank flags was given, check if another one was given before if not self.flagRank then self.ranks = {false, false, false} -- no other rank flag given before, so unset ranks self.bestRank = self.flagBest -- unsets bestRank only if 'best' flag was not given before self.flagRank = true -- mark that a rank flag was given end if rank:sub(-1) == "+" then for i = rankPos, 1, -1 do self.ranks[i] = true end elseif rank:sub(-1) == "-" then for i = rankPos, #self.ranks do self.ranks[i] = true end else self.ranks[rankPos] = true end end function Config:setPeriod(period) local periodPos if period == p.flags.future then periodPos = 1 elseif period == p.flags.current then periodPos = 2 elseif period == p.flags.former then periodPos = 3 else return end -- one of the period flags was given, check if another one was given before if not self.flagPeriod then self.periods = {false, false, false} -- no other period flag given before, so unset periods self.flagPeriod = true -- mark that a period flag was given end self.periods[periodPos] = true end function Config:qualifierMatches(claim, id, value) local qualifiers if claim.qualifiers then qualifiers = claim.qualifiers[id] end if qualifiers then for _, v in pairs(qualifiers) do if self:snakEqualsValue(v, value) then return true end end elseif value == "" then -- if the qualifier is not present then treat it the same as the special value 'novalue' return true end return false end function Config:rankMatches(rankPos) if self.bestRank then return (self.ranks[rankPos] and self.foundRank >= rankPos) else return self.ranks[rankPos] end end function Config:timeMatches(claim) local startTime = nil local startTimeY = nil local startTimeM = nil local startTimeD = nil local endTime = nil local endTimeY = nil local endTimeM = nil local endTimeD = nil if self.periods[1] and self.periods[2] and self.periods[3] then -- any time return true end startTime = self:getSingleRawQualifier(claim, aliasesP.startTime) if startTime and startTime ~= "" and startTime ~= " " then startTimeY, startTimeM, startTimeD = parseDate(startTime) end endTime = self:getSingleRawQualifier(claim, aliasesP.endTime) if endTime and endTime ~= "" and endTime ~= " " then endTimeY, endTimeM, endTimeD = parseDate(endTime) end if startTimeY ~= nil and endTimeY ~= nil and datePrecedesDate(endTimeY, endTimeM, endTimeD, startTimeY, startTimeM, startTimeD) then -- invalidate end time if it precedes start time endTimeY = nil endTimeM = nil endTimeD = nil end if self.periods[1] then -- future if startTimeY and datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD) then return true end end if self.periods[2] then -- current if (startTimeY == nil or not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD)) and (endTimeY == nil or datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD)) then return true end end if self.periods[3] then -- former if endTimeY and not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD) then return true end end return false end function Config:processFlag(flag) if not flag then return false end if flag == p.flags.linked then self.curState.linked = true return true elseif flag == p.flags.raw then self.curState.rawValue = true if self.curState == self.states[parameters.reference] then -- raw reference values end with periods and require a separator (other than none) self.separators["sep%r"][1] = {" "} end return true elseif flag == p.flags.short then self.curState.shortName = true return true elseif flag == p.flags.multilanguage then self.curState.anyLanguage = true return true elseif flag == p.flags.unit then self.curState.unitOnly = true return true elseif flag == p.flags.mdy then self.mdyDate = true return true elseif flag == p.flags.single then self.singleClaim = true return true elseif flag == p.flags.sourced then self.sourcedOnly = true return true elseif flag == p.flags.edit then self.editable = true return true elseif flag == p.flags.editAtEnd then self.editable = true self.editAtEnd = true return true elseif flag == p.flags.best or flag:match('^'..p.flags.preferred..'[+-]?$') or flag:match('^'..p.flags.normal..'[+-]?$') or flag:match('^'..p.flags.deprecated..'[+-]?$') then self:setRank(flag) return true elseif flag == p.flags.future or flag == p.flags.current or flag == p.flags.former then self:setPeriod(flag) return true elseif flag == "" then -- ignore empty flags and carry on return true else return false end end function Config:processFlagOrCommand(flag) local param = "" if not flag then return false end if flag == p.claimCommands.property or flag == p.claimCommands.properties then param = parameters.property elseif flag == p.claimCommands.qualifier or flag == p.claimCommands.qualifiers then self.states.qualifiersCount = self.states.qualifiersCount + 1 param = parameters.qualifier .. self.states.qualifiersCount self.separators["sep"..param] = {copyTable(defaultSeparators["sep%q\\d"])} elseif flag == p.claimCommands.reference or flag == p.claimCommands.references then param = parameters.reference else return self:processFlag(flag) end if self.states[param] then return false end -- create a new state for each command self.states[param] = State:new(self, param) -- use "%x" as the general parameter name self.states[param].parsedFormat = parseFormat(parameters.general) -- will be overwritten for param=="%p" -- set the separator self.states[param].separator = self.separators["sep"..param] -- will be nil for param=="%p", which will be set separately if flag == p.claimCommands.property or flag == p.claimCommands.qualifier or flag == p.claimCommands.reference then self.states[param].singleValue = true end self.curState = self.states[param] return true end function Config:processSeparators(args) local sep for i, v in pairs(self.separators) do if args[i] then sep = replaceSpecialChars(args[i]) if sep ~= "" then self.separators[i][1] = {sep} else self.separators[i][1] = nil end end end end function Config:setFormatAndSeparators(state, parsedFormat) state.parsedFormat = parsedFormat state.separator = self.separators["sep"] state.movSeparator = self.separators["sep"..parameters.separator] state.puncMark = self.separators["punc"] end -- determines if a claim has references by prefetching them from the claim using getReferences, -- which applies some filtering that determines if a reference is actually returned, -- and caches the references for later use function State:isSourced(claim) self.conf.prefetchedRefs = self:getReferences(claim) return (#self.conf.prefetchedRefs > 0) end function State:resetCaches() -- any prefetched references of the previous claim must not be used self.conf.prefetchedRefs = nil end function State:claimMatches(claim) local matches, rankPos -- first of all, reset any cached values used for the previous claim self:resetCaches() -- if a property value was given, check if it matches the claim's property value if self.conf.propertyValue then matches = self.conf:snakEqualsValue(claim.mainsnak, self.conf.propertyValue) else matches = true end -- if any qualifier values were given, check if each matches one of the claim's qualifier values for i, v in pairs(self.conf.qualifierIDsAndValues) do matches = (matches and self.conf:qualifierMatches(claim, i, v)) end -- check if the claim's rank and time period match rankPos = rankTable[claim.rank] or 4 matches = (matches and self.conf:rankMatches(rankPos) and self.conf:timeMatches(claim)) -- if only claims with references must be returned, check if this one has any if self.conf.sourcedOnly then matches = (matches and self:isSourced(claim)) -- prefetches and caches references end return matches, rankPos end function State:out() local result -- collection of arrays with value objects local valuesArray -- array with value objects local sep = nil -- value object local out = {} -- array with value objects local function walk(formatTable, result) local valuesArray = {} -- array with value objects for i, v in pairs(formatTable.req) do if not result[i] or not result[i][1] then -- we've got no result for a parameter that is required on this level, -- so skip this level (and its children) by returning an empty result return {} end end for _, v in ipairs(formatTable) do if v.param then valuesArray = mergeArrays(valuesArray, result[v.str]) elseif v.str ~= "" then valuesArray[#valuesArray + 1] = {v.str} end if v.child then valuesArray = mergeArrays(valuesArray, walk(v.child, result)) end end return valuesArray end -- iterate through the results from back to front, so that we know when to add separators for i = #self.results, 1, -1 do result = self.results[i] -- if there is already some output, then add the separators if #out > 0 then sep = self.separator[1] -- fixed separator result[parameters.separator] = {self.movSeparator[1]} -- movable separator else sep = nil result[parameters.separator] = {self.puncMark[1]} -- optional punctuation mark end valuesArray = walk(self.parsedFormat, result) if #valuesArray > 0 then if sep then valuesArray[#valuesArray + 1] = sep end out = mergeArrays(valuesArray, out) end end -- reset state before next iteration self.results = {} return out end -- level 1 hook function State:getProperty(claim) local value = {self:getValue(claim.mainsnak)} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end -- level 1 hook function State:getQualifiers(claim, param) local qualifiers if claim.qualifiers then qualifiers = claim.qualifiers[self.conf.qualifierIDs[param]] end if qualifiers then -- iterate through claim's qualifier statements to collect their values; -- return array with multiple value objects return self.conf.states[param]:iterate(qualifiers, {[parameters.general] = hookNames[parameters.qualifier.."\\d"][2], count = 1}) -- pass qualifier state with level 2 hook else return {} -- return empty array end end -- level 2 hook function State:getQualifier(snak) local value = {self:getValue(snak)} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end -- level 1 hook function State:getAllQualifiers(claim, param, result, hooks) local out = {} -- array with value objects local sep = self.conf.separators["sep"..parameters.qualifier][1] -- value object -- iterate through the output of the separate "qualifier(s)" commands for i = 1, self.conf.states.qualifiersCount do -- if a hook has not been called yet, call it now if not result[parameters.qualifier..i] then self:callHook(parameters.qualifier..i, hooks, claim, result) end -- if there is output for this particular "qualifier(s)" command, then add it if result[parameters.qualifier..i] and result[parameters.qualifier..i][1] then -- if there is already some output, then add the separator if #out > 0 and sep then out[#out + 1] = sep end out = mergeArrays(out, result[parameters.qualifier..i]) end end return out end -- level 1 hook function State:getReferences(claim) if self.conf.prefetchedRefs then -- return references that have been prefetched by isSourced return self.conf.prefetchedRefs end if claim.references then -- iterate through claim's reference statements to collect their values; -- return array with multiple value objects return self.conf.states[parameters.reference]:iterate(claim.references, {[parameters.general] = hookNames[parameters.reference][2], count = 1}) -- pass reference state with level 2 hook else return {} -- return empty array end end -- level 2 hook function State:getReference(statement) local citeParamMapping = i18n['cite']['param-mapping'] local citeConfig = i18n['cite']['config'] local citeTypes = i18n['cite']['output-types'] -- will hold rendered properties of the reference which are not directly from statement.snaks, -- Namely, is URL generated from an external ID. local additionalProcessedProperties = {} -- for each citation type, there will be an associative array that associates lists of rendered properties -- to citation-template parameters local candidateParams = {} -- like above, but only associates one rendered property to each parameter; if the above variable -- contains more strings for a parameter, the strings will be assigned to numbered params (e.g. "author1") local citeParams = {} local citeErrors = {} local referenceEmpty = true -- will be set to false if at least one parameter is left unremoved local version = 12 -- increment this each time the below logic is changed to avoid conflict errors if not statement.snaks then return {} end -- don't use bot-added references referencing Wikimedia projects or containing "inferred from" (such references are not usable on Wikipedia) if statement.snaks[aliasesP.importedFrom] or statement.snaks[aliasesP.wikimediaImportURL] or statement.snaks[aliasesP.inferredFrom] then return {} end -- don't include "type of reference" if statement.snaks[aliasesP.typeOfReference] then statement.snaks[aliasesP.typeOfReference] = nil end -- don't include "image" to prevent littering if statement.snaks[aliasesP.image] then statement.snaks[aliasesP.image] = nil end -- don't include "language" if it is equal to the local one if self:getReferenceDetail(statement.snaks, aliasesP.language) == self.conf.langName then statement.snaks[aliasesP.language] = nil end if statement.snaks[aliasesP.statedIn] and not statement.snaks[aliasesP.referenceURL] then -- "stated in" was given but "reference URL" was not. -- get "Wikidata property" properties from the item in "stated in" -- if any of the returned properties of the external-id datatype is in statement.snaks, generate a link from it and use the link in the reference -- find the "Wikidata property" properties in the item from "stated in" local wikidataPropertiesOfSource = mw.text.split(p._properties{p.flags.raw, aliasesP.wikidataProperty, [p.args.eid] = self.conf:getValue(statement.snaks[aliasesP.statedIn][1], true, false)}, ", ", true) for i, wikidataPropertyOfSource in pairs(wikidataPropertiesOfSource) do if statement.snaks[wikidataPropertyOfSource] and statement.snaks[wikidataPropertyOfSource][1].datatype == "external-id" then local tempLink = self:getReferenceDetail(statement.snaks, wikidataPropertyOfSource, false, true) -- not raw, linked if mw.ustring.match(tempLink, "^%[%Z- %Z+%]$") then -- getValue returned a URL in square brackets. -- the link is in wiki markup, so strip the square brackets and the display text -- gsub also returns another, discarted value, therefore the result is assigned to tempLink first tempLink = mw.ustring.gsub(tempLink, "^%[(%Z-) %Z+%]$", "%1") additionalProcessedProperties[aliasesP.referenceURL] = {tempLink} statement.snaks[wikidataPropertyOfSource] = nil break end end end end -- initialize candidateParams and citeParams for _, citeType in ipairs(citeTypes) do candidateParams[citeType] = {} citeParams[citeType] = {} end -- fill candidateParams for _, citeType in ipairs(citeTypes) do -- This will contain value--priority pairs for each param name. local candidateValuesAndPriorities = {} -- fill candidateValuesAndPriorities for refProperty in pairs(statement.snaks) do if citeErrors[citeType] then break end repeat -- just a simple wrapper to emulate "continue" -- set mappingKey and prefix local mappingKey local prefix = "" if statement.snaks[refProperty][1].datatype == 'external-id' then mappingKey = "external-id" prefix = self.conf:getLabel(refProperty) if prefix ~= "" then prefix = prefix .. " " end else mappingKey = refProperty end local paramName = citeParamMapping[citeType][mappingKey] -- skip properties with empty parameter name if paramName == "" then break -- skip this property for this value of citeType end -- handle unknown properties in the reference if not paramName then referenceEmpty = false local error_message = errorText("unknown-property-in-ref", refProperty) assert(error_message) -- Should not be nil citeErrors[citeType] = error_message break end -- set processedProperty local processedProperty local raw = false -- if the value is wanted raw if isValueInTable(paramName, citeConfig[citeType]["raw-value-params"] or {}) then raw = true end if isValueInTable(paramName, citeConfig[citeType]["numbered-params"] or {}) then -- Multiple values may be given. processedProperty = self:getReferenceDetails(statement.snaks, refProperty, raw, self.linked, true) -- anyLang = true else -- If multiple values are given, all but the first suitable one are discarted. processedProperty = {self:getReferenceDetail(statement.snaks, refProperty, raw, self.linked and (statement.snaks[refProperty][1].datatype ~= 'url'), true)} -- link = true/false, anyLang = true end if #processedProperty == 0 then break end referenceEmpty = false -- add an empty entry to candidateValuesAndPriorities, if there isn't one already if not candidateValuesAndPriorities[paramName] then candidateValuesAndPriorities[paramName] = {} end -- find the priority of refProperty local thisPropertyPriority = -1 local thisParamPrioritization = citeConfig[citeType]["prioritization"][paramName] if thisParamPrioritization then for i_priority, i_property in ipairs(thisParamPrioritization) do if i_property == refProperty then thisPropertyPriority = i_priority end end end for _, propertyValue in pairs(processedProperty) do table.insert( candidateValuesAndPriorities[paramName], {prefix .. propertyValue, thisPropertyPriority} ) end until true end -- fill candidateParams[citeType] if not citeErrors[citeType] then local compareValuePriorities = function(pair1, pair2) if pair1[2] == -1 and pair2[2] ~= -1 then return false end if pair1[2] ~= -1 and pair2[2] == -1 then return true end return pair1[2] < pair2[2] end -- fill candidateParams[citeType][paramName] for each used param for paramName, _ in pairs(candidateValuesAndPriorities) do table.sort(candidateValuesAndPriorities[paramName], compareValuePriorities) candidateParams[citeType][paramName] = {} for _, valuePriorityPair in ipairs(candidateValuesAndPriorities[paramName]) do table.insert(candidateParams[citeType][paramName], valuePriorityPair[1]) end end end end -- handle additional properties for refProperty in pairs(additionalProcessedProperties) do for _, citeType in ipairs(citeTypes) do repeat -- skip if there already have been errors if citeErrors[citeType] then break end local paramName = citeParamMapping[citeType][refProperty] -- handle unknown properties in the reference if not paramName then -- Skip this additional property, but do not cause an error. break end if paramName == "" then break end referenceEmpty = false if not candidateParams[citeType][paramName] then candidateParams[citeType][paramName] = {} end for _, propertyValue in pairs(additionalProcessedProperties[refProperty]) do table.insert(candidateParams[citeType][paramName], propertyValue) end until true end end -- fill citeParams for _, citeType in ipairs(citeTypes) do for paramName, paramValues in pairs(candidateParams[citeType]) do if #paramValues == 1 or not isValueInTable(paramName, citeConfig[citeType]["numbered-params"] or {}) then citeParams[citeType][paramName] = paramValues[1] else -- There is more than one value for this parameter - the values will -- go into separate numbered parameters (e.g. "author1", "author2") for paramNum, paramValue in pairs(paramValues) do citeParams[citeType][paramName .. paramNum] = paramValue end end end end -- handle missing mandatory parameters for the templates for _, citeType in ipairs(citeTypes) do for _, requiredCiteParam in pairs(citeConfig[citeType]["mandatory-params"] or {}) do if not citeParams[citeType][requiredCiteParam] then -- The required param is not present. if citeErrors[citeType] then -- Do not override the previous error, if it exists. break end local error_message = errorText("missing-mandatory-param", requiredCiteParam) assert(error_message) -- Should not be nil citeErrors[citeType] = error_message end end end local citeTypeToUse = nil -- choose the output template for _, citeType in ipairs(citeTypes) do if not citeErrors[citeType] then citeTypeToUse = citeType break end end -- set refContent local refContent = "" if citeTypeToUse then local templateToUse = citeConfig[citeTypeToUse]["template"] local paramsToUse = citeParams[citeTypeToUse] if not templateToUse or templateToUse == "" then throwError("no-such-reference-template", tostring(templateToUse), i18nPath, citeTypeToUse) end -- if this module is being substituted then build a regular template call, otherwise expand the template if mw.isSubsting() then for i, v in pairs(paramsToUse) do refContent = refContent .. "|" .. i .. "=" .. v end refContent = "{{" .. templateToUse .. refContent .. "}}" else xpcall( function () refContent = mw.getCurrentFrame():expandTemplate{title=templateToUse, args=paramsToUse} end, function () throwError("no-such-reference-template", templateToUse, i18nPath, citeTypeToUse) end ) end -- If the citation couldn't be displayed using any template, but is not empty (barring ignored propeties), throw an error. elseif not referenceEmpty then refContent = errorText("malformed-reference-header") for _, citeType in ipairs(citeTypes) do refContent = refContent .. errorText("template-failure-reason", citeConfig[citeType]["template"], citeErrors[citeType]) end refContent = refContent .. errorText("malformed-reference-footer") end -- wrap refContent local ref = {} if refContent ~= "" then ref = {refContent} if not self.rawValue then -- this should become a <ref> tag, so save the reference's hash for later ref.refHash = "wikidata-" .. statement.hash .. "-v" .. (tonumber(i18n['version']) + version) end return {ref} else return {} end end -- gets a detail of one particular type for a reference function State:getReferenceDetail(snaks, dType, raw, link, anyLang) local switchLang = anyLang local value = nil if not snaks[dType] then return nil end -- if anyLang, first try the local language and otherwise any language repeat for _, v in ipairs(snaks[dType]) do value = self.conf:getValue(v, raw, link, false, anyLang and not switchLang, false, true) -- noSpecial = true if value then break end end if value or not anyLang then break end switchLang = not switchLang until anyLang and switchLang return value end -- gets the details of one particular type for a reference function State:getReferenceDetails(snaks, dType, raw, link, anyLang) local values = {} if not snaks[dType] then return {} end for _, v in ipairs(snaks[dType]) do -- if nil is returned then it will not be added to the table values[#values + 1] = self.conf:getValue(v, raw, link, false, anyLang, false, true) -- noSpecial = true end return values end -- level 1 hook function State:getAlias(object) local value = object.value local title = nil if value and self.linked then if self.conf.entityID:sub(1,1) == "Q" then title = mw.wikibase.getSitelink(self.conf.entityID) elseif self.conf.entityID:sub(1,1) == "P" then title = "d:Property:" .. self.conf.entityID end if title then value = buildWikilink(title, value) end end value = {value} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end -- level 1 hook function State:getBadge(value) value = self.conf:getLabel(value, self.rawValue, self.linked, self.shortName) if value == "" then value = nil end value = {value} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end function State:callHook(param, hooks, statement, result) -- call a parameter's hook if it has been defined and if it has not been called before if not result[param] and hooks[param] then local valuesArray = self[hooks[param]](self, statement, param, result, hooks) -- array with value objects -- add to the result if #valuesArray > 0 then result[param] = valuesArray result.count = result.count + 1 else result[param] = {} -- an empty array to indicate that we've tried this hook already return true -- miss == true end end return false end -- iterate through claims, claim's qualifiers or claim's references to collect values function State:iterate(statements, hooks, matchHook) matchHook = matchHook or alwaysTrue local matches = false local rankPos = nil local result, gotRequired for _, v in ipairs(statements) do -- rankPos will be nil for non-claim statements (e.g. qualifiers, references, etc.) matches, rankPos = matchHook(self, v) if matches then result = {count = 0} -- collection of arrays with value objects local function walk(formatTable) local miss for i2, v2 in pairs(formatTable.req) do -- call a hook, adding its return value to the result miss = self:callHook(i2, hooks, v, result) if miss then -- we miss a required value for this level, so return false return false end if result.count == hooks.count then -- we're done if all hooks have been called; -- returning at this point breaks the loop return true end end for _, v2 in ipairs(formatTable) do if result.count == hooks.count then -- we're done if all hooks have been called; -- returning at this point prevents further childs from being processed return true end if v2.child then walk(v2.child) end end return true end gotRequired = walk(self.parsedFormat) -- only append the result if we got values for all required parameters on the root level if gotRequired then -- if we have a rankPos (only with matchHook() for complete claims), then update the foundRank if rankPos and self.conf.foundRank > rankPos then self.conf.foundRank = rankPos end -- append the result self.results[#self.results + 1] = result -- break if we only need a single value if self.singleValue then break end end end end return self:out() end local function getEntityId(arg, eid, page, allowOmitPropPrefix, globalSiteId) local id = nil local prop = nil if arg then if arg:sub(1,1) == ":" then page = arg eid = nil elseif arg:sub(1,1):upper() == "Q" or arg:sub(1,9):lower() == "property:" or allowOmitPropPrefix then eid = arg page = nil else prop = arg end end if eid then if eid:sub(1,9):lower() == "property:" then id = replaceAlias(mw.text.trim(eid:sub(10))) if id:sub(1,1):upper() ~= "P" then id = "" end else id = replaceAlias(eid) end elseif page then if page:sub(1,1) == ":" then page = mw.text.trim(page:sub(2)) end id = mw.wikibase.getEntityIdForTitle(page, globalSiteId) or "" end if not id then id = mw.wikibase.getEntityIdForCurrentPage() or "" end id = id:upper() if not mw.wikibase.isValidEntityId(id) then id = "" end return id, prop end local function nextArg(args) local arg = args[args.pointer] if arg then args.pointer = args.pointer + 1 return mw.text.trim(arg) else return nil end end local function claimCommand(args, funcName) local cfg = Config:new() cfg:processFlagOrCommand(funcName) -- process first command (== function name) local lastArg, parsedFormat, formatParams, claims, value local hooks = {count = 0} -- set the date if given; -- must come BEFORE processing the flags if args[p.args.date] then cfg.atDate = {parseDate(args[p.args.date])} cfg.periods = {false, true, false} -- change default time constraint to 'current' end -- process flags and commands repeat lastArg = nextArg(args) until not cfg:processFlagOrCommand(lastArg) -- get the entity ID from either the positional argument, the eid argument or the page argument cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], false, args[p.args.globalSiteId]) if cfg.entityID == "" then return "" -- we cannot continue without a valid entity ID end cfg.entity = mw.wikibase.getEntity(cfg.entityID) if not cfg.propertyID then cfg.propertyID = nextArg(args) end cfg.propertyID = replaceAlias(cfg.propertyID) if not cfg.entity or not cfg.propertyID then return "" -- we cannot continue without an entity or a property ID end cfg.propertyID = cfg.propertyID:upper() if not cfg.entity.claims or not cfg.entity.claims[cfg.propertyID] then return "" -- there is no use to continue without any claims end claims = cfg.entity.claims[cfg.propertyID] if cfg.states.qualifiersCount > 0 then -- do further processing if "qualifier(s)" command was given if #args - args.pointer + 1 > cfg.states.qualifiersCount then -- claim ID or literal value has been given cfg.propertyValue = nextArg(args) end for i = 1, cfg.states.qualifiersCount do -- check if given qualifier ID is an alias and add it cfg.qualifierIDs[parameters.qualifier..i] = replaceAlias(nextArg(args) or ""):upper() end elseif cfg.states[parameters.reference] then -- do further processing if "reference(s)" command was given cfg.propertyValue = nextArg(args) end -- check for special property value 'somevalue' or 'novalue' if cfg.propertyValue then cfg.propertyValue = replaceSpecialChars(cfg.propertyValue) if cfg.propertyValue ~= "" and mw.text.trim(cfg.propertyValue) == "" then cfg.propertyValue = " " -- single space represents 'somevalue', whereas empty string represents 'novalue' else cfg.propertyValue = mw.text.trim(cfg.propertyValue) end end -- parse the desired format, or choose an appropriate format if args["format"] then parsedFormat, formatParams = parseFormat(args["format"]) elseif cfg.states.qualifiersCount > 0 then -- "qualifier(s)" command given if cfg.states[parameters.property] then -- "propert(y|ies)" command given parsedFormat, formatParams = parseFormat(formats.propertyWithQualifier) else parsedFormat, formatParams = parseFormat(formats.qualifier) end elseif cfg.states[parameters.property] then -- "propert(y|ies)" command given parsedFormat, formatParams = parseFormat(formats.property) else -- "reference(s)" command given parsedFormat, formatParams = parseFormat(formats.reference) end -- if a "qualifier(s)" command and no "propert(y|ies)" command has been given, make the movable separator a semicolon if cfg.states.qualifiersCount > 0 and not cfg.states[parameters.property] then cfg.separators["sep"..parameters.separator][1] = {";"} end -- if only "reference(s)" has been given, set the default separator to none (except when raw) if cfg.states[parameters.reference] and not cfg.states[parameters.property] and cfg.states.qualifiersCount == 0 and not cfg.states[parameters.reference].rawValue then cfg.separators["sep"][1] = nil end -- if exactly one "qualifier(s)" command has been given, make "sep%q" point to "sep%q1" to make them equivalent if cfg.states.qualifiersCount == 1 then cfg.separators["sep"..parameters.qualifier] = cfg.separators["sep"..parameters.qualifier.."1"] end -- process overridden separator values; -- must come AFTER tweaking the default separators cfg:processSeparators(args) -- define the hooks that should be called (getProperty, getQualifiers, getReferences); -- only define a hook if both its command ("propert(y|ies)", "reference(s)", "qualifier(s)") and its parameter ("%p", "%r", "%q1", "%q2", "%q3") have been given for i, v in pairs(cfg.states) do -- e.g. 'formatParams["%q1"] or formatParams["%q"]' to define hook even if "%q1" was not defined to be able to build a complete value for "%q" if formatParams[i] or formatParams[i:sub(1, 2)] then hooks[i] = getHookName(i, 1) hooks.count = hooks.count + 1 end end -- the "%q" parameter is not attached to a state, but is a collection of the results of multiple states (attached to "%q1", "%q2", "%q3", ...); -- so if this parameter is given then this hook must be defined separately, but only if at least one "qualifier(s)" command has been given if formatParams[parameters.qualifier] and cfg.states.qualifiersCount > 0 then hooks[parameters.qualifier] = getHookName(parameters.qualifier, 1) hooks.count = hooks.count + 1 end -- create a state for "properties" if it doesn't exist yet, which will be used as a base configuration for each claim iteration; -- must come AFTER defining the hooks if not cfg.states[parameters.property] then cfg.states[parameters.property] = State:new(cfg, parameters.property) -- if the "single" flag has been given then this state should be equivalent to "property" (singular) if cfg.singleClaim then cfg.states[parameters.property].singleValue = true end end -- if the "sourced" flag has been given then create a state for "reference" if it doesn't exist yet, using default values, -- which must exist in order to be able to determine if a claim has any references; -- must come AFTER defining the hooks if cfg.sourcedOnly and not cfg.states[parameters.reference] then cfg:processFlagOrCommand(p.claimCommands.reference) -- use singular "reference" to minimize overhead end -- set the parsed format and the separators (and optional punctuation mark); -- must come AFTER creating the additonal states cfg:setFormatAndSeparators(cfg.states[parameters.property], parsedFormat) -- process qualifier matching values, analogous to cfg.propertyValue for i, v in pairs(args) do i = tostring(i) if i:match('^[Pp]%d+$') or aliasesP[i] then v = replaceSpecialChars(v) -- check for special qualifier value 'somevalue' if v ~= "" and mw.text.trim(v) == "" then v = " " -- single space represents 'somevalue' end cfg.qualifierIDsAndValues[replaceAlias(i):upper()] = v end end -- first sort the claims on rank to pre-define the order of output (preferred first, then normal, then deprecated) claims = sortOnRank(claims) -- then iterate through the claims to collect values value = cfg:concatValues(cfg.states[parameters.property]:iterate(claims, hooks, State.claimMatches)) -- pass property state with level 1 hooks and matchHook -- if desired, add a clickable icon that may be used to edit the returned values on Wikidata if cfg.editable and value ~= "" then value = value .. cfg:getEditIcon() end return value end local function generalCommand(args, funcName) local cfg = Config:new() cfg.curState = State:new(cfg) local lastArg local value = nil repeat lastArg = nextArg(args) until not cfg:processFlag(lastArg) -- get the entity ID from either the positional argument, the eid argument or the page argument cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true, args[p.args.globalSiteId]) if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then return "" -- we cannot continue without an entity end -- serve according to the given command if funcName == p.generalCommands.label then value = cfg:getLabel(cfg.entityID, cfg.curState.rawValue, cfg.curState.linked, cfg.curState.shortName) elseif funcName == p.generalCommands.title then cfg.inSitelinks = true if cfg.entityID:sub(1,1) == "Q" then value = mw.wikibase.getSitelink(cfg.entityID) end if cfg.curState.linked and value then value = buildWikilink(value) end elseif funcName == p.generalCommands.description then value = mw.wikibase.getDescription(cfg.entityID) else local parsedFormat, formatParams local hooks = {count = 0} cfg.entity = mw.wikibase.getEntity(cfg.entityID) if funcName == p.generalCommands.alias or funcName == p.generalCommands.badge then cfg.curState.singleValue = true end if funcName == p.generalCommands.alias or funcName == p.generalCommands.aliases then if not cfg.entity.aliases or not cfg.entity.aliases[cfg.langCode] then return "" -- there is no use to continue without any aliasses end local aliases = cfg.entity.aliases[cfg.langCode] -- parse the desired format, or parse the default aliases format if args["format"] then parsedFormat, formatParams = parseFormat(args["format"]) else parsedFormat, formatParams = parseFormat(formats.alias) end -- process overridden separator values; -- must come AFTER tweaking the default separators cfg:processSeparators(args) -- define the hook that should be called (getAlias); -- only define the hook if the parameter ("%a") has been given if formatParams[parameters.alias] then hooks[parameters.alias] = getHookName(parameters.alias, 1) hooks.count = hooks.count + 1 end -- set the parsed format and the separators (and optional punctuation mark) cfg:setFormatAndSeparators(cfg.curState, parsedFormat) -- iterate to collect values value = cfg:concatValues(cfg.curState:iterate(aliases, hooks)) elseif funcName == p.generalCommands.badge or funcName == p.generalCommands.badges then if not cfg.entity.sitelinks or not cfg.entity.sitelinks[cfg.siteID] or not cfg.entity.sitelinks[cfg.siteID].badges then return "" -- there is no use to continue without any badges end local badges = cfg.entity.sitelinks[cfg.siteID].badges cfg.inSitelinks = true -- parse the desired format, or parse the default aliases format if args["format"] then parsedFormat, formatParams = parseFormat(args["format"]) else parsedFormat, formatParams = parseFormat(formats.badge) end -- process overridden separator values; -- must come AFTER tweaking the default separators cfg:processSeparators(args) -- define the hook that should be called (getBadge); -- only define the hook if the parameter ("%b") has been given if formatParams[parameters.badge] then hooks[parameters.badge] = getHookName(parameters.badge, 1) hooks.count = hooks.count + 1 end -- set the parsed format and the separators (and optional punctuation mark) cfg:setFormatAndSeparators(cfg.curState, parsedFormat) -- iterate to collect values value = cfg:concatValues(cfg.curState:iterate(badges, hooks)) end end value = value or "" if cfg.editable and value ~= "" then -- if desired, add a clickable icon that may be used to edit the returned value on Wikidata value = value .. cfg:getEditIcon() end return value end -- modules that include this module should call the functions with an underscore prepended, e.g.: p._property(args) local function establishCommands(commandList, commandFunc) for _, commandName in pairs(commandList) do local function wikitextWrapper(frame) local args = copyTable(frame.args) args.pointer = 1 loadI18n(aliasesP, frame) return commandFunc(args, commandName) end p[commandName] = wikitextWrapper local function luaWrapper(args) args = copyTable(args) args.pointer = 1 loadI18n(aliasesP) return commandFunc(args, commandName) end p["_" .. commandName] = luaWrapper end end establishCommands(p.claimCommands, claimCommand) establishCommands(p.generalCommands, generalCommand) -- main function that is supposed to be used by wrapper templates function p.main(frame) if not mw.wikibase then return nil end local f, args loadI18n(aliasesP, frame) -- get the parent frame to take the arguments that were passed to the wrapper template frame = frame:getParent() or frame if not frame.args[1] then throwError("no-function-specified") end f = mw.text.trim(frame.args[1]) if f == "main" then throwError("main-called-twice") end assert(p["_"..f], errorText('no-such-function', f)) -- copy arguments from immutable to mutable table args = copyTable(frame.args) -- remove the function name from the list table.remove(args, 1) return p["_"..f](args) end return p j5a6l03tjwodgrvfnv3lb4x5up93wlv 116448 116447 2026-06-17T02:29:40Z Viyowoyero-vya-Malaŵi 11606 Undid revision [[Special:Diff/116447|116447]] by [[Special:Contributions/Viyowoyero-vya-Malaŵi|Viyowoyero-vya-Malaŵi]] ([[User talk:Viyowoyero-vya-Malaŵi|talk]]) 116448 Scribunto text/plain -- Original module located at [[:en:Module:Wd]] and [[:en:Module:Wd/i18n]]. require("strict") local p = {} local arg = ... local i18n local function loadI18n(aliasesP, frame) local title if frame then -- current module invoked by page/template, get its title from frame title = frame:getTitle() else -- current module included by other module, get its title from ... title = arg end if not i18n then i18n = require(title .. "/i18n").init(aliasesP) end end p.claimCommands = { property = "property", properties = "properties", qualifier = "qualifier", qualifiers = "qualifiers", reference = "reference", references = "references" } p.generalCommands = { label = "label", title = "title", description = "description", alias = "alias", aliases = "aliases", badge = "badge", badges = "badges" } p.flags = { linked = "linked", short = "short", raw = "raw", multilanguage = "multilanguage", unit = "unit", ------------- preferred = "preferred", normal = "normal", deprecated = "deprecated", best = "best", future = "future", current = "current", former = "former", edit = "edit", editAtEnd = "edit@end", mdy = "mdy", single = "single", sourced = "sourced" } p.args = { eid = "eid", page = "page", date = "date" } local aliasesP = { coord = "P625", ----------------------- image = "P18", author = "P50", authorNameString = "P2093", publisher = "P123", importedFrom = "P143", wikimediaImportURL = "P4656", statedIn = "P248", pages = "P304", language = "P407", hasPart = "P527", publicationDate = "P577", startTime = "P580", endTime = "P582", chapter = "P792", retrieved = "P813", referenceURL = "P854", sectionVerseOrParagraph = "P958", archiveURL = "P1065", title = "P1476", formatterURL = "P1630", quote = "P1683", shortName = "P1813", definingFormula = "P2534", archiveDate = "P2960", inferredFrom = "P3452", typeOfReference = "P3865", column = "P3903", subjectNamedAs = "P1810", wikidataProperty = "P1687", publishedIn = "P1433" } local aliasesQ = { percentage = "Q11229", prolepticJulianCalendar = "Q1985786", citeWeb = "Q5637226", citeQ = "Q22321052" } local parameters = { property = "%p", qualifier = "%q", reference = "%r", alias = "%a", badge = "%b", separator = "%s", general = "%x" } local formats = { property = "%p[%s][%r]", qualifier = "%q[%s][%r]", reference = "%r", propertyWithQualifier = "%p[ <span style=\"font-size:85\\%\">(%q)</span>][%s][%r]", alias = "%a[%s]", badge = "%b[%s]" } local hookNames = { -- {level_1, level_2} [parameters.property] = {"getProperty"}, [parameters.reference] = {"getReferences", "getReference"}, [parameters.qualifier] = {"getAllQualifiers"}, [parameters.qualifier.."\\d"] = {"getQualifiers", "getQualifier"}, [parameters.alias] = {"getAlias"}, [parameters.badge] = {"getBadge"} } -- default value objects, should NOT be mutated but instead copied local defaultSeparators = { ["sep"] = {" "}, ["sep%s"] = {","}, ["sep%q"] = {"; "}, ["sep%q\\d"] = {", "}, ["sep%r"] = nil, -- none ["punc"] = nil -- none } local rankTable = { ["preferred"] = 1, ["normal"] = 2, ["deprecated"] = 3 } local function replaceAlias(id) if aliasesP[id] then id = aliasesP[id] end return id end local function errorText(code, param) local text = i18n["errors"][code] if param then text = mw.ustring.gsub(text, "$1", param) end return text end local function throwError(errorMessage, param) error(errorText(errorMessage, param)) end local function replaceDecimalMark(num) return mw.ustring.gsub(num, "[.]", i18n['numeric']['decimal-mark'], 1) end local function padZeros(num, numDigits) local numZeros local negative = false if num < 0 then negative = true num = num * -1 end num = tostring(num) numZeros = numDigits - num:len() for _ = 1, numZeros do num = "0"..num end if negative then num = "-"..num end return num end local function replaceSpecialChar(chr) if chr == '_' then -- replace underscores with spaces return ' ' else return chr end end local function replaceSpecialChars(str) local chr local esc = false local strOut = "" for i = 1, #str do chr = str:sub(i,i) if not esc then if chr == '\\' then esc = true else strOut = strOut .. replaceSpecialChar(chr) end else strOut = strOut .. chr esc = false end end return strOut end local function buildWikilink(target, label) if not label or target == label then return "[[" .. target .. "]]" else return "[[" .. target .. "|" .. label .. "]]" end end -- used to make frame.args mutable, to replace #frame.args (which is always 0) -- with the actual amount and to simply copy tables local function copyTable(tIn) if not tIn then return nil end local tOut = {} for i, v in pairs(tIn) do tOut[i] = v end return tOut end -- used to merge output arrays together; -- note that it currently mutates the first input array local function mergeArrays(a1, a2) for i = 1, #a2 do a1[#a1 + 1] = a2[i] end return a1 end local function split(str, del) local out = {} local i, j = str:find(del) if i and j then out[1] = str:sub(1, i - 1) out[2] = str:sub(j + 1) else out[1] = str end return out end local function parseWikidataURL(url) local id if url:match('^http[s]?://') then id = split(url, "Q") if id[2] then return "Q" .. id[2] end end return nil end local function parseDate(dateStr, precision) precision = precision or "d" local i, j, index, ptr local parts = {nil, nil, nil} if dateStr == nil then return parts[1], parts[2], parts[3] -- year, month, day end -- 'T' for snak values, '/' for outputs with '/Julian' attached i, j = dateStr:find("[T/]") if i then dateStr = dateStr:sub(1, i-1) end local from = 1 if dateStr:sub(1,1) == "-" then -- this is a negative number, look further ahead from = 2 end index = 1 ptr = 1 i, j = dateStr:find("-", from) if i then -- year parts[index] = tonumber(dateStr:sub(ptr, i-1), 10) -- explicitly give base 10 to prevent error if parts[index] == -0 then parts[index] = tonumber("0") -- for some reason, 'parts[index] = 0' may actually store '-0', so parse from string instead end if precision == "y" then -- we're done return parts[1], parts[2], parts[3] -- year, month, day end index = index + 1 ptr = i + 1 i, j = dateStr:find("-", ptr) if i then -- month parts[index] = tonumber(dateStr:sub(ptr, i-1), 10) if precision == "m" then -- we're done return parts[1], parts[2], parts[3] -- year, month, day end index = index + 1 ptr = i + 1 end end if dateStr:sub(ptr) ~= "" then -- day if we have month, month if we have year, or year parts[index] = tonumber(dateStr:sub(ptr), 10) end return parts[1], parts[2], parts[3] -- year, month, day end local function datePrecedesDate(aY, aM, aD, bY, bM, bD) if aY == nil or bY == nil then return nil end aM = aM or 1 aD = aD or 1 bM = bM or 1 bD = bD or 1 if aY < bY then return true end if aY > bY then return false end if aM < bM then return true end if aM > bM then return false end if aD < bD then return true end return false end local function getHookName(param, index) if hookNames[param] then return hookNames[param][index] elseif param:len() > 2 then return hookNames[param:sub(1, 2).."\\d"][index] else return nil end end local function alwaysTrue() return true end -- The following function parses a format string. -- -- The example below shows how a parsed string is structured in memory. -- Variables other than 'str' and 'child' are left out for clarity's sake. -- -- Example: -- "A %p B [%s[%q1]] C [%r] D" -- -- Structure: -- [ -- { -- str = "A " -- }, -- { -- str = "%p" -- }, -- { -- str = " B ", -- child = -- [ -- { -- str = "%s", -- child = -- [ -- { -- str = "%q1" -- } -- ] -- } -- ] -- }, -- { -- str = " C ", -- child = -- [ -- { -- str = "%r" -- } -- ] -- }, -- { -- str = " D" -- } -- ] -- local function parseFormat(str) local chr, esc, param, root, cur, prev, new local params = {} local function newObject(array) local obj = {} -- new object obj.str = "" array[#array + 1] = obj -- array{object} obj.parent = array return obj end local function endParam() if param > 0 then if cur.str ~= "" then cur.str = "%"..cur.str cur.param = true params[cur.str] = true cur.parent.req[cur.str] = true prev = cur cur = newObject(cur.parent) end param = 0 end end root = {} -- array root.req = {} cur = newObject(root) prev = nil esc = false param = 0 for i = 1, #str do chr = str:sub(i,i) if not esc then if chr == '\\' then endParam() esc = true elseif chr == '%' then endParam() if cur.str ~= "" then cur = newObject(cur.parent) end param = 2 elseif chr == '[' then endParam() if prev and cur.str == "" then table.remove(cur.parent) cur = prev end cur.child = {} -- new array cur.child.req = {} cur.child.parent = cur cur = newObject(cur.child) elseif chr == ']' then endParam() if cur.parent.parent then new = newObject(cur.parent.parent.parent) if cur.str == "" then table.remove(cur.parent) end cur = new end else if param > 1 then param = param - 1 elseif param == 1 then if not chr:match('%d') then endParam() end end cur.str = cur.str .. replaceSpecialChar(chr) end else cur.str = cur.str .. chr esc = false end prev = nil end endParam() -- make sure that at least one required parameter has been defined if not next(root.req) then throwError("missing-required-parameter") end -- make sure that the separator parameter "%s" is not amongst the required parameters if root.req[parameters.separator] then throwError("extra-required-parameter", parameters.separator) end return root, params end local function sortOnRank(claims) local rankPos local ranks = {{}, {}, {}, {}} -- preferred, normal, deprecated, (default) local sorted = {} for _, v in ipairs(claims) do rankPos = rankTable[v.rank] or 4 ranks[rankPos][#ranks[rankPos] + 1] = v end sorted = ranks[1] sorted = mergeArrays(sorted, ranks[2]) sorted = mergeArrays(sorted, ranks[3]) return sorted end local Config = {} -- allows for recursive calls function Config:new() local cfg = {} setmetatable(cfg, self) self.__index = self cfg.separators = { -- single value objects wrapped in arrays so that we can pass by reference ["sep"] = {copyTable(defaultSeparators["sep"])}, ["sep%s"] = {copyTable(defaultSeparators["sep%s"])}, ["sep%q"] = {copyTable(defaultSeparators["sep%q"])}, ["sep%r"] = {copyTable(defaultSeparators["sep%r"])}, ["punc"] = {copyTable(defaultSeparators["punc"])} } cfg.entity = nil cfg.entityID = nil cfg.propertyID = nil cfg.propertyValue = nil cfg.qualifierIDs = {} cfg.qualifierIDsAndValues = {} cfg.bestRank = true cfg.ranks = {true, true, false} -- preferred = true, normal = true, deprecated = false cfg.foundRank = #cfg.ranks cfg.flagBest = false cfg.flagRank = false cfg.periods = {true, true, true} -- future = true, current = true, former = true cfg.flagPeriod = false cfg.atDate = {parseDate(os.date('!%Y-%m-%d'))} -- today as {year, month, day} cfg.mdyDate = false cfg.singleClaim = false cfg.sourcedOnly = false cfg.editable = false cfg.editAtEnd = false cfg.inSitelinks = false cfg.langCode = mw.language.getContentLanguage().code cfg.langName = mw.language.fetchLanguageName(cfg.langCode, cfg.langCode) cfg.langObj = mw.language.new(cfg.langCode) cfg.siteID = mw.wikibase.getGlobalSiteId() cfg.states = {} cfg.states.qualifiersCount = 0 cfg.curState = nil cfg.prefetchedRefs = nil return cfg end local State = {} function State:new(cfg, type) local stt = {} setmetatable(stt, self) self.__index = self stt.conf = cfg stt.type = type stt.results = {} stt.parsedFormat = {} stt.separator = {} stt.movSeparator = {} stt.puncMark = {} stt.linked = false stt.rawValue = false stt.shortName = false stt.anyLanguage = false stt.unitOnly = false stt.singleValue = false return stt end -- if id == nil then item connected to current page is used function Config:getLabel(id, raw, link, short) local label = nil local prefix, title= "", nil if not id then id = mw.wikibase.getEntityIdForCurrentPage() if not id then return "" end end id = id:upper() -- just to be sure if raw then -- check if given id actually exists if mw.wikibase.isValidEntityId(id) and mw.wikibase.entityExists(id) then label = id end prefix, title = "d:Special:EntityPage/", label -- may be nil else -- try short name first if requested if short then label = p._property{aliasesP.shortName, [p.args.eid] = id} -- get short name if label == "" then label = nil end end -- get label if not label then label = mw.wikibase.getLabelByLang(id, self.langCode) -- XXX: should use fallback labels? end end if not label then label = "" elseif link then -- build a link if requested if not title then if id:sub(1,1) == "Q" then title = mw.wikibase.getSitelink(id) elseif id:sub(1,1) == "P" then -- properties have no sitelink, link to Wikidata instead prefix, title = "d:Special:EntityPage/", id end end label = mw.text.nowiki(label) -- escape raw label text so it cannot be wikitext markup if title then label = buildWikilink(prefix .. title, label) end end return label end function Config:getEditIcon() local value = "" local prefix = "" local front = "&nbsp;" local back = "" if self.entityID:sub(1,1) == "P" then prefix = "Property:" end if self.editAtEnd then front = '<span style="float:' if self.langObj:isRTL() then front = front .. 'left' else front = front .. 'right' end front = front .. '">' back = '</span>' end value = "[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=" .. i18n['info']['edit-on-wikidata'] .. "|link=https://www.wikidata.org/wiki/" .. prefix .. self.entityID .. "?uselang=" .. self.langCode if self.propertyID then value = value .. "#" .. self.propertyID elseif self.inSitelinks then value = value .. "#sitelinks-wikipedia" end value = value .. "|" .. i18n['info']['edit-on-wikidata'] .. "]]" return front .. value .. back end -- used to create the final output string when it's all done, so that for references the -- function extensionTag("ref", ...) is only called when they really ended up in the final output function Config:concatValues(valuesArray) local outString = "" local j, skip for i = 1, #valuesArray do -- check if this is a reference if valuesArray[i].refHash then j = i - 1 skip = false -- skip this reference if it is part of a continuous row of references that already contains the exact same reference while valuesArray[j] and valuesArray[j].refHash do if valuesArray[i].refHash == valuesArray[j].refHash then skip = true break end j = j - 1 end if not skip then -- add <ref> tag with the reference's hash as its name (to deduplicate references) outString = outString .. mw.getCurrentFrame():extensionTag("ref", valuesArray[i][1], {name = valuesArray[i].refHash}) end else outString = outString .. valuesArray[i][1] end end return outString end function Config:convertUnit(unit, raw, link, short, unitOnly) local space = " " local label = "" local itemID if unit == "" or unit == "1" then return nil end if unitOnly then space = "" end itemID = parseWikidataURL(unit) if itemID then if itemID == aliasesQ.percentage then return "%" else label = self:getLabel(itemID, raw, link, short) if label ~= "" then return space .. label end end end return "" end function State:getValue(snak) return self.conf:getValue(snak, self.rawValue, self.linked, self.shortName, self.anyLanguage, self.unitOnly, false, self.type:sub(1,2)) end function Config:getValue(snak, raw, link, short, anyLang, unitOnly, noSpecial, type) if snak.snaktype == 'value' then local datatype = snak.datavalue.type local subtype = snak.datatype local datavalue = snak.datavalue.value if datatype == 'string' then if subtype == 'url' and link then -- create link explicitly if raw then -- will render as a linked number like [1] return "[" .. datavalue .. "]" else return "[" .. datavalue .. " " .. datavalue .. "]" end elseif subtype == 'commonsMedia' then if link then return buildWikilink("c:File:" .. datavalue, datavalue) elseif not raw then return "[[File:" .. datavalue .. "]]" else return datavalue end elseif subtype == 'geo-shape' and link then return buildWikilink("c:" .. datavalue, datavalue) elseif subtype == 'math' and not raw then local attribute = nil if (type == parameters.property or (type == parameters.qualifier and self.propertyID == aliasesP.hasPart)) and snak.property == aliasesP.definingFormula then attribute = {qid = self.entityID} end return mw.getCurrentFrame():extensionTag("math", datavalue, attribute) elseif subtype == 'external-id' and link then local url = p._property{aliasesP.formatterURL, [p.args.eid] = snak.property} -- get formatter URL if url ~= "" then url = mw.ustring.gsub(url, "$1", datavalue) return "[" .. url .. " " .. datavalue .. "]" else return datavalue end else return datavalue end elseif datatype == 'monolingualtext' then if anyLang or datavalue['language'] == self.langCode then return datavalue['text'] else return nil end elseif datatype == 'quantity' then local value = "" local unit if not unitOnly then -- get value and strip + signs from front value = mw.ustring.gsub(datavalue['amount'], "^%+(.+)$", "%1") if raw then return value end -- replace decimal mark based on locale value = replaceDecimalMark(value) -- add delimiters for readability value = i18n.addDelimiters(value) end unit = self:convertUnit(datavalue['unit'], raw, link, short, unitOnly) if unit then value = value .. unit end return value elseif datatype == 'time' then local y, m, d, p, yDiv, yRound, yFull, value, calendarID, dateStr local yFactor = 1 local sign = 1 local prefix = "" local suffix = "" local mayAddCalendar = false local calendar = "" local precision = datavalue['precision'] if precision == 11 then p = "d" elseif precision == 10 then p = "m" else p = "y" yFactor = 10^(9-precision) end y, m, d = parseDate(datavalue['time'], p) if y < 0 then sign = -1 y = y * sign end -- if precision is tens/hundreds/thousands/millions/billions of years if precision <= 8 then yDiv = y / yFactor -- if precision is tens/hundreds/thousands of years if precision >= 6 then mayAddCalendar = true if precision <= 7 then -- round centuries/millenniums up (e.g. 20th century or 3rd millennium) yRound = math.ceil(yDiv) if not raw then if precision == 6 then suffix = i18n['datetime']['suffixes']['millennium'] else suffix = i18n['datetime']['suffixes']['century'] end suffix = i18n.getOrdinalSuffix(yRound) .. suffix else -- if not verbose, take the first year of the century/millennium -- (e.g. 1901 for 20th century or 2001 for 3rd millennium) yRound = (yRound - 1) * yFactor + 1 end else -- precision == 8 -- round decades down (e.g. 2010s) yRound = math.floor(yDiv) * yFactor if not raw then prefix = i18n['datetime']['prefixes']['decade-period'] suffix = i18n['datetime']['suffixes']['decade-period'] end end if raw and sign < 0 then -- if BCE then compensate for "counting backwards" -- (e.g. -2019 for 2010s BCE, -2000 for 20th century BCE or -3000 for 3rd millennium BCE) yRound = yRound + yFactor - 1 end else local yReFactor, yReDiv, yReRound -- round to nearest for tens of thousands of years or more yRound = math.floor(yDiv + 0.5) if yRound == 0 then if precision <= 2 and y ~= 0 then yReFactor = 1e6 yReDiv = y / yReFactor yReRound = math.floor(yReDiv + 0.5) if yReDiv == yReRound then -- change precision to millions of years only if we have a whole number of them precision = 3 yFactor = yReFactor yRound = yReRound end end if yRound == 0 then -- otherwise, take the unrounded (original) number of years precision = 5 yFactor = 1 yRound = y mayAddCalendar = true end end if precision >= 1 and y ~= 0 then yFull = yRound * yFactor yReFactor = 1e9 yReDiv = yFull / yReFactor yReRound = math.floor(yReDiv + 0.5) if yReDiv == yReRound then -- change precision to billions of years if we're in that range precision = 0 yFactor = yReFactor yRound = yReRound else yReFactor = 1e6 yReDiv = yFull / yReFactor yReRound = math.floor(yReDiv + 0.5) if yReDiv == yReRound then -- change precision to millions of years if we're in that range precision = 3 yFactor = yReFactor yRound = yReRound end end end if not raw then if precision == 3 then suffix = i18n['datetime']['suffixes']['million-years'] elseif precision == 0 then suffix = i18n['datetime']['suffixes']['billion-years'] else yRound = yRound * yFactor if yRound == 1 then suffix = i18n['datetime']['suffixes']['year'] else suffix = i18n['datetime']['suffixes']['years'] end end else yRound = yRound * yFactor end end else yRound = y mayAddCalendar = true end if mayAddCalendar then calendarID = parseWikidataURL(datavalue['calendarmodel']) if calendarID and calendarID == aliasesQ.prolepticJulianCalendar then if not raw then if link then calendar = " ("..buildWikilink(i18n['datetime']['julian-calendar'], i18n['datetime']['julian'])..")" else calendar = " ("..i18n['datetime']['julian']..")" end else calendar = "/"..i18n['datetime']['julian'] end end end if not raw then local ce = nil if sign < 0 then ce = i18n['datetime']['BCE'] elseif precision <= 5 then ce = i18n['datetime']['CE'] end if ce then if link then ce = buildWikilink(i18n['datetime']['common-era'], ce) end suffix = suffix .. " " .. ce end value = tostring(yRound) if m then dateStr = self.langObj:formatDate("F", "1-"..m.."-1") if d then if self.mdyDate then dateStr = dateStr .. " " .. d .. "," else dateStr = d .. " " .. dateStr end end value = dateStr .. " " .. value end value = prefix .. value .. suffix .. calendar else value = padZeros(yRound * sign, 4) if m then value = value .. "-" .. padZeros(m, 2) if d then value = value .. "-" .. padZeros(d, 2) end end value = value .. calendar end return value elseif datatype == 'globecoordinate' then -- logic from https://github.com/DataValues/Geo (v4.0.1) local precision, unitsPerDegree, numDigits, strFormat, value, globe local latitude, latConv, latValue, latLink local longitude, lonConv, lonValue, lonLink local latDirection, latDirectionN, latDirectionS, latDirectionEN local lonDirection, lonDirectionE, lonDirectionW, lonDirectionEN local degSymbol, minSymbol, secSymbol, separator local latDegrees = nil local latMinutes = nil local latSeconds = nil local lonDegrees = nil local lonMinutes = nil local lonSeconds = nil local latDegSym = "" local latMinSym = "" local latSecSym = "" local lonDegSym = "" local lonMinSym = "" local lonSecSym = "" local latDirectionEN_N = "N" local latDirectionEN_S = "S" local lonDirectionEN_E = "E" local lonDirectionEN_W = "W" if not raw then latDirectionN = i18n['coord']['latitude-north'] latDirectionS = i18n['coord']['latitude-south'] lonDirectionE = i18n['coord']['longitude-east'] lonDirectionW = i18n['coord']['longitude-west'] degSymbol = i18n['coord']['degrees'] minSymbol = i18n['coord']['minutes'] secSymbol = i18n['coord']['seconds'] separator = i18n['coord']['separator'] else latDirectionN = latDirectionEN_N latDirectionS = latDirectionEN_S lonDirectionE = lonDirectionEN_E lonDirectionW = lonDirectionEN_W degSymbol = "/" minSymbol = "/" secSymbol = "/" separator = "/" end latitude = datavalue['latitude'] longitude = datavalue['longitude'] if latitude < 0 then latDirection = latDirectionS latDirectionEN = latDirectionEN_S latitude = math.abs(latitude) else latDirection = latDirectionN latDirectionEN = latDirectionEN_N end if longitude < 0 then lonDirection = lonDirectionW lonDirectionEN = lonDirectionEN_W longitude = math.abs(longitude) else lonDirection = lonDirectionE lonDirectionEN = lonDirectionEN_E end precision = datavalue['precision'] if not precision or precision <= 0 then precision = 1 / 3600 -- precision not set (correctly), set to arcsecond end -- remove insignificant detail latitude = math.floor(latitude / precision + 0.5) * precision longitude = math.floor(longitude / precision + 0.5) * precision if precision >= 1 - (1 / 60) and precision < 1 then precision = 1 elseif precision >= (1 / 60) - (1 / 3600) and precision < (1 / 60) then precision = 1 / 60 end if precision >= 1 then unitsPerDegree = 1 elseif precision >= (1 / 60) then unitsPerDegree = 60 else unitsPerDegree = 3600 end numDigits = math.ceil(-math.log10(unitsPerDegree * precision)) if numDigits <= 0 then numDigits = tonumber("0") -- for some reason, 'numDigits = 0' may actually store '-0', so parse from string instead end strFormat = "%." .. numDigits .. "f" if precision >= 1 then latDegrees = strFormat:format(latitude) lonDegrees = strFormat:format(longitude) if not raw then latDegSym = replaceDecimalMark(latDegrees) .. degSymbol lonDegSym = replaceDecimalMark(lonDegrees) .. degSymbol else latDegSym = latDegrees .. degSymbol lonDegSym = lonDegrees .. degSymbol end else latConv = math.floor(latitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits lonConv = math.floor(longitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits if precision >= (1 / 60) then latMinutes = latConv lonMinutes = lonConv else latSeconds = latConv lonSeconds = lonConv latMinutes = math.floor(latSeconds / 60) lonMinutes = math.floor(lonSeconds / 60) latSeconds = strFormat:format(latSeconds - (latMinutes * 60)) lonSeconds = strFormat:format(lonSeconds - (lonMinutes * 60)) if not raw then latSecSym = replaceDecimalMark(latSeconds) .. secSymbol lonSecSym = replaceDecimalMark(lonSeconds) .. secSymbol else latSecSym = latSeconds .. secSymbol lonSecSym = lonSeconds .. secSymbol end end latDegrees = math.floor(latMinutes / 60) lonDegrees = math.floor(lonMinutes / 60) latDegSym = latDegrees .. degSymbol lonDegSym = lonDegrees .. degSymbol latMinutes = latMinutes - (latDegrees * 60) lonMinutes = lonMinutes - (lonDegrees * 60) if precision >= (1 / 60) then latMinutes = strFormat:format(latMinutes) lonMinutes = strFormat:format(lonMinutes) if not raw then latMinSym = replaceDecimalMark(latMinutes) .. minSymbol lonMinSym = replaceDecimalMark(lonMinutes) .. minSymbol else latMinSym = latMinutes .. minSymbol lonMinSym = lonMinutes .. minSymbol end else latMinSym = latMinutes .. minSymbol lonMinSym = lonMinutes .. minSymbol end end latValue = latDegSym .. latMinSym .. latSecSym .. latDirection lonValue = lonDegSym .. lonMinSym .. lonSecSym .. lonDirection value = latValue .. separator .. lonValue if link then globe = parseWikidataURL(datavalue['globe']) if globe then globe = mw.wikibase.getLabelByLang(globe, "en"):lower() else globe = "earth" end latLink = table.concat({latDegrees, latMinutes, latSeconds}, "_") lonLink = table.concat({lonDegrees, lonMinutes, lonSeconds}, "_") value = "[https://geohack.toolforge.org/geohack.php?language="..self.langCode.."&params="..latLink.."_"..latDirectionEN.."_"..lonLink.."_"..lonDirectionEN.."_globe:"..globe.." "..value.."]" end return value elseif datatype == 'wikibase-entityid' then local label local itemID = datavalue['numeric-id'] if subtype == 'wikibase-item' then itemID = "Q" .. itemID elseif subtype == 'wikibase-property' then itemID = "P" .. itemID else return '<strong class="error">' .. errorText('unknown-data-type', subtype) .. '</strong>' end label = self:getLabel(itemID, raw, link, short) if label == "" then label = nil end return label else return '<strong class="error">' .. errorText('unknown-data-type', datatype) .. '</strong>' end elseif snak.snaktype == 'somevalue' and not noSpecial then if raw then return " " -- single space represents 'somevalue' else return i18n['values']['unknown'] end elseif snak.snaktype == 'novalue' and not noSpecial then if raw then return "" -- empty string represents 'novalue' else return i18n['values']['none'] end else return nil end end function Config:getSingleRawQualifier(claim, qualifierID) local qualifiers if claim.qualifiers then qualifiers = claim.qualifiers[qualifierID] end if qualifiers and qualifiers[1] then return self:getValue(qualifiers[1], true) -- raw = true else return nil end end function Config:snakEqualsValue(snak, value) local snakValue = self:getValue(snak, true) -- raw = true if snakValue and snak.snaktype == 'value' and snak.datavalue.type == 'wikibase-entityid' then value = value:upper() end return snakValue == value end function Config:setRank(rank) local rankPos if rank == p.flags.best then self.bestRank = true self.flagBest = true -- mark that 'best' flag was given return end if rank:sub(1,9) == p.flags.preferred then rankPos = 1 elseif rank:sub(1,6) == p.flags.normal then rankPos = 2 elseif rank:sub(1,10) == p.flags.deprecated then rankPos = 3 else return end -- one of the rank flags was given, check if another one was given before if not self.flagRank then self.ranks = {false, false, false} -- no other rank flag given before, so unset ranks self.bestRank = self.flagBest -- unsets bestRank only if 'best' flag was not given before self.flagRank = true -- mark that a rank flag was given end if rank:sub(-1) == "+" then for i = rankPos, 1, -1 do self.ranks[i] = true end elseif rank:sub(-1) == "-" then for i = rankPos, #self.ranks do self.ranks[i] = true end else self.ranks[rankPos] = true end end function Config:setPeriod(period) local periodPos if period == p.flags.future then periodPos = 1 elseif period == p.flags.current then periodPos = 2 elseif period == p.flags.former then periodPos = 3 else return end -- one of the period flags was given, check if another one was given before if not self.flagPeriod then self.periods = {false, false, false} -- no other period flag given before, so unset periods self.flagPeriod = true -- mark that a period flag was given end self.periods[periodPos] = true end function Config:qualifierMatches(claim, id, value) local qualifiers if claim.qualifiers then qualifiers = claim.qualifiers[id] end if qualifiers then for _, v in pairs(qualifiers) do if self:snakEqualsValue(v, value) then return true end end elseif value == "" then -- if the qualifier is not present then treat it the same as the special value 'novalue' return true end return false end function Config:rankMatches(rankPos) if self.bestRank then return (self.ranks[rankPos] and self.foundRank >= rankPos) else return self.ranks[rankPos] end end function Config:timeMatches(claim) local startTime = nil local startTimeY = nil local startTimeM = nil local startTimeD = nil local endTime = nil local endTimeY = nil local endTimeM = nil local endTimeD = nil if self.periods[1] and self.periods[2] and self.periods[3] then -- any time return true end startTime = self:getSingleRawQualifier(claim, aliasesP.startTime) if startTime and startTime ~= "" and startTime ~= " " then startTimeY, startTimeM, startTimeD = parseDate(startTime) end endTime = self:getSingleRawQualifier(claim, aliasesP.endTime) if endTime and endTime ~= "" and endTime ~= " " then endTimeY, endTimeM, endTimeD = parseDate(endTime) end if startTimeY ~= nil and endTimeY ~= nil and datePrecedesDate(endTimeY, endTimeM, endTimeD, startTimeY, startTimeM, startTimeD) then -- invalidate end time if it precedes start time endTimeY = nil endTimeM = nil endTimeD = nil end if self.periods[1] then -- future if startTimeY and datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD) then return true end end if self.periods[2] then -- current if (startTimeY == nil or not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD)) and (endTimeY == nil or datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD)) then return true end end if self.periods[3] then -- former if endTimeY and not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD) then return true end end return false end function Config:processFlag(flag) if not flag then return false end if flag == p.flags.linked then self.curState.linked = true return true elseif flag == p.flags.raw then self.curState.rawValue = true if self.curState == self.states[parameters.reference] then -- raw reference values end with periods and require a separator (other than none) self.separators["sep%r"][1] = {" "} end return true elseif flag == p.flags.short then self.curState.shortName = true return true elseif flag == p.flags.multilanguage then self.curState.anyLanguage = true return true elseif flag == p.flags.unit then self.curState.unitOnly = true return true elseif flag == p.flags.mdy then self.mdyDate = true return true elseif flag == p.flags.single then self.singleClaim = true return true elseif flag == p.flags.sourced then self.sourcedOnly = true return true elseif flag == p.flags.edit then self.editable = true return true elseif flag == p.flags.editAtEnd then self.editable = true self.editAtEnd = true return true elseif flag == p.flags.best or flag:match('^'..p.flags.preferred..'[+-]?$') or flag:match('^'..p.flags.normal..'[+-]?$') or flag:match('^'..p.flags.deprecated..'[+-]?$') then self:setRank(flag) return true elseif flag == p.flags.future or flag == p.flags.current or flag == p.flags.former then self:setPeriod(flag) return true elseif flag == "" then -- ignore empty flags and carry on return true else return false end end function Config:processFlagOrCommand(flag) local param = "" if not flag then return false end if flag == p.claimCommands.property or flag == p.claimCommands.properties then param = parameters.property elseif flag == p.claimCommands.qualifier or flag == p.claimCommands.qualifiers then self.states.qualifiersCount = self.states.qualifiersCount + 1 param = parameters.qualifier .. self.states.qualifiersCount self.separators["sep"..param] = {copyTable(defaultSeparators["sep%q\\d"])} elseif flag == p.claimCommands.reference or flag == p.claimCommands.references then param = parameters.reference else return self:processFlag(flag) end if self.states[param] then return false end -- create a new state for each command self.states[param] = State:new(self, param) -- use "%x" as the general parameter name self.states[param].parsedFormat = parseFormat(parameters.general) -- will be overwritten for param=="%p" -- set the separator self.states[param].separator = self.separators["sep"..param] -- will be nil for param=="%p", which will be set separately if flag == p.claimCommands.property or flag == p.claimCommands.qualifier or flag == p.claimCommands.reference then self.states[param].singleValue = true end self.curState = self.states[param] return true end function Config:processSeparators(args) local sep for i, v in pairs(self.separators) do if args[i] then sep = replaceSpecialChars(args[i]) if sep ~= "" then self.separators[i][1] = {sep} else self.separators[i][1] = nil end end end end function Config:setFormatAndSeparators(state, parsedFormat) state.parsedFormat = parsedFormat state.separator = self.separators["sep"] state.movSeparator = self.separators["sep"..parameters.separator] state.puncMark = self.separators["punc"] end -- determines if a claim has references by prefetching them from the claim using getReferences, -- which applies some filtering that determines if a reference is actually returned, -- and caches the references for later use function State:isSourced(claim) self.conf.prefetchedRefs = self:getReferences(claim) return (#self.conf.prefetchedRefs > 0) end function State:resetCaches() -- any prefetched references of the previous claim must not be used self.conf.prefetchedRefs = nil end function State:claimMatches(claim) local matches, rankPos -- first of all, reset any cached values used for the previous claim self:resetCaches() -- if a property value was given, check if it matches the claim's property value if self.conf.propertyValue then matches = self.conf:snakEqualsValue(claim.mainsnak, self.conf.propertyValue) else matches = true end -- if any qualifier values were given, check if each matches one of the claim's qualifier values for i, v in pairs(self.conf.qualifierIDsAndValues) do matches = (matches and self.conf:qualifierMatches(claim, i, v)) end -- check if the claim's rank and time period match rankPos = rankTable[claim.rank] or 4 matches = (matches and self.conf:rankMatches(rankPos) and self.conf:timeMatches(claim)) -- if only claims with references must be returned, check if this one has any if self.conf.sourcedOnly then matches = (matches and self:isSourced(claim)) -- prefetches and caches references end return matches, rankPos end function State:out() local result -- collection of arrays with value objects local valuesArray -- array with value objects local sep = nil -- value object local out = {} -- array with value objects local function walk(formatTable, result) local valuesArray = {} -- array with value objects for i, v in pairs(formatTable.req) do if not result[i] or not result[i][1] then -- we've got no result for a parameter that is required on this level, -- so skip this level (and its children) by returning an empty result return {} end end for _, v in ipairs(formatTable) do if v.param then valuesArray = mergeArrays(valuesArray, result[v.str]) elseif v.str ~= "" then valuesArray[#valuesArray + 1] = {v.str} end if v.child then valuesArray = mergeArrays(valuesArray, walk(v.child, result)) end end return valuesArray end -- iterate through the results from back to front, so that we know when to add separators for i = #self.results, 1, -1 do result = self.results[i] -- if there is already some output, then add the separators if #out > 0 then sep = self.separator[1] -- fixed separator result[parameters.separator] = {self.movSeparator[1]} -- movable separator else sep = nil result[parameters.separator] = {self.puncMark[1]} -- optional punctuation mark end valuesArray = walk(self.parsedFormat, result) if #valuesArray > 0 then if sep then valuesArray[#valuesArray + 1] = sep end out = mergeArrays(valuesArray, out) end end -- reset state before next iteration self.results = {} return out end -- level 1 hook function State:getProperty(claim) local value = {self:getValue(claim.mainsnak)} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end -- level 1 hook function State:getQualifiers(claim, param) local qualifiers if claim.qualifiers then qualifiers = claim.qualifiers[self.conf.qualifierIDs[param]] end if qualifiers then -- iterate through claim's qualifier statements to collect their values; -- return array with multiple value objects return self.conf.states[param]:iterate(qualifiers, {[parameters.general] = hookNames[parameters.qualifier.."\\d"][2], count = 1}) -- pass qualifier state with level 2 hook else return {} -- return empty array end end -- level 2 hook function State:getQualifier(snak) local value = {self:getValue(snak)} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end -- level 1 hook function State:getAllQualifiers(claim, param, result, hooks) local out = {} -- array with value objects local sep = self.conf.separators["sep"..parameters.qualifier][1] -- value object -- iterate through the output of the separate "qualifier(s)" commands for i = 1, self.conf.states.qualifiersCount do -- if a hook has not been called yet, call it now if not result[parameters.qualifier..i] then self:callHook(parameters.qualifier..i, hooks, claim, result) end -- if there is output for this particular "qualifier(s)" command, then add it if result[parameters.qualifier..i] and result[parameters.qualifier..i][1] then -- if there is already some output, then add the separator if #out > 0 and sep then out[#out + 1] = sep end out = mergeArrays(out, result[parameters.qualifier..i]) end end return out end -- level 1 hook function State:getReferences(claim) if self.conf.prefetchedRefs then -- return references that have been prefetched by isSourced return self.conf.prefetchedRefs end if claim.references then -- iterate through claim's reference statements to collect their values; -- return array with multiple value objects return self.conf.states[parameters.reference]:iterate(claim.references, {[parameters.general] = hookNames[parameters.reference][2], count = 1}) -- pass reference state with level 2 hook else return {} -- return empty array end end -- level 2 hook function State:getReference(statement) local key, citeWeb, citeQ, label local params = {} local citeParams = {['web'] = {}, ['q'] = {}} local citeMismatch = {} local useCite = nil local useParams = nil local value = "" local ref = {} local referenceEmpty = true -- will be set to false if at least one parameter is left unremoved local numAuthorParameters = 0 local numAuthorNameStringParameters = 0 local tempLink local additionalRefProperties = {} -- will hold properties of the reference which are not in statement.snaks, namely backup title from "subject named as" and URL from an external ID local wikidataPropertiesOfSource -- will contain "Wikidata property" properties of the item in stated in, if any local version = 4 -- increment this each time the below logic is changed to avoid conflict errors if statement.snaks then -- don't include "imported from", which is added by a bot if statement.snaks[aliasesP.importedFrom] then statement.snaks[aliasesP.importedFrom] = nil end -- don't include "Wikimedia import URL" if statement.snaks[aliasesP.wikimediaImportURL] then statement.snaks[aliasesP.wikimediaImportURL] = nil -- don't include "retrieved" if no "referenceURL" is present, -- as "retrieved" probably belongs to "Wikimedia import URL" if statement.snaks[aliasesP.retrieved] and not statement.snaks[aliasesP.referenceURL] then statement.snaks[aliasesP.retrieved] = nil end end -- don't include "inferred from", which is added by a bot if statement.snaks[aliasesP.inferredFrom] then statement.snaks[aliasesP.inferredFrom] = nil end -- don't include "type of reference" if statement.snaks[aliasesP.typeOfReference] then statement.snaks[aliasesP.typeOfReference] = nil end -- don't include "image" to prevent littering if statement.snaks[aliasesP.image] then statement.snaks[aliasesP.image] = nil end -- don't include "language" if it is equal to the local one if self:getReferenceDetail(statement.snaks, aliasesP.language) == self.conf.langName then statement.snaks[aliasesP.language] = nil end if statement.snaks[aliasesP.statedIn] and not statement.snaks[aliasesP.referenceURL] then -- "stated in" was given but "reference URL" was not. -- get "Wikidata property" properties from the item in "stated in" -- if any of the returned properties of the external-id datatype is in statement.snaks, generate a URL from it and use the URL in the reference -- find the "Wikidata property" properties in the item from "stated in" wikidataPropertiesOfSource = mw.text.split(p._properties{p.flags.raw, aliasesP.wikidataProperty, [p.args.eid] = self.conf:getValue(statement.snaks[aliasesP.statedIn][1], true, false)}, ", ", true) for i, wikidataPropertyOfSource in pairs(wikidataPropertiesOfSource) do if statement.snaks[wikidataPropertyOfSource] and statement.snaks[wikidataPropertyOfSource][1].datatype == "external-id" then tempLink = self.conf:getValue(statement.snaks[wikidataPropertyOfSource][1], false, true) -- not raw, linked if mw.ustring.match(tempLink, "^%[%Z- %Z+%]$") then -- getValue returned a URL. additionalRefProperties[aliasesP.referenceURL] = mw.ustring.gsub(tempLink, "^%[(%Z-) %Z+%]$", "%1") -- the URL is in wiki markup, so strip the square brackets and the display text statement.snaks[wikidataPropertyOfSource] = nil break end end end end -- don't include "subject named as", but use it as the title when "title" is not present but a URL is if statement.snaks[aliasesP.subjectNamedAs] then if not statement.snaks[aliasesP.title] and (statement.snaks[aliasesP.referenceURL] or additionalRefProperties[aliasesP.referenceURL]) then additionalRefProperties[aliasesP.title] = statement.snaks[aliasesP.subjectNamedAs][1].datavalue.value end statement.snaks[aliasesP.subjectNamedAs] = nil end -- retrieve all the parameters for i in pairs(statement.snaks) do label = "" -- multiple authors may be given if i == aliasesP.author or i == aliasesP.authorNameString then params[i] = self:getReferenceDetails(statement.snaks, i, false, self.linked, true) -- link = true/false, anyLang = true else params[i] = {self:getReferenceDetail(statement.snaks, i, false, (self.linked or (i == aliasesP.statedIn)) and (statement.snaks[i][1].datatype ~= 'url'), true)} -- link = true/false, anyLang = true end if #params[i] == 0 then params[i] = nil else referenceEmpty = false if statement.snaks[i][1].datatype == 'external-id' then key = "external-id" label = self.conf:getLabel(i) if label ~= "" then label = label .. " " end else key = i end -- add the parameter to each matching type of citation for j in pairs(citeParams) do -- do so if there was no mismatch with a previous parameter if not citeMismatch[j] then -- check if this parameter is not mismatching itself if i18n['cite'][j][key] then -- continue if an option is available in the corresponding cite template if i18n['cite'][j][key] ~= "" then -- handle non-author properties (and author properties ("author" and "author name string"), if they don't use the same template parameter) if (i ~= aliasesP.author and i ~= aliasesP.authorNameString) or (i18n['cite'][j][aliasesP.author] ~= i18n['cite'][j][aliasesP.authorNameString]) then citeParams[j][i18n['cite'][j][key]] = label .. params[i][1] -- to avoid problems with non-author multiple parameters (if existent), the following old code is retained for k=2, #params[i] do citeParams[j][i18n['cite'][j][key]..k] = label .. params[i][k] end -- handle "author" and "author name string" specially if they use the same template parameter elseif i == aliasesP.author or i == aliasesP.authorNameString then if params[aliasesP.author] ~= nil then numAuthorParameters = #params[aliasesP.author] else numAuthorParameters = 0 end if params[aliasesP.authorNameString] ~= nil then numAuthorNameStringParameters = #params[aliasesP.authorNameString] else numAuthorNameStringParameters = 0 end -- execute only if both "author" and "author name string" satisfy this condition: the property is both in params and in statement.snaks or it is neither in params nor in statement.snaks -- reason: parameters are added to params each iteration of the loop, not before the loop if ((statement.snaks[aliasesP.author] == nil) == (numAuthorParameters == 0)) and ((statement.snaks[aliasesP.authorNameString] == nil) == (numAuthorNameStringParameters == 0)) then for k=1, numAuthorParameters + numAuthorNameStringParameters do if k <= numAuthorParameters then -- now handling the authors from the "author" property citeParams[j][i18n['cite'][j][aliasesP.author]..k] = label .. params[aliasesP.author][k] else -- now handling the authors from "author name string" citeParams[j][i18n['cite'][j][aliasesP.authorNameString]..k] = label .. params[aliasesP.authorNameString][k - numAuthorParameters] end end end end end else citeMismatch[j] = true end end end end end -- use additional properties for i in pairs(additionalRefProperties) do for j in pairs(citeParams) do if not citeMismatch[j] and i18n["cite"][j][i] then citeParams[j][i18n["cite"][j][i]] = additionalRefProperties[i] else citeMismatch[j] = true end end end -- get title of general template for citing web references citeWeb = split(mw.wikibase.getSitelink(aliasesQ.citeWeb) or "", ":")[2] -- split off namespace from front -- get title of template that expands stated-in references into citations citeQ = split(mw.wikibase.getSitelink(aliasesQ.citeQ) or "", ":")[2] -- split off namespace from front -- (1) use the general template for citing web references if there is a match and if at least both "reference URL" and "title" are present if citeWeb and not citeMismatch['web'] and citeParams['web'][i18n['cite']['web'][aliasesP.referenceURL]] and citeParams['web'][i18n['cite']['web'][aliasesP.title]] then useCite = citeWeb useParams = citeParams['web'] -- (2) use the template that expands stated-in references into citations if there is a match and if at least "stated in" is present elseif citeQ and not citeMismatch['q'] and citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] then -- we need the raw "stated in" Q-identifier for the this template citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] = self:getReferenceDetail(statement.snaks, aliasesP.statedIn, true) -- raw = true useCite = citeQ useParams = citeParams['q'] end if useCite and useParams then -- if this module is being substituted then build a regular template call, otherwise expand the template if mw.isSubsting() then for i, v in pairs(useParams) do value = value .. "|" .. i .. "=" .. v end value = "{{" .. useCite .. value .. "}}" else value = mw.getCurrentFrame():expandTemplate{title=useCite, args=useParams} end -- (3) if the citation couldn't be displayed using Cite web or Cite Q, but has properties other than the removed ones, throw an error elseif not referenceEmpty then value = "<span style=\"color: crimson\">" .. errorText("malformed-reference") .. "</span>" end if value ~= "" then value = {value} -- create one value object if not self.rawValue then -- this should become a <ref> tag, so save the reference's hash for later value.refHash = "wikidata-" .. statement.hash .. "-v" .. (tonumber(i18n['cite']['version']) + version) end ref = {value} -- wrap the value object in an array end end return ref end -- gets a detail of one particular type for a reference function State:getReferenceDetail(snaks, dType, raw, link, anyLang) local switchLang = anyLang local value = nil if not snaks[dType] then return nil end -- if anyLang, first try the local language and otherwise any language repeat for _, v in ipairs(snaks[dType]) do value = self.conf:getValue(v, raw, link, false, anyLang and not switchLang, false, true) -- noSpecial = true if value then break end end if value or not anyLang then break end switchLang = not switchLang until anyLang and switchLang return value end -- gets the details of one particular type for a reference function State:getReferenceDetails(snaks, dType, raw, link, anyLang) local values = {} if not snaks[dType] then return {} end for _, v in ipairs(snaks[dType]) do -- if nil is returned then it will not be added to the table values[#values + 1] = self.conf:getValue(v, raw, link, false, anyLang, false, true) -- noSpecial = true end return values end -- level 1 hook function State:getAlias(object) local value = object.value local title = nil if value and self.linked then if self.conf.entityID:sub(1,1) == "Q" then title = mw.wikibase.getSitelink(self.conf.entityID) elseif self.conf.entityID:sub(1,1) == "P" then title = "d:Property:" .. self.conf.entityID end if title then value = buildWikilink(title, value) end end value = {value} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end -- level 1 hook function State:getBadge(value) value = self.conf:getLabel(value, self.rawValue, self.linked, self.shortName) if value == "" then value = nil end value = {value} -- create one value object if #value > 0 then return {value} -- wrap the value object in an array and return it else return {} -- return empty array if there was no value end end function State:callHook(param, hooks, statement, result) local valuesArray, refHash -- call a parameter's hook if it has been defined and if it has not been called before if not result[param] and hooks[param] then valuesArray = self[hooks[param]](self, statement, param, result, hooks) -- array with value objects -- add to the result if #valuesArray > 0 then result[param] = valuesArray result.count = result.count + 1 else result[param] = {} -- an empty array to indicate that we've tried this hook already return true -- miss == true end end return false end -- iterate through claims, claim's qualifiers or claim's references to collect values function State:iterate(statements, hooks, matchHook) matchHook = matchHook or alwaysTrue local matches = false local rankPos = nil local result, gotRequired for _, v in ipairs(statements) do -- rankPos will be nil for non-claim statements (e.g. qualifiers, references, etc.) matches, rankPos = matchHook(self, v) if matches then result = {count = 0} -- collection of arrays with value objects local function walk(formatTable) local miss for i2, v2 in pairs(formatTable.req) do -- call a hook, adding its return value to the result miss = self:callHook(i2, hooks, v, result) if miss then -- we miss a required value for this level, so return false return false end if result.count == hooks.count then -- we're done if all hooks have been called; -- returning at this point breaks the loop return true end end for _, v2 in ipairs(formatTable) do if result.count == hooks.count then -- we're done if all hooks have been called; -- returning at this point prevents further childs from being processed return true end if v2.child then walk(v2.child) end end return true end gotRequired = walk(self.parsedFormat) -- only append the result if we got values for all required parameters on the root level if gotRequired then -- if we have a rankPos (only with matchHook() for complete claims), then update the foundRank if rankPos and self.conf.foundRank > rankPos then self.conf.foundRank = rankPos end -- append the result self.results[#self.results + 1] = result -- break if we only need a single value if self.singleValue then break end end end end return self:out() end local function getEntityId(arg, eid, page, allowOmitPropPrefix) local id = nil local prop = nil if arg then if arg:sub(1,1) == ":" then page = arg eid = nil elseif arg:sub(1,1):upper() == "Q" or arg:sub(1,9):lower() == "property:" or allowOmitPropPrefix then eid = arg page = nil else prop = arg end end if eid then if eid:sub(1,9):lower() == "property:" then id = replaceAlias(mw.text.trim(eid:sub(10))) if id:sub(1,1):upper() ~= "P" then id = "" end else id = replaceAlias(eid) end elseif page then if page:sub(1,1) == ":" then page = mw.text.trim(page:sub(2)) end id = mw.wikibase.getEntityIdForTitle(page) or "" end if not id then id = mw.wikibase.getEntityIdForCurrentPage() or "" end id = id:upper() if not mw.wikibase.isValidEntityId(id) then id = "" end return id, prop end local function nextArg(args) local arg = args[args.pointer] if arg then args.pointer = args.pointer + 1 return mw.text.trim(arg) else return nil end end local function claimCommand(args, funcName) local cfg = Config:new() cfg:processFlagOrCommand(funcName) -- process first command (== function name) local lastArg, parsedFormat, formatParams, claims, value local hooks = {count = 0} -- set the date if given; -- must come BEFORE processing the flags if args[p.args.date] then cfg.atDate = {parseDate(args[p.args.date])} cfg.periods = {false, true, false} -- change default time constraint to 'current' end -- process flags and commands repeat lastArg = nextArg(args) until not cfg:processFlagOrCommand(lastArg) -- get the entity ID from either the positional argument, the eid argument or the page argument cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page]) if cfg.entityID == "" then return "" -- we cannot continue without a valid entity ID end cfg.entity = mw.wikibase.getEntity(cfg.entityID) if not cfg.propertyID then cfg.propertyID = nextArg(args) end cfg.propertyID = replaceAlias(cfg.propertyID) if not cfg.entity or not cfg.propertyID then return "" -- we cannot continue without an entity or a property ID end cfg.propertyID = cfg.propertyID:upper() if not cfg.entity.claims or not cfg.entity.claims[cfg.propertyID] then return "" -- there is no use to continue without any claims end claims = cfg.entity.claims[cfg.propertyID] if cfg.states.qualifiersCount > 0 then -- do further processing if "qualifier(s)" command was given if #args - args.pointer + 1 > cfg.states.qualifiersCount then -- claim ID or literal value has been given cfg.propertyValue = nextArg(args) end for i = 1, cfg.states.qualifiersCount do -- check if given qualifier ID is an alias and add it cfg.qualifierIDs[parameters.qualifier..i] = replaceAlias(nextArg(args) or ""):upper() end elseif cfg.states[parameters.reference] then -- do further processing if "reference(s)" command was given cfg.propertyValue = nextArg(args) end -- check for special property value 'somevalue' or 'novalue' if cfg.propertyValue then cfg.propertyValue = replaceSpecialChars(cfg.propertyValue) if cfg.propertyValue ~= "" and mw.text.trim(cfg.propertyValue) == "" then cfg.propertyValue = " " -- single space represents 'somevalue', whereas empty string represents 'novalue' else cfg.propertyValue = mw.text.trim(cfg.propertyValue) end end -- parse the desired format, or choose an appropriate format if args["format"] then parsedFormat, formatParams = parseFormat(args["format"]) elseif cfg.states.qualifiersCount > 0 then -- "qualifier(s)" command given if cfg.states[parameters.property] then -- "propert(y|ies)" command given parsedFormat, formatParams = parseFormat(formats.propertyWithQualifier) else parsedFormat, formatParams = parseFormat(formats.qualifier) end elseif cfg.states[parameters.property] then -- "propert(y|ies)" command given parsedFormat, formatParams = parseFormat(formats.property) else -- "reference(s)" command given parsedFormat, formatParams = parseFormat(formats.reference) end -- if a "qualifier(s)" command and no "propert(y|ies)" command has been given, make the movable separator a semicolon if cfg.states.qualifiersCount > 0 and not cfg.states[parameters.property] then cfg.separators["sep"..parameters.separator][1] = {";"} end -- if only "reference(s)" has been given, set the default separator to none (except when raw) if cfg.states[parameters.reference] and not cfg.states[parameters.property] and cfg.states.qualifiersCount == 0 and not cfg.states[parameters.reference].rawValue then cfg.separators["sep"][1] = nil end -- if exactly one "qualifier(s)" command has been given, make "sep%q" point to "sep%q1" to make them equivalent if cfg.states.qualifiersCount == 1 then cfg.separators["sep"..parameters.qualifier] = cfg.separators["sep"..parameters.qualifier.."1"] end -- process overridden separator values; -- must come AFTER tweaking the default separators cfg:processSeparators(args) -- define the hooks that should be called (getProperty, getQualifiers, getReferences); -- only define a hook if both its command ("propert(y|ies)", "reference(s)", "qualifier(s)") and its parameter ("%p", "%r", "%q1", "%q2", "%q3") have been given for i, v in pairs(cfg.states) do -- e.g. 'formatParams["%q1"] or formatParams["%q"]' to define hook even if "%q1" was not defined to be able to build a complete value for "%q" if formatParams[i] or formatParams[i:sub(1, 2)] then hooks[i] = getHookName(i, 1) hooks.count = hooks.count + 1 end end -- the "%q" parameter is not attached to a state, but is a collection of the results of multiple states (attached to "%q1", "%q2", "%q3", ...); -- so if this parameter is given then this hook must be defined separately, but only if at least one "qualifier(s)" command has been given if formatParams[parameters.qualifier] and cfg.states.qualifiersCount > 0 then hooks[parameters.qualifier] = getHookName(parameters.qualifier, 1) hooks.count = hooks.count + 1 end -- create a state for "properties" if it doesn't exist yet, which will be used as a base configuration for each claim iteration; -- must come AFTER defining the hooks if not cfg.states[parameters.property] then cfg.states[parameters.property] = State:new(cfg, parameters.property) -- if the "single" flag has been given then this state should be equivalent to "property" (singular) if cfg.singleClaim then cfg.states[parameters.property].singleValue = true end end -- if the "sourced" flag has been given then create a state for "reference" if it doesn't exist yet, using default values, -- which must exist in order to be able to determine if a claim has any references; -- must come AFTER defining the hooks if cfg.sourcedOnly and not cfg.states[parameters.reference] then cfg:processFlagOrCommand(p.claimCommands.reference) -- use singular "reference" to minimize overhead end -- set the parsed format and the separators (and optional punctuation mark); -- must come AFTER creating the additonal states cfg:setFormatAndSeparators(cfg.states[parameters.property], parsedFormat) -- process qualifier matching values, analogous to cfg.propertyValue for i, v in pairs(args) do i = tostring(i) if i:match('^[Pp]%d+$') or aliasesP[i] then v = replaceSpecialChars(v) -- check for special qualifier value 'somevalue' if v ~= "" and mw.text.trim(v) == "" then v = " " -- single space represents 'somevalue' end cfg.qualifierIDsAndValues[replaceAlias(i):upper()] = v end end -- first sort the claims on rank to pre-define the order of output (preferred first, then normal, then deprecated) claims = sortOnRank(claims) -- then iterate through the claims to collect values value = cfg:concatValues(cfg.states[parameters.property]:iterate(claims, hooks, State.claimMatches)) -- pass property state with level 1 hooks and matchHook -- if desired, add a clickable icon that may be used to edit the returned values on Wikidata if cfg.editable and value ~= "" then value = value .. cfg:getEditIcon() end return value end local function generalCommand(args, funcName) local cfg = Config:new() cfg.curState = State:new(cfg) local lastArg local value = nil repeat lastArg = nextArg(args) until not cfg:processFlag(lastArg) -- get the entity ID from either the positional argument, the eid argument or the page argument cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true) if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then return "" -- we cannot continue without an entity end -- serve according to the given command if funcName == p.generalCommands.label then value = cfg:getLabel(cfg.entityID, cfg.curState.rawValue, cfg.curState.linked, cfg.curState.shortName) elseif funcName == p.generalCommands.title then cfg.inSitelinks = true if cfg.entityID:sub(1,1) == "Q" then value = mw.wikibase.getSitelink(cfg.entityID) end if cfg.curState.linked and value then value = buildWikilink(value) end elseif funcName == p.generalCommands.description then value = mw.wikibase.getDescription(cfg.entityID) else local parsedFormat, formatParams local hooks = {count = 0} cfg.entity = mw.wikibase.getEntity(cfg.entityID) if funcName == p.generalCommands.alias or funcName == p.generalCommands.badge then cfg.curState.singleValue = true end if funcName == p.generalCommands.alias or funcName == p.generalCommands.aliases then if not cfg.entity.aliases or not cfg.entity.aliases[cfg.langCode] then return "" -- there is no use to continue without any aliasses end local aliases = cfg.entity.aliases[cfg.langCode] -- parse the desired format, or parse the default aliases format if args["format"] then parsedFormat, formatParams = parseFormat(args["format"]) else parsedFormat, formatParams = parseFormat(formats.alias) end -- process overridden separator values; -- must come AFTER tweaking the default separators cfg:processSeparators(args) -- define the hook that should be called (getAlias); -- only define the hook if the parameter ("%a") has been given if formatParams[parameters.alias] then hooks[parameters.alias] = getHookName(parameters.alias, 1) hooks.count = hooks.count + 1 end -- set the parsed format and the separators (and optional punctuation mark) cfg:setFormatAndSeparators(cfg.curState, parsedFormat) -- iterate to collect values value = cfg:concatValues(cfg.curState:iterate(aliases, hooks)) elseif funcName == p.generalCommands.badge or funcName == p.generalCommands.badges then if not cfg.entity.sitelinks or not cfg.entity.sitelinks[cfg.siteID] or not cfg.entity.sitelinks[cfg.siteID].badges then return "" -- there is no use to continue without any badges end local badges = cfg.entity.sitelinks[cfg.siteID].badges cfg.inSitelinks = true -- parse the desired format, or parse the default aliases format if args["format"] then parsedFormat, formatParams = parseFormat(args["format"]) else parsedFormat, formatParams = parseFormat(formats.badge) end -- process overridden separator values; -- must come AFTER tweaking the default separators cfg:processSeparators(args) -- define the hook that should be called (getBadge); -- only define the hook if the parameter ("%b") has been given if formatParams[parameters.badge] then hooks[parameters.badge] = getHookName(parameters.badge, 1) hooks.count = hooks.count + 1 end -- set the parsed format and the separators (and optional punctuation mark) cfg:setFormatAndSeparators(cfg.curState, parsedFormat) -- iterate to collect values value = cfg:concatValues(cfg.curState:iterate(badges, hooks)) end end value = value or "" if cfg.editable and value ~= "" then -- if desired, add a clickable icon that may be used to edit the returned value on Wikidata value = value .. cfg:getEditIcon() end return value end -- modules that include this module should call the functions with an underscore prepended, e.g.: p._property(args) local function establishCommands(commandList, commandFunc) for _, commandName in pairs(commandList) do local function wikitextWrapper(frame) local args = copyTable(frame.args) args.pointer = 1 loadI18n(aliasesP, frame) return commandFunc(args, commandName) end p[commandName] = wikitextWrapper local function luaWrapper(args) args = copyTable(args) args.pointer = 1 loadI18n(aliasesP) return commandFunc(args, commandName) end p["_" .. commandName] = luaWrapper end end establishCommands(p.claimCommands, claimCommand) establishCommands(p.generalCommands, generalCommand) -- main function that is supposed to be used by wrapper templates function p.main(frame) if not mw.wikibase then return nil end local f, args loadI18n(aliasesP, frame) -- get the parent frame to take the arguments that were passed to the wrapper template frame = frame:getParent() or frame if not frame.args[1] then throwError("no-function-specified") end f = mw.text.trim(frame.args[1]) if f == "main" then throwError("main-called-twice") end assert(p["_"..f], errorText('no-such-function', f)) -- copy arguments from immutable to mutable table args = copyTable(frame.args) -- remove the function name from the list table.remove(args, 1) return p["_"..f](args) end return p jnrxu2rnvu16g4zg8thr6m4pwwr3r9p Template:Reflist/doc 10 15806 116459 107508 2026-06-17T02:51:19Z Viyowoyero-vya-Malaŵi 11606 116459 wikitext text/x-wiki <noinclude>{{pp-protected|small=yes}}</noinclude>{{Documentation subpage}} {{High-use|all-pages=yes}} {{notice|<nowiki /> * This page gives technical details for the {{tl|Reflist}} template. For a full overview of this template in use, see [[Help:Footnotes]]. }} {{Transwiki guide |small=yes |text=See [[Template:Reflist/Transwiki guide|'''this information''']] on copying this template and modifying it for use on another wiki.}} {{Uses TemplateStyles|Template:Reflist/styles.css}} This [[Wikipedia:Citation templates|citation template]] provides formatting and organizational features for [[Help:Footnotes|footnotes]]. It encapsulates the {{tag|references|s}} tag used by the {{cite.php}} MediaWiki extension to show the list of references as defined by {{tag|ref|o}} tags. It adds support for sizing the column width, groups and {{ldr}}. ==Parameters== There are no ''required'' parameters; if none are supplied, a single-column list will be generated if there are fewer than 10 references in the list. If you have more than 10 references, it will use columns of 30em wide if your device allows this. Optional parameters are: * Unnamed parameter (must be the first one if used): the minimum width for each column of references, typically in [[em (typography)#CSS|em]]s. Syntax (for example) {{para||30em}} with no space (i.e. not {{para||30 em}}). Note that this replaces '''colwidth'''—see [[#Obsolete parameters|§&nbsp;Obsolete parameters]]. * '''refs''': used with {{ldr}}. * '''group''': identifies by name the subset of references to be rendered; the value should correspond to that used inline, e.g., {{tlx|Reflist|2=group=groupname}} renders all references with ''groupname'' as the group name ({{tag|ref|o|params=group="groupname"}}). There are five pre-defined group names that style the list differently. See [[#Grouped references|§ Grouped references]] below. * '''liststyle''': specifies the style used when the reference list is rendered. The default is a numbered list. When set, it will override the style set by the {{para|group}} parameter, without affecting group functionality. See [[#List styles|§ List styles]] below. {{anchor|Multiple uses}} ==Usage== {{markup|title=Using only footnote-style references |<nowiki>Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> ==References== {{Reflist}}</nowiki> |Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> {{fake heading|sub=3|References}} {{Reflist}} }} {{markup|title=Using only bibliographical style references (no direct references from the text) |<nowiki>Lorem ipsum. Lorem ipsum dolor sit amet. ==References== {{Refbegin}} * reference 1 * reference 2 {{Refend}}</nowiki> |Lorem ipsum. Lorem ipsum dolor sit amet. {{fake heading|sub=3|References}} {{Refbegin}} * reference 1 * reference 2 {{Refend}} }} {{markup|title=Using both footnote-style and bibliography-style references |<nowiki>Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> ==References== {{Reflist}} {{Refbegin}} * reference 1 * reference 2 {{Refend}}</nowiki> |Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> {{fake heading|sub=3|References}} {{Reflist}} {{Refbegin}} * reference 1 * reference 2 {{Refend}} }} ===Columns=== {{tlx|Reflist|30em}} (for example) instructs the browser to create as many columns as possible (of width at least 30&nbsp;[[Em (typography)|em]], in this example) given the width of the display window. ([http://www.w3.org/TR/CSS21/syndata.html#length-units Units supported are em, ex, in, cm, mm, pt, pc, px], but em is almost always used.) There must not be a space between the number and the unit. Percent is not supported. Choose a width appropriate to the typical width of the references: * Automatic columns (default when no width is specified): Where there are only a few {{fnote}}; see, e.g., {{oldid|Silver State Arena|530211388#References|Silver State Arena (23:05, 28 December 2012)}} * 30em: Where there are many footnotes plus a page-width Bibliography subsection: see, e.g., {{oldid|Ebola virus disease|819923970#References|Ebola virus disease (02:02, 12 January 2018)}} * 20em: Where {{sfnote}} are used; see, e.g., {{oldid|NBR 224 and 420 Classes|442508215#Notes|NBR 224 and 420 Classes (13:32, 1 August 2011)}}. ====Example==== {{markup|title=15em wide columns (vary width of display window to see change in number of columns) |<nowiki>Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> ==References== {{Reflist|15em}}</nowiki> |Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref> {{fake heading|sub=3|References}} {{Reflist|15em}}<!-- note 15em used here for illustration purposes because larger value won't columnize in the "renders as" part on many screens --> }} The syntax {{tlx|Reflist|2}} (for example), which specifies two columns of equal width ''regardless of the available display width'', is deprecated. When you use 1 the template gives you a single column while 2 will pretend you specified 30em. When using higher column counts, it will pretend you specified 25em. ===List-defined references=== {{Further|WP:LDR}} A list of references may be defined within {{tl|Reflist}} using the {{para|refs}} parameter, just like including named {{tag|ref|params=name="..."}} elements inside the {{tag|references}} container. ====Example==== {{markup |<nowiki>This is reference 1.<ref name="refname1" /> This is reference 2.<ref name="refname2" /> ==References== {{Reflist|refs= <ref name="refname1">content1</ref> <ref name="refname2">content2</ref> }}</nowiki> |This is reference 1.<ref name="refname1" group="decimal"/> This is reference 2.<ref name="refname2" group="decimal"/> {{fake heading|sub=3|References}} {{Reflist|group=decimal|refs= <ref name="refname1">content1</ref> <ref name="refname2">content2</ref> }} }} ===Grouped references=== {{further|WP:REFGROUP}} References can be grouped into separate sections (for explanatory notes, table references, and the like) via <code>group=</code>: :{{tag|ref|open|params=group="<var>groupname</var>"}} where <var>groupname</var> is (for example) <code>notes</code> or <code>sources</code>. The group name need not be enclosed in quotes; this differs from the footnote marker where quotes are required if the group name includes a space. Each group used in the article must have a matching reference list: :{{tlx|Reflist|2=group=<var>groupname</var>}} ====Predefined groups==== {{further|H:PREGROUP}} There are predefined group names that automatically set the labels in the footnote markers and the reference list to other styles. Thus, setting <code><nowiki>{{Reflist|group=lower-alpha}}</nowiki></code> will set the group to <code>lower-alpha</code> and will style the reference list with lower alpha characters. The matching footnote marker can be formed by {{tag|ref|params=group="lower-alpha"}}. This is made easier by a series of templates to set the group/label styles for the footnote marker and the reference list: {{#section:Help:Footnotes|pregrouptable}} ===List styles=== {{for|technical details|Help:Cite link labels}} As noted in [[#Predefined groups|§ Predefined groups]], there are predefined groups that automatically add list styling. Using the listed templates is more convenient than using {{para|liststyle}}. Reference lists are by default numbered lists. By using the {{para|liststyle}} parameter, you can control how the list is rendered. For example, using {{para|liststyle|upper-roman}} will result in references being labeled with [[Roman numerals]] instead of decimal numbers. The parameter accepts any valid CSS value defined for <code>list-style-type</code> as shown below. {{CSS list-style-type values}} It is possible to use {{para|liststyle}} so that the labels for the footnote marker and the reference list marker differ. This should be used with care as it can be confusing to readers. For example: {{markup |1=<nowiki><ref group="note">Reference</ref> {{Reflist|group=note|liststyle=lower-alpha}} </nowiki> |2=<ref group="note">Reference</ref> {{Reflist|group=note|liststyle=lower-alpha}} }} ===Interaction with images=== {{Reflist hide}} In the unusual case of an image being placed to the left of a reference list, layout problems may occur on some browsers. This can be prevented by using the columns feature. ==Technical details== ===Font size=== The font size should reduce to 90% for most browsers, but may appear to show at 100% for Internet Explorer and possibly other browsers.<ref group="general" name="fontsize" /> As of December 21, 2010, the standard {{tag|references|single}} tag has the same font styling. The smaller font may be disabled through {{myprefs|Gadgets|Disable smaller font sizes of elements such as Infoboxes, Navboxes and References lists}}. ===Browser support for columns=== {{CSS3 multiple column layout}} Multiple columns are generated by using [[Cascading Style Sheets|CSS3]], which is still in development; thus only browsers that properly support the multi-column property will show multiple columns with {{tl|Reflist}}.<ref group="general" name="stuffandnonsense" /><ref group="general" name="w3org1" /> These browsers '''support''' CSS3 columns: * [[Gecko (software)|Gecko]]-based browsers such as [[Mozilla Firefox]] * [[WebKit]]-based browsers such as [[Safari (web browser)|Safari]] and [[Google Chrome]] * [[Opera (web browser)|Opera]] from version 11.10 onward * [[Internet Explorer]] from version 10 onward These browsers do '''not support''' CSS3 columns: * Microsoft [[MSHTML]]-based browsers including Internet Explorer up to version 9<ref group="general" name="msdn" /> * [[Opera (web browser)|Opera]] through to version 11 ===Widows and orphans=== The use of columns can result in [[widows and orphans]], where a citation at the bottom of a column may be split to the top of the next column. [[MediaWiki:Common.css]] includes CSS rules to prevent list items from breaking between columns. Widows may still show in extreme circumstances, such as a reference list formatted in columns where only a single reference is defined. {{markup |<nowiki>Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet. ==References== {{Reflist|10em}}</nowiki> |Lorem ipsum.<ref>Source name, access date, etc.</ref> Lorem ipsum dolor sit amet. {{fake heading|sub=3|References}} {{Reflist|10em}} }} ===Customizing the view=== {{Further|Help:Reference display customization}} By editing your CSS, the personal appearance of the reference list can be customized. From [[Special:Preferences|Preferences]], select the Appearance tab, then on the selected skin select Custom CSS. After editing and saving, follow the instructions at the top of the page to purge. See [[Wikipedia:Skin#Customisation (advanced users)]] for more help. '''Font size''' The font size for all reference lists defaults to 90% of the standard size. To change it, add: <syntaxhighlight lang="css"> ol.references, .mw-parser-output div.reflist, .mw-parser-output div.refbegin { font-size: 90%; } </syntaxhighlight> Change 90% to the desired size. '''Columns''' To disable columns, add: <syntaxhighlight lang="css"> .references-column-width { column-width: auto !important; } </syntaxhighlight> '''Column dividers''' To add dividers (rules) between columns, add: <syntaxhighlight lang="css"> .references-column-width { column-rule: 1px solid #aaa; } </syntaxhighlight> You can alter the appearance of the dividers by changing the values. ==Perennial suggestions== '''Collapsing and scrolling''' There have been a number of requests to add functionality for a collapsible or [[WP:SCROLLING|scrolling]] reference list. These requests have not been fulfilled due to issues with readability, accessibility, and printing. The applicable guidelines are at [[MOS:SCROLL]]. Links between the inline cite and the reference list do not work when the reference list is enclosed in a collapsed box. To display the reference list in a scrollbox or collapsed per user, see [[Help:Reference display customization]]. For discussion on previous attempts to do this with a template, see the discussions for [[Wikipedia:Templates for deletion/Log/2007 June 11#Template:Scrollref|Scrollref]] and [[Wikipedia:Templates for discussion/Log/2010 May 26#Template:Refbox|Refbox]]. '''Including the section title''' There have been suggestions to include section header markup such as <code>==References==</code>. This is inadvisable because: * There is no standard section name {{crossreference|(see {{section link|WP:Manual of Style/Layout|Notes and references}})}}. * When transcluded, the article will have an edit link that will confusingly open the template for editing. ==Obsolete parameters== These parameters are no longer in use: * '''colwidth''': Same as specifying a column-width for the first unnamed parameter. Replaced by width as unnamed first parameter. Articles using unsupported parameters are tracked in {{clc|Pages using reflist with unknown parameters}}. ==Template data== {{TemplateData header}} <templatedata> { "description": "This template displays the list of footnotes at the end of an article and provides additional formatting and organizing options. After hitting \"Apply changes\" and turning back to VE read mode, you will not see the references list. After hitting \"Publish page\" and turning back to normal read mode the reference list will reappear with the changes applied, see T53146.", "params": { "1": { "label": "Columns / Column width", "type": "string", "required": false, "description": "Two modes supported. First mode (deprecated): integer number of fixed columns into which the reference list is to be rendered. Second mode: typographic unit of measurement such as 'em', specifying the width for the reference list columns, e.g. '33em'; spaced '33&nbsp;em' will not be recognized", "default": " 1 if < 11 references; otherwise 30em", "aliases": [ "colwidth" ] }, "liststyle": { "label": "Liststyle", "type": "string", "required": false, "description": "Specifies the style used when the reference list is enumerated; accepts any valid CSS value defined for list-style-type", "default": "decimal", "suggestedvalues": [ "none", "disc", "circle", "square", "decimal", "decimal-leading-zero", "lower-roman", "upper-roman", "lower-alpha", "upper-alpha", "lower-greek", "armenian", "georgian" ] }, "group": { "label": "Group", "type": "string", "required": false, "description": "Group is an identifier which restricts the references that are shown. Without this parameter, this template only shows references with no group identifier. With a group identifier specified, only references with a matching group identifier are handled. The rest are left alone." }, "refs": { "label": "List of references", "type": "string", "required": false, "description": "Provides a space to define named references for use in the article. References defined in this space are not shown unless used somewhere in the article." } } } </templatedata> ==Limitations== Do not use {{tl|Reflist}} or other templates or modules that use '''<nowiki>{{#tag:references}}</nowiki>''' in numbered or unnumbered lists if the list is inside an [[Span and div|HTML div tag]]. See [[Template talk:Reflist#Limitations|the talk page]] ([https://en.wikipedia.org/w/index.php?title=Template_talk:Reflist&oldid=942930696 permalink]) for examples and details. :{{no mark}} {{em dash}} <nowiki>:{{Reflist}}</nowiki> :{{no mark}} {{em dash}} <nowiki>*{{Reflist}}</nowiki> :{{no mark}} {{em dash}} <nowiki>#{{Reflist}}</nowiki> :{{yes check}} {{em dash}} <nowiki>{{Reflist}}</nowiki> ==See also== * [[Wikipedia:Citing sources]]&nbsp;– style guide for the citation of sources * [[Wikipedia:Citation templates]]&nbsp;– templates for use with references * [[Help:Shortened footnotes]] * {{tl|Notelist}} and {{tl|efn}}&nbsp;– templates for use with footnotes * {{tl|Refbegin}} and {{tl|Refend}}&nbsp;– format reference lists * {{phab|T53260}} – Support editing {{tag|references|s}} tags to set multi-column display on/off *[[Template:Reflist2]] '''Variants''' * {{tl|Template reference list}}&nbsp;– version of reflist for use in templates * {{tl|Reflist-talk}} and {{tl|Sources-talk}}&nbsp;– for use in talk page sections and other non-mainspace pages ==References== {{Reflist|group=general|refs= <ref group="general" name="fontsize">See [[User:Edokter/fonttest]] for a comparison of font sizes for various browsers; see [https://en.wikipedia.org/w/index.php?title=Special%3ASearch&redirs=1&search=fonttest+prefix%3AMediaWiki+talk%3ACommon.css%2F&fulltext=Search&ns0=1 previous discussions] on changing the font size to resolve the IE issue.</ref> <ref group="general" name="stuffandnonsense">{{cite web |accessdate=November 24, 2006 |date=December 30, 2005 |title=CSS3 Multi-Column Thriller |url=http://www.stuffandnonsense.co.uk/archives/css3_multi-column_thriller.html}}</ref> <ref group="general" name="w3org1">{{cite web |url=http://www.w3.org/TR/css3-multicol/ |title=CSS3 module: Multi-column layout |publisher=[[World Wide Web Consortium|W3C]] |date=December 15, 2005 |accessdate=November 24, 2006}}</ref> <ref group="general" name="msdn">{{cite web |url=https://docs.microsoft.com/en-us/previous-versions/cc351024(v=vs.85)#multi-column-layout |title=CSS Compatibility and Internet Explorer: Multi-column Layout |work=[[Microsoft Docs]] |publisher=[[Microsoft Developer Network]] |access-date=2021-03-19}}</ref> }} {{Wikipedia referencing}} {{Wikipedia templates}} {{Wikipedia technical help}} <includeonly>{{Sandbox other|| [[Category:Footnote templates]] [[Category:Reference list templates]] }}</includeonly> 1hy6j9e90ssvkela0o12l9s0k2d320b MediaWiki:Gadget-ReferenceTooltips.js 8 46277 116442 110395 2026-06-16T20:20:45Z Johannnes89 6189 updated per enwiki 116442 javascript text/javascript // See [[mw:Reference Tooltips]] // Source https://en.wikipedia.org/wiki/MediaWiki:Gadget-ReferenceTooltips.js /*eslint space-in-parens: ["error", "always"], array-bracket-spacing: ["error", "always"]*/ ( function () { // If you're loading the script from another wiki and want to set your settings, do that in `window` // properties with `rt_` prefix, e.g. // window.rt_REF_LINK_SELECTOR = '...'; // They will be used instead of enwiki detaults. var REF_LINK_SELECTOR = window.rt_REF_LINK_SELECTOR || '.reference, a[href^="#CITEREF"]', COMMENTED_TEXT_CLASS = window.rt_COMMENTED_TEXT_CLASS || 'rt-commentedText', COMMENTED_TEXT_SELECTOR = ( window.rt_COMMENTED_TEXT_SELECTOR || ( COMMENTED_TEXT_CLASS ? '.' + COMMENTED_TEXT_CLASS + ', ' : '' ) + 'abbr[title]' ); if ( mw.messages.get( 'rt-settings' ) === null ) { mw.messages.set( { 'rt-settings': 'Reference Tooltips settings', 'rt-enable-footer': 'Enable Reference Tooltips', 'rt-settings-title': 'Reference Tooltips', 'rt-save': 'Save', 'rt-enable': 'Enable Reference Tooltips', 'rt-activationMethod': 'Show a tooltip when I\'m', 'rt-hovering': 'hovering a reference', 'rt-clicking': 'clicking a reference', 'rt-delay': 'Delay before the tooltip appears (in milliseconds)', 'rt-tooltipsForComments': 'Show the tooltip over <span title="Tooltip example" class="' + ( COMMENTED_TEXT_CLASS || 'rt-commentedText' ) + '" style="border-bottom: 1px dotted; cursor: help;">text with a dotted underline</span> in Reference Tooltips style (allows to see such tooltips on devices with no mouse support)', 'rt-disabledNote': 'You can re-enable Reference Tooltips using a link in the footer of the page.', 'rt-done': 'Done', 'rt-enabled': 'Reference Tooltips are enabled' } ); } // "Global" variables var SECONDS_IN_A_DAY = 60 * 60 * 24, CLASSES = { FADE_IN_DOWN: 'rt-fade-in-down', FADE_IN_UP: 'rt-fade-in-up', FADE_OUT_DOWN: 'rt-fade-out-down', FADE_OUT_UP: 'rt-fade-out-up' }, IS_TOUCHSCREEN = 'ontouchstart' in document.documentElement, // Quite a rough check for mobile browsers, a mix of what is advised at // https://stackoverflow.com/a/24600597 (sends to // https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent) // and https://stackoverflow.com/a/14301832 IS_MOBILE = /Mobi|Android/i.test( navigator.userAgent ) || typeof window.orientation !== 'undefined', CLIENT_NAME = $.client.profile().name, settingsString, settings, enabled, delay, activatedByClick, tooltipsForComments, cursorWaitCss, windowManager, $teleportTarget, $body = $( document.body ), $window = $( window ), $overlay = $( '<div>' ) .addClass( 'rt-overlay' ) .appendTo( $body ); // Can't use before https://phabricator.wikimedia.org/T369880 is resolved // mw.loader.using( 'mediawiki.page.ready' ).then( function ( require ) { // $teleportTarget = $( require( 'mediawiki.page.ready' ).teleportTarget ); // $overlay.appendTo( $teleportTarget ); // } ); function rt( $content ) { // Popups gadget if ( window.pg ) { return; } var teSelector, settingsDialogOpening = false; function setSettingsCookie() { mw.cookie.set( 'RTsettings', ( Number( enabled ) + '|' + delay + '|' + Number( activatedByClick ) + '|' + Number( tooltipsForComments ) ), { path: '/', expires: 90 * SECONDS_IN_A_DAY, prefix: '' } ); } function enableRt() { enabled = true; setSettingsCookie(); $( '.rt-enableItem' ).remove(); rt( $content ); mw.notify( mw.msg( 'rt-enabled' ) ); } function disableRt() { $content.find( teSelector ).removeClass( 'rt-commentedText' ).off( '.rt' ); $body.off( '.rt' ); $window.off( '.rt' ); } function addEnableLink() { // #footer-places – Vector // #f-list – Timeless, Monobook, Modern // parent of #footer li – Cologne Blue var $footer = $( '#footer-places, #f-list' ); if ( !$footer.length ) { $footer = $( '#footer li' ).parent(); } if ( !$footer.find( '.rt-enableItem' ).length ) { $footer.append( $( '<li>' ) .addClass( 'rt-enableItem' ) .append( $( '<a>' ) .text( mw.msg( 'rt-enable-footer' ) ) .attr( 'href', '#' ) .click( function ( e ) { e.preventDefault(); enableRt(); } ) ) ); } } function TooltippedElement( $element ) { var events, te = this; function onStartEvent( e ) { var showRefArgs; if ( activatedByClick && te.type !== 'commentedText' && e.type !== 'contextmenu' ) { e.preventDefault(); } if ( !te.noRef ) { showRefArgs = [ $( this ) ]; if ( te.type !== 'supRef' ) { showRefArgs.push( e.pageX, e.pageY ); } te.showRef.apply( te, showRefArgs ); } } function onEndEvent() { if ( !te.noRef ) { te.hideRef(); } } if ( !$element ) { return; } // TooltippedElement.$element and TooltippedElement.$originalElement will be different when // the first is changed after its cloned version is hovered in a tooltip this.$element = $element; this.$originalElement = $element; if ( this.$element.is( REF_LINK_SELECTOR ) ) { if ( this.$element.prop( 'tagName' ) === 'SUP' ) { this.type = 'supRef'; } else { this.type = 'harvardRef'; } } else { this.type = 'commentedText'; this.comment = this.$element.attr( 'title' ); if ( !this.comment ) { return; } this.$element.addClass( 'rt-commentedText' ); } if ( activatedByClick ) { events = { 'click.rt': onStartEvent }; // Adds an ability to see tooltips for links if ( this.type === 'commentedText' && ( this.$element.closest( 'a' ).length || this.$element.has( 'a' ).length ) ) { events[ 'contextmenu.rt' ] = onStartEvent; } } else { events = { 'mouseenter.rt': onStartEvent, 'mouseleave.rt': onEndEvent }; } this.$element.on( events ); this.hideRef = function ( immediately ) { clearTimeout( te.showTimer ); if ( this.type === 'commentedText' ) { this.$element.attr( 'title', this.comment ); } if ( this.tooltip && this.tooltip.isPresent ) { if ( activatedByClick || immediately ) { this.tooltip.hide(); } else { this.hideTimer = setTimeout( function () { te.tooltip.hide(); }, 200 ); } } else if ( this.$ref && this.$ref.hasClass( 'rt-target' ) ) { this.$ref.removeClass( 'rt-target' ); if ( activatedByClick ) { $body.off( 'click.rt touchstart.rt', this.onBodyClick ); } } }; this.showRef = function ( $element, ePageX, ePageY ) { // Popups gadget if ( window.pg ) { disableRt(); return; } if ( this.tooltip && !this.tooltip.$content.length ) { return; } var tooltipInitiallyPresent = this.tooltip && this.tooltip.isPresent; function reallyShow() { var viewportTop, refOffsetTop, teHref; if ( !te.$ref && !te.comment ) { teHref = te.type === 'supRef' ? te.$element.find( 'a' ).attr( 'href' ) : te.$element.attr( 'href' ); // harvardRef te.$ref = teHref && $( '#' + $.escapeSelector( teHref.slice( 1 ) ) ); if ( !te.$ref || !te.$ref.length || !te.$ref.text() ) { te.noRef = true; return; } } if ( !tooltipInitiallyPresent && !te.comment ) { viewportTop = $window.scrollTop(); refOffsetTop = te.$ref.offset().top; if ( !activatedByClick && viewportTop < refOffsetTop && viewportTop + $window.height() > refOffsetTop + te.$ref.height() && // There can be gadgets/scripts that make references horizontally scrollable. $window.width() > te.$ref.offset().left + te.$ref.width() ) { // Highlight the reference itself te.$ref.addClass( 'rt-target' ); return; } } if ( !te.tooltip ) { te.tooltip = new Tooltip( te ); if ( !te.tooltip.$content.length ) { return; } } // If this tooltip is called from inside another tooltip. We can't define it // in the constructor since a ref can be cloned but have the same Tooltip object; // so, Tooltip.parent is a floating value. te.tooltip.parent = te.$element.closest( '.rt-tooltip' ).data( 'tooltip' ); if ( te.tooltip.parent && te.tooltip.parent.disappearing ) { return; } te.tooltip.show(); if ( tooltipInitiallyPresent ) { if ( te.tooltip.$element.hasClass( 'rt-tooltip-above' ) ) { te.tooltip.$element.addClass( CLASSES.FADE_IN_DOWN ); } else { te.tooltip.$element.addClass( CLASSES.FADE_IN_UP ); } return; } te.tooltip.calculatePosition( ePageX, ePageY ); $window.on( 'resize.rt', te.onWindowResize ); } // We redefine this.$element here because e.target can be a reference link inside // a reference tooltip, not a link that was initially assigned to this.$element this.$element = $element; if ( this.type === 'commentedText' ) { this.$element.attr( 'title', '' ); } if ( activatedByClick ) { if ( tooltipInitiallyPresent || ( this.$ref && this.$ref.hasClass( 'rt-target' ) ) ) { return; } else { setTimeout( function () { $body.on( 'click.rt touchstart.rt', te.onBodyClick ); }, 0 ); } } if ( activatedByClick || tooltipInitiallyPresent ) { reallyShow(); } else { this.showTimer = setTimeout( reallyShow, delay ); } }; this.onBodyClick = function ( e ) { if ( !te.tooltip && !( te.$ref && te.$ref.hasClass( 'rt-target' ) ) ) { return; } var $current = $( e.target ); function contextMatchesParameter( parameter ) { return this === parameter; } // The last condition is used to determine cases when a clicked tooltip is the current // element's tooltip or one of its descendants while ( $current.length && ( !$current.hasClass( 'rt-tooltip' ) || !$current.data( 'tooltip' ) || !$current.data( 'tooltip' ).upToTopParent( contextMatchesParameter, [ te.tooltip ], true ) ) ) { $current = $current.parent(); } if ( !$current.length ) { te.hideRef(); } }; this.onWindowResize = function () { te.tooltip.calculatePosition(); }; } function Tooltip( te ) { function openSettingsDialog() { var settingsDialog, settingsWindow; if ( cursorWaitCss ) { cursorWaitCss.disabled = true; } function SettingsDialog() { SettingsDialog.parent.call( this ); } OO.inheritClass( SettingsDialog, OO.ui.ProcessDialog ); SettingsDialog.static.name = 'settingsDialog'; SettingsDialog.static.title = mw.msg( 'rt-settings-title' ); SettingsDialog.static.actions = [ { modes: 'main', action: 'save', label: mw.msg( 'rt-save' ), flags: [ 'primary', 'progressive' ] }, { modes: 'main', flags: [ 'safe', 'close' ] }, { modes: 'disabled', action: 'deactivated', label: mw.msg( 'rt-done' ), flags: [ 'primary', 'progressive' ] } ]; SettingsDialog.prototype.initialize = function () { var dialog = this; SettingsDialog.parent.prototype.initialize.apply( this, arguments ); this.enableCheckbox = new OO.ui.CheckboxInputWidget( { selected: true } ); this.enableCheckbox.on( 'change', function ( selected ) { dialog.activationMethodSelect.setDisabled( !selected ); dialog.delayInput.setDisabled( !selected || dialog.clickOption.isSelected() ); dialog.tooltipsForCommentsCheckbox.setDisabled( !selected ); } ); this.enableField = new OO.ui.FieldLayout( this.enableCheckbox, { label: mw.msg( 'rt-enable' ), align: 'inline', classes: [ 'rt-enableField' ] } ); this.hoverOption = new OO.ui.RadioOptionWidget( { label: mw.msg( 'rt-hovering' ) } ); this.clickOption = new OO.ui.RadioOptionWidget( { label: mw.msg( 'rt-clicking' ) } ); this.activationMethodSelect = new OO.ui.RadioSelectWidget( { items: [ this.hoverOption, this.clickOption ] } ); this.activationMethodSelect.selectItem( activatedByClick ? this.clickOption : this.hoverOption ); this.activationMethodSelect.on( 'choose', function ( item ) { dialog.delayInput.setDisabled( item === dialog.clickOption ); } ); this.activationMethodField = new OO.ui.FieldLayout( this.activationMethodSelect, { label: mw.msg( 'rt-activationMethod' ), align: 'top' } ); this.delayInput = new OO.ui.NumberInputWidget( { input: { value: delay }, step: 50, min: 0, max: 5000, disabled: activatedByClick, classes: [ 'rt-numberInput' ] } ); this.delayField = new OO.ui.FieldLayout( this.delayInput, { label: mw.msg( 'rt-delay' ), align: 'top' } ); this.tooltipsForCommentsCheckbox = new OO.ui.CheckboxInputWidget( { selected: tooltipsForComments } ); this.tooltipsForCommentsField = new OO.ui.FieldLayout( this.tooltipsForCommentsCheckbox, { label: new OO.ui.HtmlSnippet( mw.msg( 'rt-tooltipsForComments' ) ), align: 'inline', classes: [ 'rt-tooltipsForCommentsField' ] } ); new TooltippedElement( this.tooltipsForCommentsField.$element.find( '.' + ( COMMENTED_TEXT_CLASS || 'rt-commentedText' ) ) ); this.fieldset = new OO.ui.FieldsetLayout(); this.fieldset.addItems( [ this.enableField, this.activationMethodField, this.delayField, this.tooltipsForCommentsField ] ); this.panelSettings = new OO.ui.PanelLayout( { padded: true, expanded: false } ); this.panelSettings.$element.append( this.fieldset.$element ); this.panelDisabled = new OO.ui.PanelLayout( { padded: true, expanded: false } ); this.panelDisabled.$element.append( $( '<table>' ) .addClass( 'rt-disabledHelp' ) .append( $( '<tr>' ).append( $( '<td>' ).append( $( '<img>' ).attr( 'src', 'https://upload.wikimedia.org/wikipedia/commons/c/c0/MediaWiki_footer_link_ltr.svg' ) ), $( '<td>' ) .addClass( 'rt-disabledNote' ) .text( mw.msg( 'rt-disabledNote' ) ) ) ) ); this.stackLayout = new OO.ui.StackLayout( { items: [ this.panelSettings, this.panelDisabled ] } ); this.$body.append( this.stackLayout.$element ); }; SettingsDialog.prototype.getSetupProcess = function ( data ) { return SettingsDialog.parent.prototype.getSetupProcess.call( this, data ) .next( function () { this.stackLayout.setItem( this.panelSettings ); this.actions.setMode( 'main' ); }, this ); }; SettingsDialog.prototype.getActionProcess = function ( action ) { var dialog = this; if ( action === 'save' ) { return new OO.ui.Process( function () { var newDelay = Number( dialog.delayInput.getValue() ); enabled = dialog.enableCheckbox.isSelected(); if ( newDelay >= 0 && newDelay <= 5000 ) { delay = newDelay; } activatedByClick = dialog.clickOption.isSelected(); tooltipsForComments = dialog.tooltipsForCommentsCheckbox.isSelected(); setSettingsCookie(); if ( enabled ) { dialog.close(); disableRt(); rt( $content ); } else { dialog.actions.setMode( 'disabled' ); dialog.stackLayout.setItem( dialog.panelDisabled ); disableRt(); addEnableLink(); } } ); } else if ( action === 'deactivated' ) { dialog.close(); } return SettingsDialog.parent.prototype.getActionProcess.call( this, action ); }; SettingsDialog.prototype.getBodyHeight = function () { return this.stackLayout.getCurrentItem().$element.outerHeight( true ); }; tooltip.upToTopParent( function adjustRightAndHide() { if ( this.isPresent ) { if ( this.$element[ 0 ].style.right ) { this.$element.css( 'right', '+=' + ( window.innerWidth - $window.width() ) ); } this.te.hideRef( true ); } } ); if ( !windowManager ) { windowManager = new OO.ui.WindowManager(); $body.append( windowManager.$element ); } settingsDialog = new SettingsDialog(); windowManager.addWindows( [ settingsDialog ] ); settingsWindow = windowManager.openWindow( settingsDialog ); settingsWindow.opened.then( function () { settingsDialogOpening = false; } ); settingsWindow.closed.then( function () { windowManager.clearWindows(); } ); } var tooltip = this; // This variable can change: one tooltip can be called from a harvard-style reference link // that is put into different tooltips this.te = te; switch ( this.te.type ) { case 'supRef': this.id = 'rt-' + this.te.$originalElement.attr( 'id' ); this.$content = this.te.$ref .contents() .filter( function ( i ) { var $this = $( this ); if ( $this.hasClass( 'mw-subreference-list' ) ) { return false; } return ( this.nodeType === Node.TEXT_NODE || !( // `a[href^="#cite_ref-"]` is for Wiktionary and possibly other // sites (not English Wikipedia) where the output of the Cite // extension is slightly different $this.is( '.mw-cite-backlink, a[href^="#cite_ref-"]' ) || ( i === 0 && // Template:Cnote, Template:Note ( $this.is( 'b' ) || // Template:Note_label $this.is( 'a' ) && $this.attr( 'href' ).indexOf( '#ref' ) === 0 ) ) ) ); } ) .clone( true ); const $ol = this.te.$ref.closest( 'ol' ); if ( $ol.hasClass( 'mw-subreference-list' ) ) { this.$content = $( '<div>' ).append( $ol.siblings( '.reference-text' ).clone( true ) .css( { display: 'block', 'margin-bottom': '0.7em' } ), this.$content ); } break; case 'harvardRef': this.id = 'rt-' + this.te.$originalElement.closest( 'li' ).attr( 'id' ); this.$content = this.te.$ref .clone( true ) .removeAttr( 'id' ); break; case 'commentedText': this.id = 'rt-' + String( Math.random() ).slice( 2 ); this.$content = $( document.createTextNode( this.te.comment ) ); break; } if ( !this.$content.length ) { return; } this.isInsideWindow = Boolean( this.te.$element.closest( '.oo-ui-window' ).length ); this.$element = $( '<div>' ) .addClass( 'rt-tooltip' ) .attr( 'id', this.id ) .attr( 'role', 'tooltip' ) .data( 'tooltip', this ); var $hoverArea = $( '<div>' ) .addClass( 'rt-hoverArea' ) .appendTo( this.$element ); var $scroll = $( '<div>' ) .addClass( 'rt-scroll' ) .appendTo( $hoverArea ); this.$content = this.$content .wrapAll( '<div>' ) .parent() .addClass( 'rt-content' ) .addClass( 'mw-parser-output' ) .appendTo( $scroll ); if ( !activatedByClick ) { this.$element .on( 'mouseenter linkPopupHover', function ( e ) { if ( !tooltip.disappearing || e.type === 'linkPopupHover' ) { tooltip.upToTopParent( function () { this.show(); } ); } } ) .on( 'mouseleave', function ( e ) { // https://stackoverflow.com/q/47649442 workaround. Relying on relatedTarget // alone has pitfalls: when alt-tabbing, relatedTarget is empty too if ( CLIENT_NAME !== 'chrome' || ( !e.originalEvent || e.originalEvent.relatedTarget !== null || !tooltip.clickedTime || $.now() - tooltip.clickedTime > 50 ) ) { tooltip.upToTopParent( function () { this.te.hideRef(); } ); } } ) .click( function () { tooltip.clickedTime = $.now(); } ); } if ( !this.isInsideWindow ) { $( '<a>' ) .addClass( 'rt-settingsLink' ) .attr( 'role', 'button' ) .attr( 'href', '#' ) .attr( 'title', mw.msg( 'rt-settings' ) ) .click( function ( e ) { e.preventDefault(); if ( settingsDialogOpening ) { return; } settingsDialogOpening = true; if ( mw.loader.getState( 'oojs-ui' ) !== 'ready' ) { if ( cursorWaitCss ) { cursorWaitCss.disabled = false; } else { cursorWaitCss = mw.util.addCSS( 'body { cursor: wait; }' ); } } mw.loader.using( [ 'oojs', 'oojs-ui' ], openSettingsDialog ); } ) .prependTo( this.$content ); } // Tooltip tail element is inside tooltip content element in order for the tooltip // not to disappear when the mouse is above the tail this.$tail = $( '<div>' ) .addClass( 'rt-tail' ) .prependTo( this.$element ); this.disappearing = false; this.show = function () { this.disappearing = false; clearTimeout( this.te.hideTimer ); clearTimeout( this.te.removeTimer ); this.$element .removeClass( CLASSES.FADE_OUT_DOWN ) .removeClass( CLASSES.FADE_OUT_UP ); if ( !this.isPresent ) { $overlay.append( this.$element ); } this.isPresent = true; }; this.hide = function () { var tooltip = this; tooltip.disappearing = true; if ( tooltip.$element.hasClass( 'rt-tooltip-above' ) ) { tooltip.$element .removeClass( CLASSES.FADE_IN_DOWN ) .addClass( CLASSES.FADE_OUT_UP ); } else { tooltip.$element .removeClass( CLASSES.FADE_IN_UP ) .addClass( CLASSES.FADE_OUT_DOWN ); } tooltip.te.removeTimer = setTimeout( function () { if ( tooltip.isPresent ) { tooltip.$element.detach(); tooltip.$tail.css( 'left', '' ); if ( activatedByClick ) { $body.off( 'click.rt touchstart.rt', tooltip.te.onBodyClick ); } $window.off( 'resize.rt', tooltip.te.onWindowResize ); tooltip.isPresent = false; } }, 200 ); }; this.calculatePosition = function ( ePageX, ePageY ) { var teElement, teOffsets, teOffset, targetTailOffsetX, tailLeft; this.$tail.css( 'left', '' ); teElement = this.te.$element.get( 0 ); if ( ePageX !== undefined ) { targetTailOffsetX = ePageX; teOffsets = ( teElement.getClientRects && teElement.getClientRects() ) || teElement.getBoundingClientRect(); if ( teOffsets.length > 1 ) { for ( var i = teOffsets.length - 1; i >= 0; i-- ) { if ( ePageY >= Math.round( $window.scrollTop() + teOffsets[ i ].top ) && ePageY <= Math.round( $window.scrollTop() + teOffsets[i].top + teOffsets[ i ].height ) ) { teOffset = teOffsets[ i ]; } } } } if ( !teOffset ) { teOffset = ( teElement.getClientRects && teElement.getClientRects()[ 0 ] ) || teElement.getBoundingClientRect(); } teOffset = { top: $window.scrollTop() + teOffset.top, left: $window.scrollLeft() + teOffset.left, width: teOffset.width, height: teOffset.height }; if ( !targetTailOffsetX ) { targetTailOffsetX = teOffset.left + ( teOffset.width / 2 ); } // Value of `left` in `.rt-tooltip-above .rt-tail` var defaultTailLeft = 19; // Value of `width` in `.rt-tail` var tailSideWidth = 13; // We tilt the square 45 degrees, so we need square root to calculate the distance. var tailWidth = tailSideWidth * Math.SQRT2; var tailHeight = tailWidth / 2; var tailCenterDelta = tailSideWidth + 1 - ( tailWidth / 2 ); var tooltip = this; var getTop = function ( isBelow ) { var delta = isBelow ? teOffset.height + tailHeight : -tooltip.$element.outerHeight() - tailHeight + 1; return teOffset.top + delta; }; this.$element.css( { top: getTop(), left: targetTailOffsetX - defaultTailLeft - tailCenterDelta, right: '' } ); // Is it squished against the right side of the page? if ( this.$element.offset().left + this.$element.outerWidth() > $window.width() - 1 ) { this.$element.css( { left: '', right: 0 } ); tailLeft = targetTailOffsetX - this.$element.offset().left - tailCenterDelta; } // Is a part of it above the top of the screen? if ( teOffset.top < this.$element.outerHeight() + $window.scrollTop() + tailHeight ) { this.$element .removeClass( 'rt-tooltip-above' ) .addClass( 'rt-tooltip-below' ) .addClass( CLASSES.FADE_IN_UP ) .css( { top: getTop( true ) } ); if ( tailLeft ) { this.$tail.css( 'left', ( tailLeft + tailSideWidth ) + 'px' ); } } else { this.$element .removeClass( 'rt-tooltip-below' ) .addClass( 'rt-tooltip-above' ) .addClass( CLASSES.FADE_IN_DOWN ) // A fix for cases when a tooltip shown once is then wrongly positioned when it // is shown again after a window resize. .css( { top: getTop() } ); if ( tailLeft ) { this.$tail.css( 'left', tailLeft + 'px' ); } } }; // Run some function for all the tooltips up to the top one in a tree. Its context will be // the tooltip, while its parameters may be passed to Tooltip.upToTopParent as an array // in the second parameter. If the third parameter passed to ToolTip.upToTopParent is true, // the execution stops when the function in question returns true for the first time, // and ToolTip.upToTopParent returns true as well. this.upToTopParent = function ( func, parameters, stopAtTrue ) { var returnValue, currentTooltip = this; do { returnValue = func.apply( currentTooltip, parameters ); if ( stopAtTrue && returnValue ) { break; } } while ( ( currentTooltip = currentTooltip.parent ) ); if ( stopAtTrue ) { return returnValue; } }; } if ( !enabled ) { addEnableLink(); return; } teSelector = REF_LINK_SELECTOR; if ( tooltipsForComments ) { teSelector += ', ' + COMMENTED_TEXT_SELECTOR; } $content.find( teSelector ).each( function () { new TooltippedElement( $( this ) ); } ); } settingsString = mw.cookie.get( 'RTsettings', '' ); if ( settingsString ) { settings = settingsString.split( '|' ); enabled = Boolean( Number( settings[ 0 ] ) ); delay = Number( settings[ 1 ] ); activatedByClick = Boolean( Number( settings[ 2 ] ) ); // The forth value was added later, so we provide for a default value. See comments below // for why we use "IS_TOUCHSCREEN && IS_MOBILE". tooltipsForComments = settings[ 3 ] === undefined ? IS_TOUCHSCREEN && IS_MOBILE : Boolean( Number( settings[ 3 ] ) ); } else { enabled = true; delay = 200; // Since the mobile browser check is error-prone, adding IS_MOBILE condition here would probably // leave cases where a user interacting with the browser using touches doesn't know how to call // a tooltip in order to switch to activation by click. Some touch-supporting laptop users // interacting by touch (though probably not the most popular use case) would not be happy too. activatedByClick = IS_TOUCHSCREEN; // Arguably we shouldn't convert native tooltips into gadget tooltips for devices that have // mouse support, even if they have touchscreens (there are laptops with touchscreens). // IS_TOUCHSCREEN check here is for reliability, since the mobile check is prone to false // positives. tooltipsForComments = IS_TOUCHSCREEN && IS_MOBILE; } mw.hook( 'wikipage.content' ).add( rt ); }() ); a43nofchz87jsl0z00dy2djz6ctocgi Srednekolymsk 0 47620 116416 2026-06-16T12:00:05Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni msumba cha [[Sakha Republic]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 3,525 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116416 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni msumba cha [[Sakha Republic]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 3,525 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] isj1laqt6goa9s1h3nd9p0rq6e0k8ro Inchoun 0 47621 116417 2026-06-16T12:02:40Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Chukotka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 387 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116417 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Chukotka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 387 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] er84h3fjck7wwa3csq4j8q150tcs4r0 Omolon (muzi) 0 47622 116418 2026-06-16T12:05:56Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''Omolon''' ni muzi cha [[chigaŵa cha Chukotka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 1,972 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116418 wikitext text/x-wiki {{Databox}} '''Omolon''' ni muzi cha [[chigaŵa cha Chukotka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 1,972 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] mrx4sqayahw8rqdt6zfa5xr01tjqpn3 116419 116418 2026-06-16T12:06:14Z Viyowoyero-vya-Malaŵi 11606 116419 wikitext text/x-wiki {{Databox}} '''Omolon''' ni muzi cha [[chigaŵa cha Chukotka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 873 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] 29az95fdqzbbvnq3s7i2l628lurrs6r 116441 116419 2026-06-16T13:34:56Z Tumbuka Arch 6863 Few corrections, mostly prepositions and conjunctions. 116441 wikitext text/x-wiki {{Databox}} '''Omolon''' ni muzi mu [[chigaŵa cha Chukotka]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 873 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] kk5828v9m3q0qzkdykx03srcuefa4m0 School of International and Public Affairs 0 47623 116420 2026-06-16T12:24:28Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni sukulu cha [[New York City]] kwa [[United States]].<ref>https://www.ft.com/content/eea05ab4-e45a-11e4-9039-00144feab7de</ref> ==Vilembo vifupi== {{reflist}} [[Category:United States]] [[Category:Sukulu]]" 116420 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni sukulu cha [[New York City]] kwa [[United States]].<ref>https://www.ft.com/content/eea05ab4-e45a-11e4-9039-00144feab7de</ref> ==Vilembo vifupi== {{reflist}} [[Category:United States]] [[Category:Sukulu]] qqnnz1ef6zbdddtaytrajs2rfb48y36 School of the Art Institute of Chicago 0 47624 116421 2026-06-16T12:26:31Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni sukulu cha [[Chicago]] kwa [[United States]].<ref>https://edge.sitecorecloud.io/nacubo1-nacubo-prd-dc8b/media/Nacubo/Documents/EndowmentFiles/2025-NCSE-Endowment-Market-Values-for-US-and-Canadian-Institutions-FINAL.xlsx</ref> ==Vilembo vifupi== {{reflist}} [[Category:United States]] [[Category:Sukulu]]" 116421 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni sukulu cha [[Chicago]] kwa [[United States]].<ref>https://edge.sitecorecloud.io/nacubo1-nacubo-prd-dc8b/media/Nacubo/Documents/EndowmentFiles/2025-NCSE-Endowment-Market-Values-for-US-and-Canadian-Institutions-FINAL.xlsx</ref> ==Vilembo vifupi== {{reflist}} [[Category:United States]] [[Category:Sukulu]] s20y1bfzwtrdhapue2z5mn8sngvogvm School of Art + Art History + Design 0 47625 116422 2026-06-16T12:28:57Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni sukulu cha [[Seattle]] kwa [[United States]].<ref>https://artsci.washington.edu/academics/arts</ref> ==Vilembo vifupi== {{reflist}} [[Category:United States]] [[Category:Sukulu]]" 116422 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni sukulu cha [[Seattle]] kwa [[United States]].<ref>https://artsci.washington.edu/academics/arts</ref> ==Vilembo vifupi== {{reflist}} [[Category:United States]] [[Category:Sukulu]] 6fge4zxnb3z5sd7wbrf3i0k08oatmix Sabah Tshung Tsin Secondary School 0 47626 116423 2026-06-16T12:31:10Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' (沙巴崇正中学; ''Sekolah Menengah Tshung Tsin Sabah'') ni sukulu cha [[Kota Kinabalu]] kwa [[Malaysia]].<ref>https://www.asiatimes.com.my/2023/12/04/%e5%ba%87%e5%ae%a2%e5%ae%b6%e5%85%ac%e4%bc%9a42%e5%b1%8a%e7%90%86%e4%ba%8b%e4%bc%9a%e5%a4%8d%e9%80%89%e5%87%a0%e4%b9%8e%e6%89%80%e6%9c%89%e4%b8%bb%e8%a6%81%e8%81%8c%e4%bd%8d%e5%8e%9f%e7%8f%ad%e4%ba%ba/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]]" 116423 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (沙巴崇正中学; ''Sekolah Menengah Tshung Tsin Sabah'') ni sukulu cha [[Kota Kinabalu]] kwa [[Malaysia]].<ref>https://www.asiatimes.com.my/2023/12/04/%e5%ba%87%e5%ae%a2%e5%ae%b6%e5%85%ac%e4%bc%9a42%e5%b1%8a%e7%90%86%e4%ba%8b%e4%bc%9a%e5%a4%8d%e9%80%89%e5%87%a0%e4%b9%8e%e6%89%80%e6%9c%89%e4%b8%bb%e8%a6%81%e8%81%8c%e4%bd%8d%e5%8e%9f%e7%8f%ad%e4%ba%ba/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]] 96qoqv4x1okhlbhpxtveamquntg2xvi 116440 116423 2026-06-16T13:33:13Z Tumbuka Arch 6863 Use "ku" instead of "cha". For example, if "X is a town in Y", assuming Y stands for country, then it would be anything such as "X ni msumba mu charu cha Y", meaning "X is a town in the country of Y". :) 116440 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (沙巴崇正中学; ''Sekolah Menengah Tshung Tsin Sabah'') ni sukulu ku [[Kota Kinabalu]] mu charu cha [[Malaysia]].<ref>https://www.asiatimes.com.my/2023/12/04/%e5%ba%87%e5%ae%a2%e5%ae%b6%e5%85%ac%e4%bc%9a42%e5%b1%8a%e7%90%86%e4%ba%8b%e4%bc%9a%e5%a4%8d%e9%80%89%e5%87%a0%e4%b9%8e%e6%89%80%e6%9c%89%e4%b8%bb%e8%a6%81%e8%81%8c%e4%bd%8d%e5%8e%9f%e7%8f%ad%e4%ba%ba/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]] 2dkhuflrq884plaaq36kbwfptnj83gg Sekolah Menengah Sains Sabah 0 47627 116424 2026-06-16T12:32:44Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni sukulu kwa [[Malaysia]].<ref>http://www.classcreator.com/Kota-Kinabalu-Malaysia-Sekolah-Menengah-Sains-Sabah-1994/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]]" 116424 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni sukulu kwa [[Malaysia]].<ref>http://www.classcreator.com/Kota-Kinabalu-Malaysia-Sekolah-Menengah-Sains-Sabah-1994/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]] nd2jvwjrqb1l2zcc13s483hw8zf9vwl 116425 116424 2026-06-16T12:33:20Z Viyowoyero-vya-Malaŵi 11606 116425 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (''Sabah Science Secondary School'') ni sukulu kwa [[Malaysia]].<ref>http://www.classcreator.com/Kota-Kinabalu-Malaysia-Sekolah-Menengah-Sains-Sabah-1994/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]] kc9ir2nysl2qcxxw7ec8gylzxiw0wa0 Sekolah Menengah Kebangsaan Ahmad Boestamam 0 47628 116426 2026-06-16T12:35:18Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' (''Sekolah Menengah Kebangsaan Ahmad Boestamam'') ni sukulu cha [[Sitiawan]] kwa [[Malaysia]].<ref>http://smkab.org/smkab/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]]" 116426 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (''Sekolah Menengah Kebangsaan Ahmad Boestamam'') ni sukulu cha [[Sitiawan]] kwa [[Malaysia]].<ref>http://smkab.org/smkab/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]] bw07mdkjcb4jc00jpdkdu853e4z62zy 116427 116426 2026-06-16T12:35:43Z Viyowoyero-vya-Malaŵi 11606 Viyowoyero-vya-Malaŵi moved page [[Ahmad Boestamam National Secondary School]] to [[Sekolah Menengah Kebangsaan Ahmad Boestamam]] 116426 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (''Sekolah Menengah Kebangsaan Ahmad Boestamam'') ni sukulu cha [[Sitiawan]] kwa [[Malaysia]].<ref>http://smkab.org/smkab/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]] bw07mdkjcb4jc00jpdkdu853e4z62zy 116429 116427 2026-06-16T12:35:58Z Viyowoyero-vya-Malaŵi 11606 116429 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (''Ahmad Boestamam National Secondary School'') ni sukulu cha [[Sitiawan]] kwa [[Malaysia]].<ref>http://smkab.org/smkab/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] [[Category:Sukulu]] 45z5q6t7erw145ts1kbsaf9u7iakb3g Ahmad Boestamam National Secondary School 0 47629 116428 2026-06-16T12:35:44Z Viyowoyero-vya-Malaŵi 11606 Viyowoyero-vya-Malaŵi moved page [[Ahmad Boestamam National Secondary School]] to [[Sekolah Menengah Kebangsaan Ahmad Boestamam]] 116428 wikitext text/x-wiki #REDIRECT [[Sekolah Menengah Kebangsaan Ahmad Boestamam]] tmrsyl0sbuqmi1vwzm47o02nw1qv3tx Sitiawan 0 47630 116430 2026-06-16T12:38:23Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni mzinda cha [[Perak]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 156,234 (2016).<ref>https://web.archive.org/web/20101113180530/http://www.statistics.gov.my/portal/download/download.php?cat=2&id_file=11</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]]" 116430 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni mzinda cha [[Perak]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 156,234 (2016).<ref>https://web.archive.org/web/20101113180530/http://www.statistics.gov.my/portal/download/download.php?cat=2&id_file=11</ref> ==Vilembo vifupi== {{reflist}} [[Category:Malaysia]] jzhvoyxs6bgsn8t6reuxguxua3b1i0k Felda Air Tawar 2 0 47631 116431 2026-06-16T12:42:06Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi ndipo FELDA cha [[Johor]] kwa {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]]" 116431 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi ndipo FELDA cha [[Johor]] kwa {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]] 1p5e3vxz7gfs8kvecyx79ozxoz0j5ud 116432 116431 2026-06-16T12:42:27Z Viyowoyero-vya-Malaŵi 11606 116432 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni FELDA cha [[Johor]] kwa {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]] j4wko0uokf71fbs8060xbnboufqip7y 116437 116432 2026-06-16T13:24:51Z Tumbuka Arch 6863 translated Felda meaning, and few entries. Original was good, this is just to spice and give a little meaning when one is reading for the first time ;) 116437 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni malo ghakuoneleleka na ulongozgi wa boma mu msumba chigaŵa cha [[Johor]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]] end8tnu8jo1qpsa8dzsycbuc53atby1 116439 116437 2026-06-16T13:27:17Z Tumbuka Arch 6863 noted needed 116439 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni malo ghakuoneleleka na ulongozgi wa boma mu chigaŵa cha [[Johor]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]] 93sajnxzqy0eahr9mae1uh0vzl5y9pe Felda Air Tawar 3 0 47632 116433 2026-06-16T12:43:17Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni FELDA cha [[Johor]] kwa {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]]" 116433 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni FELDA cha [[Johor]] kwa {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]] j4wko0uokf71fbs8060xbnboufqip7y Felda Air Tawar 1 0 47633 116434 2026-06-16T12:43:30Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni FELDA cha [[Johor]] kwa {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]]" 116434 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni FELDA cha [[Johor]] kwa {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]] j4wko0uokf71fbs8060xbnboufqip7y 116438 116434 2026-06-16T13:26:54Z Tumbuka Arch 6863 116438 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni malo ghakuoneleleka na ulongozgi wa boma mu chigaŵa cha [[Johor]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. [[Category:Malaysia]] nztbg1ge6mae03skl5ohau88zcxxxa1 Category:Malaysia 14 47634 116435 2026-06-16T12:44:29Z Viyowoyero-vya-Malaŵi 11606 Created page with "[[{{PAGENAME}}]]" 116435 wikitext text/x-wiki [[{{PAGENAME}}]] ewjikusk4kvxxflz6s1v2f1pd62lyq4 116436 116435 2026-06-16T12:44:56Z Viyowoyero-vya-Malaŵi 11606 116436 wikitext text/x-wiki [[{{PAGENAME}}]] [[Category:Asia]] razw5pa7w9ipl16ltkc9qss2s4d328z Khasan 0 47635 116443 2026-06-17T02:20:26Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Primorsky]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 742 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116443 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Primorsky]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 742 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] f866ypn8taxsvcbwlam8ed4xoh7nypo 116444 116443 2026-06-17T02:22:04Z Viyowoyero-vya-Malaŵi 11606 116444 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Primorsky]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili pafupi na malo ghatatu pa Mlonga wa Tumen apo mphaka ya Russia, [[China]] na [[North Korea]] yikukumana. Lili na ŵanthu 742 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] ehsljedi70qt8fmuoy3rpesqkg9jiwo Imeni Poliny Osipenko 0 47636 116445 2026-06-17T02:24:16Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Khabarovsk]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 2,252 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Mbiri== Pakwamba yikamanyikwanga kuti '''Kerbi''' (Керби), ndipo mu 1939 yikasintha zina lakuti Polina Osipenko, uyo wakayendeskanga ndege ku Soviet ndipo wakaŵika rekodi ya ndege za ŵanakazi pa charu chose chapasi apo ŵakakwer..." 116445 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Khabarovsk]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 2,252 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Mbiri== Pakwamba yikamanyikwanga kuti '''Kerbi''' (Керби), ndipo mu 1939 yikasintha zina lakuti Polina Osipenko, uyo wakayendeskanga ndege ku Soviet ndipo wakaŵika rekodi ya ndege za ŵanakazi pa charu chose chapasi apo ŵakakweranga ndege ku Imeni Poliny Osipenko kufuma ku [[Moscow]].<ref>http://www.famhist.ru/famhist/hal/007ca4e8.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] 0gh1g7rgxpagmi6hgqto3st6d3r6rha Nikolayevsk-on-Amur 0 47637 116446 2026-06-17T02:26:15Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni msumba cha [[chigaŵa cha Khabarovsk]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 17,815 (2024).<ref>https://web.archive.org/web/20250131122530/https://rosstat.gov.ru/storage/mediabank/%D0%A1hisl_MO_01-01-2024.xlsx</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116446 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni msumba cha [[chigaŵa cha Khabarovsk]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 17,815 (2024).<ref>https://web.archive.org/web/20250131122530/https://rosstat.gov.ru/storage/mediabank/%D0%A1hisl_MO_01-01-2024.xlsx</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] gw3u1wg4v8b8hipw25n9qpn0uf9wr2t Aleksandrovsk-Sakhalinskiy 0 47638 116449 2026-06-17T02:31:23Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni msumba cha [[chigaŵa cha Sakhalin]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 10,613 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116449 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni msumba cha [[chigaŵa cha Sakhalin]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 10,613 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] 6vscbquood6aiicfow2r57pj43fq34q Tymovskoye 0 47639 116450 2026-06-17T02:32:41Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Sakhalin]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 7,855 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116450 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Sakhalin]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 7,855 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] llx0yllj8uyul0p09jc81xvqqssx32s Yuzhno-Sakhalinsk 0 47640 116451 2026-06-17T02:36:31Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' (Ю́жно-Сахали́нск) ni mzinda cha [[chigaŵa cha Sakhalin]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili pa [[nkhoska]] cha [[Sakhalin]], kumpoto kwa [[Japan]]. Lili na ŵanthu 181,587 (2021).<ref>https://rosstat.gov.ru/vpn/2020/Tom1_Chislennost_i_razmeshchenie_naseleniya</ref> Mzinda uwu ukachemekanga '''Vladimirovka''' (Влади́мировка) kufuma mu 1882 m'paka 1905. Pamanyuma likachemeka '''Toyohara''' (..." 116451 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (Ю́жно-Сахали́нск) ni mzinda cha [[chigaŵa cha Sakhalin]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili pa [[nkhoska]] cha [[Sakhalin]], kumpoto kwa [[Japan]]. Lili na ŵanthu 181,587 (2021).<ref>https://rosstat.gov.ru/vpn/2020/Tom1_Chislennost_i_razmeshchenie_naseleniya</ref> Mzinda uwu ukachemekanga '''Vladimirovka''' (Влади́мировка) kufuma mu 1882 m'paka 1905. Pamanyuma likachemeka '''Toyohara''' (豊原市 ''Toyohara-shi'') pasi pa ulamuliro wa Japan kufuma mu 1905 mpaka 1946. ==Vilembo vifupi== {{reflist}} [[Category:Russia]] q2fn7z1bb1xf38nw98nqxzq1rm5klig 116452 116451 2026-06-17T02:37:56Z Viyowoyero-vya-Malaŵi 11606 116452 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (Ю́жно-Сахали́нск) ni mzinda cha [[chigaŵa cha Sakhalin]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili pa [[nkhoska]] cha [[Sakhalin]], pafupi na [[Japan]]. Lili na ŵanthu 181,587 (2021).<ref>https://rosstat.gov.ru/vpn/2020/Tom1_Chislennost_i_razmeshchenie_naseleniya</ref> Mzinda uwu ukachemekanga '''Vladimirovka''' (Влади́мировка) kufuma mu 1882 m'paka 1905. Pamanyuma likachemeka '''Toyohara''' (豊原市 ''Toyohara-shi'') pasi pa ulamuliro wa Japan kufuma mu 1905 mpaka 1946. ==Vilembo vifupi== {{reflist}} [[Category:Russia]] iojk79dsj30jc8ukqhxh2z1xb8niem7 Petropavlovsk-Kamchatsky 0 47641 116453 2026-06-17T02:39:57Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' (Петропавловск-Камчатский) ni mzinda cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 164,900 (2021).<ref>https://rosstat.gov.ru/storage/mediabank/tab-5_VPN-2020.xlsx</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116453 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' (Петропавловск-Камчатский) ni mzinda cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 164,900 (2021).<ref>https://rosstat.gov.ru/storage/mediabank/tab-5_VPN-2020.xlsx</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] mejyoq0cp6wcxq6ok9jxsgnwfdhyoj8 Elizovo 0 47642 116454 2026-06-17T02:42:11Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' panji '''Yelizovo''' ni muzi cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 39,569 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116454 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' panji '''Yelizovo''' ni muzi cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 39,569 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] n4omrd4sxbq6u46c9eh1kivbodzmc7n Ust-Bolsheretsk 0 47643 116455 2026-06-17T02:45:53Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 2,116 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116455 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 2,116 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] gyn1aodgbvatqe4469jzulgz032ncaa 116457 116455 2026-06-17T02:49:34Z Viyowoyero-vya-Malaŵi 11606 116457 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 2,116 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> {{reflist2}} [[Category:Russia]] 3ya14lvr33ebf0p6c2bq1z3y6fyunvw 116460 116457 2026-06-17T02:51:53Z Viyowoyero-vya-Malaŵi 11606 116460 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi cha [[chigaŵa cha Kamchatka]] kwa {{#invoke:wd|property|linked|references|P17}}. Lili na ŵanthu 2,116 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> == Vilembo vifupi == {{reflist}} [[Category:Russia]] 4otx437dwkmsfylsjbq1pgk0zd1o3c3 Template:Reflist2 10 47644 116456 2026-06-17T02:49:07Z Viyowoyero-vya-Malaŵi 11606 test 116456 wikitext text/x-wiki <includeonly> == Vilembo vifupi == <references /></includeonly><noinclude>{{Documentation}}</noinclude> bqopqmqs9s85kylli4covz6ufwcql42 Template:Reflist2/doc 10 47645 116458 2026-06-17T02:50:53Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Documentation subpage}} == See also == *[[Template:Reflist]] <includeonly>{{Sandbox other|| <!-- Categories below this line --> }}</includeonly>" 116458 wikitext text/x-wiki {{Documentation subpage}} == See also == *[[Template:Reflist]] <includeonly>{{Sandbox other|| <!-- Categories below this line --> }}</includeonly> gx4ol0elct8tsb4jp1u4z3xpt0bc25r Ozyorny 0 47646 116461 2026-06-17T04:39:52Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Chukotka]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 650 (2006).<ref>https://web.archive.org/web/20071021125408/http://redcross-chukotka.ru/English/modules.php?name=Content&pa=showpage&pid=14</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116461 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Chukotka]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 650 (2006).<ref>https://web.archive.org/web/20071021125408/http://redcross-chukotka.ru/English/modules.php?name=Content&pa=showpage&pid=14</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] 5kt24577bbzr9yxfccbhp3pv6fuynsh Novoye Chaplino 0 47647 116462 2026-06-17T04:42:33Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Chukotka]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 419 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116462 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Chukotka]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 419 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] 70tbma9l1radwycii0mtm6bradkl91r Uelen 0 47648 116463 2026-06-17T04:44:33Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Chukotka]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 720 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]]" 116463 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Chukotka]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 720 (2010).<ref>http://www.gks.ru/free_doc/new_site/perepis2010/croc/perepis_itogi1612.htm</ref> ==Vilembo vifupi== {{reflist}} [[Category:Russia]] 5b3t0pbrtbun6ktww2q9izi77eb4t3o Kyzyldzhar 0 47649 116464 2026-06-17T05:28:18Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Osh]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 732 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]]" 116464 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Osh]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 732 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]] a0xjugozuatpfn5xmk00vyrrux8tgjo Kök-Art 0 47650 116465 2026-06-17T05:30:40Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Osh]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 2,872 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]]" 116465 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Osh]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 2,872 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]] syvn46yqm9hu14gfos18bswhdowtkom Engilchek 0 47651 116466 2026-06-17T05:33:02Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 140 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]]" 116466 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 140 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]] 85t9zmwo7xyw2w9ttyj8946a5ob7dov Sary-Tologoy 0 47652 116467 2026-06-17T05:34:18Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 1,631 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]]" 116467 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 1,631 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]] 5s790218a7h2inffbk6jfxlyun6u0xw Keng-Suu 0 47653 116468 2026-06-17T05:36:16Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 2,340 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]]" 116468 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 2,340 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]] mkm7nm0q5p6pr6vxdrkvn2uk28b2dxl Jyluu-Bulak 0 47654 116469 2026-06-17T05:37:37Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 1,819 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]]" 116469 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 1,819 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]] 37ti25egz48ny8ukq3dxxht9kpqkfyz Category:Kyrgyzstan 14 47655 116470 2026-06-17T05:38:29Z Viyowoyero-vya-Malaŵi 11606 Created page with "[[{{PAGENAME}}]] [[Category:Asia]]" 116470 wikitext text/x-wiki [[{{PAGENAME}}]] [[Category:Asia]] razw5pa7w9ipl16ltkc9qss2s4d328z Kööchü 0 47656 116471 2026-06-17T05:41:13Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 2,211 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]]" 116471 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha Issyk-Kul]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu 2,211 (2021).<ref>http://www.stat.kg/ru/statistics/download/operational/825/</ref> ==Vilembo vifupi== {{reflist}} [[Category:Kyrgyzstan]] pc49hiyvr6up2gvzhfh8ndkigox9pwi Jordan Staal 0 47657 116472 2026-06-17T06:09:09Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Banja== {{#invoke:wd|property|linked|references|P3373}} ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116472 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Banja== {{#invoke:wd|property|linked|references|P3373}} ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] 91l00b0dv6ztu3zgimc11w6vixc21g8 116473 116472 2026-06-17T06:10:17Z Viyowoyero-vya-Malaŵi 11606 116473 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] scqxsj7p8j15thxnnubpaja6trfl0id 116476 116473 2026-06-17T06:14:17Z Viyowoyero-vya-Malaŵi 11606 116476 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku [[Ontario]]. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] chzigbqz3y24p9yxp0c5fgehujlvirj 116479 116476 2026-06-17T06:23:40Z Viyowoyero-vya-Malaŵi 11606 116479 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] mmhr4kr0e8nobcstkoz59xxljynj55k 116480 116479 2026-06-17T06:26:04Z Viyowoyero-vya-Malaŵi 11606 116480 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] pcb8tmzyv8mmrrn54k18e5tjefs800o John Madden 0 47658 116474 2026-06-17T06:12:31Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116474 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] scqxsj7p8j15thxnnubpaja6trfl0id 116475 116474 2026-06-17T06:14:05Z Viyowoyero-vya-Malaŵi 11606 116475 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku [[Ontario]]. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] chzigbqz3y24p9yxp0c5fgehujlvirj Chris Dawson 0 47659 116477 2026-06-17T06:21:36Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku [[Perth]]. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116477 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku [[Perth]]. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] 4iwvtwaf2ogxdj2pnmcmidquhxcbgc3 116478 116477 2026-06-17T06:23:22Z Viyowoyero-vya-Malaŵi 11606 116478 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] mmhr4kr0e8nobcstkoz59xxljynj55k 116481 116478 2026-06-17T06:26:21Z Viyowoyero-vya-Malaŵi 11606 116481 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] pcb8tmzyv8mmrrn54k18e5tjefs800o Hilda Heine 0 47660 116482 2026-06-17T06:29:33Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116482 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] pcb8tmzyv8mmrrn54k18e5tjefs800o Melanie Perkins 0 47661 116483 2026-06-17T06:31:49Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116483 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] pcb8tmzyv8mmrrn54k18e5tjefs800o User:Viyowoyero-vya-Malaŵi/Human 2 47662 116484 2026-06-17T06:33:30Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} <!--- [[Category:Ŵanthu ŵamoyo]] --->" 116484 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} <!--- [[Category:Ŵanthu ŵamoyo]] ---> o870krk7qjaefis317up9eo7vpiizw5 116489 116484 2026-06-17T06:40:03Z Viyowoyero-vya-Malaŵi 11606 116489 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] 204hl72721fy9ac6ous2m0jbpm4b9f2 116490 116489 2026-06-17T06:40:30Z Viyowoyero-vya-Malaŵi 11606 116490 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] eiat2wcxonrud80pcd45f8mavhrds78 User:Viyowoyero-vya-Malaŵi/Village 2 47663 116485 2026-06-17T06:36:13Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha XYZ]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu XYZ (2021).<ref>XYZ</ref> ==Vilembo vifupi== {{reflist}} <!--- [[Category:XYZ]] --->" 116485 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[chigaŵa cha XYZ]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. Muli ŵanthu XYZ (2021).<ref>XYZ</ref> ==Vilembo vifupi== {{reflist}} <!--- [[Category:XYZ]] ---> 5mwwsczl9cub02yrzxt4r6vfw0pnjw6 Cliff Obrecht 0 47664 116486 2026-06-17T06:37:28Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116486 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] pcb8tmzyv8mmrrn54k18e5tjefs800o Tom Roger Aadland 0 47665 116487 2026-06-17T06:38:51Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116487 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P27}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] pcb8tmzyv8mmrrn54k18e5tjefs800o 116488 116487 2026-06-17T06:40:00Z Viyowoyero-vya-Malaŵi 11606 116488 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] 204hl72721fy9ac6ous2m0jbpm4b9f2 116492 116488 2026-06-17T06:42:28Z Viyowoyero-vya-Malaŵi 11606 116492 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] eiat2wcxonrud80pcd45f8mavhrds78 Vikebygd 0 47666 116491 2026-06-17T06:41:44Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni muzi mu [[Rogaland]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. [[Category:Norway]]" 116491 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni muzi mu [[Rogaland]] mu charu cha {{#invoke:wd|property|linked|references|P17}}. [[Category:Norway]] 6oyp5gc972rfdmlk9iurm4j6bltzmdw Adam Goodes 0 47667 116493 2026-06-17T06:43:29Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116493 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] eiat2wcxonrud80pcd45f8mavhrds78 Cho Kyu-hyun 0 47668 116494 2026-06-17T06:45:11Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116494 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] eiat2wcxonrud80pcd45f8mavhrds78 Joanna Agacka-Indecka 0 47669 116495 2026-06-17T06:48:23Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116495 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] eiat2wcxonrud80pcd45f8mavhrds78 116496 116495 2026-06-17T06:50:19Z Viyowoyero-vya-Malaŵi 11606 116496 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' wakaŵa [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] qsm1deu6hh0imegvkz4xnhy53y8bexi Mohammad Zahir Aghbar 0 47670 116497 2026-06-17T08:49:45Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116497 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] eiat2wcxonrud80pcd45f8mavhrds78 Maggie Brookes-Butt 0 47671 116498 2026-06-17T11:58:40Z Viyowoyero-vya-Malaŵi 11606 Created page with "{{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]]" 116498 wikitext text/x-wiki {{Databox}} '''{{PAGENAME}}''' ni [[munthu]] wakufuma ku {{#invoke:wd|property|linked|references|P27}}. Iwo ni {{#invoke:wd|property|linked|references|P21}}. ==Moyo== {{PAGENAME}} wakababika mu {{#invoke:wd|property|linked|references|P569}} ku {{#invoke:wd|property|linked|references|P19}}. ==Vilembo vifupi== {{reflist}} [[Category:Ŵanthu ŵamoyo]] eiat2wcxonrud80pcd45f8mavhrds78