Moduł:Drzewa link: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
M (zobaczmy) |
M |
||
Linia 14: | Linia 14: | ||
local args = tools.getArgs(frame) |
local args = tools.getArgs(frame) |
||
if #args ~= 1 then |
if #args ~= 1 then |
||
return '' |
return 'cat: nil' |
||
end |
end |
||
if args['1'] ~= nil then |
if args['1'] ~= nil then |
||
Linia 21: | Linia 21: | ||
else |
else |
||
local cat = expectedArgs[args] |
local cat = expectedArgs[args] |
||
return cat |
return 'cat ' + cat |
||
end |
end |
||
end |
end |
Wersja z 15:25, 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)
if #args ~= 1 then
return 'cat: nil'
end
if args['1'] ~= nil then
lookup = args['1']
local cat = expectedArgs[lookup.split(':')[1].split(' – ')[0].lower()]
else
local cat = expectedArgs[args]
return 'cat ' + cat
end
end
return p