Модуль:GetField: различия между версиями

м Замена текста — «GeneratorTplId» на «getAllTpl»
Нет описания правки
Строка 2: Строка 2:


local JsonPaths = require('Module:JsonPaths')
local JsonPaths = require('Module:JsonPaths')
local project = JsonPaths.project()
local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs


Строка 352: Строка 353:


local moduleName = get_module_name(pagePath)
local moduleName = get_module_name(pagePath)
if not data then
data = data or load_cached_data(moduleName)
data = load_cached_data(moduleName)
end
if not data then
if not data then
return ""
return ""
Строка 362: Строка 361:
local extra = flatten_entry(entry)
local extra = flatten_entry(entry)


local tplStr = "{{" .. tostring(tplPath) .. "|id=" .. tostring(id)
local templatePath = tplPath
if project ~= nil and project ~= "" then
templatePath = tplPath .. "/" .. project
templatePath = "{{#ifexist:Шаблон:" .. templatePath .. "|" .. templatePath .. "|" .. tplPath .. "}}"
end
 
local tplStr = "{{" .. templatePath .. "|id=" .. tostring(id)
if extra ~= "" then
if extra ~= "" then
tplStr = tplStr .. "|" .. extra
tplStr = tplStr .. "|" .. extra