Moduł:Drzewa link: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
M (hmhmhmhm) |
M (.) |
||
Linia 13: | Linia 13: | ||
local namespace = space |
local namespace = space |
||
end |
end |
||
⚫ | |||
if cat == nil then |
if cat == nil then |
||
if args[1] == nil then return '' end |
if args[1] == nil then return '' end |
||
Linia 21: | Linia 22: | ||
local namespace = 'główna'end |
local namespace = 'główna'end |
||
end |
end |
||
⚫ | |||
return '[[:Kategoria:' .. cat .. ']]' |
return '[[:Kategoria:' .. cat .. ']]' |
||
end |
end |
Wersja z 10:14, 2 gru 2020
local p = {}
local tools = require('Moduł:Narzędzia')
function p.linkCat(frame)
local namespaces =
{['główna']='główna', ['grafiki']='grafiki', ['nonnews']='nonnews',
['słownik']='słownik', ['cytaty']='cytaty', ['poradniki']='poradniki',
['nonźródła']='nonźródła'}
local args = tools.getArgs(frame)
for name, space in pairs(namespaces) do
if args[space] ~= nil then
local cat = args[space]
local namespace = space
end
end
if cat == nil then
if args[1] == nil then return '' end
local cat = args[1]
if potentialcat:find '–' then
local namespace = namespaces[potentialcat.split(' – ')[0].lower()]
else
local namespace = 'główna'end
end
return '[[:Kategoria:' .. cat .. ']]'
end
return p