Modulo:TNT: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m Copia di una modifica di Bawolff: «Give a more useful error message if jsonconfig is missing. There have been three questions about this on the support desk from third party folks copying this template.» da mw:Module:TNT. Maggiori informazioni. |
Update from master using #Synchronizer |
||
Riga 50:
id = mw.text.trim(v)
elseif type(k) == 'number' then
elseif k == 'lang' and v ~= '_' then
lang = mw.text.trim(v)
Riga 96:
local data = loadData(dataset)
local names = {}
for _, field in
table.insert(names, field.name)
end
local numOnly = true
local params = {}
local paramOrder = {}
for _, row in
local newVal = {}
local name = nil
for pos,
if columnName == 'name' then
name =
else
newVal[columnName] =
end
end
if name then
if (
(type(name) ~= "number")
and (
(type(name) ~= "string")
or not string.match(name, "^%d+$")
)
) then
numOnly = false
end
params[name] = newVal
table.insert(paramOrder, name)
Riga 120 ⟶ 129:
-- Work around json encoding treating {"1":{...}} as an [{...}]
if numOnly then
end
local json = mw.text.jsonEncode({
params=params,
paramOrder=paramOrder,
description=data.description,
})
if numOnly then
end
return json
Riga 157 ⟶ 170:
-- Give helpful error to thirdparties who try and copy this module.
if not mw.ext or not mw.ext.data or not mw.ext.data.get then
error(string.format([['''Missing JsonConfig extension
Cannot load https://commons.wikimedia.org/wiki/Data: See https://www.mediawiki.org/wiki/Extension:JsonConfig#Supporting_Wikimedia_templates''']], dataset))
end
|