Модуль:GetField: различия между версиями
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
||
| Строка 843: | Строка 843: | ||
local jsonStr = mw.text.unstripNoWiki(args[1] or args.json or "") | local jsonStr = mw.text.unstripNoWiki(args[1] or args.json or "") | ||
local tplPath = mw.text.unstripNoWiki(args[2] or args.template or "") | local tplPath = mw.text.unstripNoWiki(args[2] or args.template or "") | ||
if jsonStr == "" or tplPath == "" then | if jsonStr == "" or tplPath == "" then | ||
return "" | return "" | ||
| Строка 853: | Строка 854: | ||
local okDp, dp = pcall(require, "Module:GetField") | local okDp, dp = pcall(require, "Module:GetField") | ||
local calls = {} | |||
local projectPath = nil | |||
if project ~= nil and project ~= "" then | |||
projectPath = project .. ":" .. tplPath | |||
end | |||
local function makeTemplatePrefix() | |||
if projectPath then | |||
return "{{#ifexist:Шаблон:" .. projectPath .. "|" .. projectPath .. "|" .. tplPath | |||
end | |||
return "{{" .. tplPath | |||
end | |||
local function makeCall(id, obj) | local function makeCall(id, obj) | ||
| Строка 861: | Строка 874: | ||
end | end | ||
local parts = { | local parts = { makeTemplatePrefix(), "id=" .. id } | ||
if type(obj) == "table" then | if type(obj) == "table" then | ||