Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 20: | Строка 20: | ||
if not ok then return nil end | if not ok then return nil end | ||
return content | return content | ||
end | end | ||
| Строка 143: | Строка 100: | ||
} | } | ||
} | } | ||
local function getTemplateMeta(frame, tplPath) | |||
local expanded = frame:expandTemplate { | |||
title = tplPath, | |||
args = { "json" } | |||
} | |||
local ok, data = pcall(mw.text.jsonDecode, expanded) | |||
if ok and type(data) == "table" then | |||
return data | |||
end | |||
return "" | |||
end | |||
local errors = {} | local errors = {} | ||
| Строка 157: | Строка 128: | ||
return | return | ||
end | end | ||
local parsed = | local parsed = getTemplateMeta(frame, tplPath) | ||
local ok, dp = pcall(require, "Module:GetField") | local ok, dp = pcall(require, "Module:GetField") | ||
for _, sw in ipairs(switches) do | for _, sw in ipairs(switches) do | ||