Модуль:Песочница/Pok: различия между версиями

Нет описания правки
Нет описания правки
Строка 5: Строка 5:
return (s:gsub("^%s*(.-)%s*$", "%1"))
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
end


local function parse_keys_from_template(content, switches)
local function parse_keys_from_template(content, switches)
Строка 135: Строка 133:
local switchConfigs = {
local switchConfigs = {
card = {
card = {
param = "card",
wrapper = function(key, tplCalls)
wrapper = function(key, tplCalls)
if not tplCalls or #tplCalls == 0 then return "" end
if not tplCalls or #tplCalls == 0 then return "" end
return "|" .. mw.text.encode(key) .. "|" .. table.concat(tplCalls, " ") .. ""
return "{{card|" .. mw.text.encode(key) .. "|" .. table.concat(tplCalls, " ") .. "}}"
end
end
},
},
title = {
title = {
param = "title",
wrapper = function(key, tplCalls)
wrapper = function(key, tplCalls)
local parts = {}
local parts = {}
Строка 186: Строка 182:
table.insert(switchKeyOrder[sw], key)
table.insert(switchKeyOrder[sw], key)
end
end
local param = (switchConfigs[sw] and switchConfigs[sw].param)
local param = sw
table.insert(switchKeyToTemplates[sw][key], "{{" .. tplPath .. "|" .. param .. "|" .. key .. "}}")
table.insert(switchKeyToTemplates[sw][key], "{{" .. tplPath .. "|" .. param .. "|" .. key .. "}}")
end
end