Moduł:Drzewa link: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
M |
M (czeki czeki) |
||
Linia 13: | Linia 13: | ||
} |
} |
||
local args = tools.getArgs(frame) |
local args = tools.getArgs(frame) |
||
local cat |
|||
for k, v in pairs(args) do |
|||
⚫ | |||
if expectedArgs[k] ~= nil then |
|||
⚫ | |||
else |
|||
⚫ | |||
end |
|||
end |
|||
assert(#pairs(args) == 1, 'linkCat() przyjmuje 1 argument, podano ' .. #pairs(args)) |
assert(#pairs(args) == 1, 'linkCat() przyjmuje 1 argument, podano ' .. #pairs(args)) |
||
if |
if expectedArgs[k] ~= nil then namespace = expectedArgs[k] |
||
else cat = v end |
|||
lookup = args['1'] |
|||
if cat ~= nil then cat = expectedArgs[cat.split(':')[1].split(' – ')[0].lower()] end |
|||
⚫ | |||
else |
|||
local cat = expectedArgs[args] |
|||
end |
|||
return 'cat ' + cat |
|||
end |
end |
||
Wersja z 16:09, 30 lis 2020
local p = {}
local tools = require('Moduł:Narzędzia')
function p.linkCat(frame)
local expectedArgs = {
['główna']='główna',
['pliki']='pliki',
['nonnews']='nonnews',
['słownik']='cytaty',
['cytaty']='cytaty',
['poradniki']='poradniki',
['nonźródła']='nonźródła'
}
local args = tools.getArgs(frame)
local cat
local namespace
assert(#pairs(args) == 1, 'linkCat() przyjmuje 1 argument, podano ' .. #pairs(args))
if expectedArgs[k] ~= nil then namespace = expectedArgs[k]
else cat = v end
if cat ~= nil then cat = expectedArgs[cat.split(':')[1].split(' – ')[0].lower()] end
return namespace .. ', ' .. cat
end
return p