Moduł:Drzewa link: Różnice pomiędzy wersjami

Z Nonsensopedii, polskiej encyklopedii humoru
M (czeki czeki)
M (okej...)
Linia 15: Linia 15:
local cat
local cat
local namespace
local namespace
assert(#pairs(args) == 1, 'linkCat() przyjmuje 1 argument, podano ' .. #pairs(args))
assert(frameLen(args) == 1, 'linkCat() przyjmuje 1 argument, podano ' .. frameLen(args))
if expectedArgs[k] ~= nil then namespace = expectedArgs[k]
if expectedArgs[k] ~= nil then namespace = expectedArgs[k]
else cat = v end
else cat = v end
if cat ~= nil then cat = expectedArgs[cat.split(':')[1].split(' – ')[0].lower()] end
if cat ~= nil then cat = expectedArgs[cat.split(':')[1].split(' – ')[0].lower()] end
return namespace .. ', ' .. cat
return namespace .. ', ' .. cat
end

local function frameLen(frame)
rot = 0
for i, v in pairs(frame.args) do
rot = rot+1
return rot
end
end
end



Wersja z 16:16, 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(frameLen(args) == 1, 'linkCat() przyjmuje 1 argument, podano ' .. frameLen(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

local function frameLen(frame)
	rot = 0
	for i, v in pairs(frame.args) do
		rot = rot+1
	return rot
	end
end

return p