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

Z Nonsensopedii, polskiej encyklopedii humoru
M (esu.mp3)
M
Linia 1: Linia 1:
local p = {}
local p = {}
local tools = require('Moduł:Narzędzia')
local tools = require('Moduł:Narzędzia')

function p._frameLen(frame)
rot = 0
for i, v in ipairs(tools.getArgs(frame)) do rot = rot+1 end
return rot
end


function p.linkCat(frame)
function p.linkCat(frame)
Linia 18: Linia 12:
['nonźródła']='nonźródła'
['nonźródła']='nonźródła'
}
}
local args = tools.getArgs(frame)
local args = frame.args
local cat
local cat
local namespace
local namespace
for o in range(100) do
assert(p._frameLen(args) == 1, 'linkCat() przyjmuje 1 argument, podano ' .. p._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
end
return namespace .. ', ' .. cat
return namespace .. ', ' .. cat
end
end

Wersja z 09:11, 2 gru 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 = frame.args
	local cat
	local namespace
	for o in range(100) do
		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
	end
	return namespace .. ', ' .. cat
end

return p