Difference between revisions of "Module:TNT"

54 bytes added ,  01:41, 12 April 2019
Trim parameter whitespaces
>Yurik
(fixed doc link)
>Yurik
(Trim parameter whitespaces)
Line 41: Line 41:
for k, v in pairs(frame.args) do
for k, v in pairs(frame.args) do
if k == 1 then
if k == 1 then
dataset = v
dataset = mw.text.trim(v)
elseif k == 2 then
elseif k == 2 then
id = v
id = mw.text.trim(v)
elseif type(k) == 'number' then
elseif type(k) == 'number' then
table.insert(params, v)
table.insert(params, v)
elseif k == 'lang' and v ~= '_' then
elseif k == 'lang' and v ~= '_' then
lang = v
lang = mw.text.trim(v)
end
end
end
end
Line 61: Line 61:
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix
function link(dataset)
function link(dataset)
dataset = 'Data:' .. (dataset or '')
dataset = 'Data:' .. mw.text.trim(dataset or '')
if mw.site.siteName == 'Wikimedia Commons' then
if mw.site.siteName == 'Wikimedia Commons' then
return dataset
return dataset
Anonymous user