La documentazione per questo modulo può essere creata in Modulo:ManutenzioneQuickbar/man
local p = {} local mWikidata = require('Module:Wikidata') local getArgs = require('Module:Arguments').getArgs local config = mw.loadData( 'Modulo:ManutenzioneQuickbar/Configurazione'); local function is_defined(s) if s and s ~= '' then return s end return nil end local function _getName ( nome ) if not is_defined(nome) then return '' end return mWikidata._getLabel( {nome} ) end local function table2list ( tabella ) local testo = '' for _, value in pairs(tabella) do testo = testo .. "* " .. value .."\n" end return testo end local function getCountryNames () return p.getNames(config.IDStati) end local function getCurrencyNames () return p.getNames(config.ValuteStati) end local function getAreaNames () return p.getNames(config.SuperficiStati) end --[[ API ]]-- function p.getName ( frame ) local args = getArgs(frame) if (not is_defined(args)) or (not is_defined(args[1])) then return '' end return _getName( args[1] ) end function p.getNames ( frame ) local names = {} local args = getArgs(frame) for key, value in pairs(args) do names[key] = _getName( value ) end return names end function p.CountryNamesList () return table2list( getCountryNames() ) end function p.CurrencyNamesList () return table2list( getCurrencyNames() ) end function p.CurrencyNamesDiffList () local diffList = {} local wdValuta = '' local voyValuta = '' for nome, codice in pairs(config.IDStati) do if is_defined( codice ) then local nomeValuta = mWikidata._getProperty({ 'P38', n = 1, from = codice }) if is_defined(nomeValuta) then nomeValuta = nomeValuta:gsub("^%l", string.upper) else wdValuta = nil end local codice = mWikidata._getProperty({ 'P498', n = 1, from = mWikidata._getProperty({ 'P38', n = 1, from = codice, formatting = 'raw' }) }) if is_defined(codice) and (codice ~= "''nessun valore''") then wdValuta = nomeValuta .. ' (' .. codice .. ') ' else wdValuta = nomeValuta end voyValuta = config.ValuteStati[nome] if is_defined( voyValuta ) and is_defined( wdValuta ) and (voyValuta ~= wdValuta) then diffList[nome] = voyValuta .. " Vs. " .. wdValuta end end end return table2list( diffList ) end function p.AreaNamesList () return table2list( getAreaNames() ) end return p