Модуль:GetField: различия между версиями
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
Pok (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
||
| Строка 1: | Строка 1: | ||
local p = {} | local p = {} | ||
local JsonPaths = require('Module:JsonPaths') | local JsonPaths = require('Module:JsonPaths') | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
| Строка 354: | Строка 352: | ||
local moduleName = get_module_name(pagePath) | local moduleName = get_module_name(pagePath) | ||
data = | if not data then | ||
data = load_cached_data(moduleName) | |||
end | |||
if not data then | if not data then | ||
return "" | return "" | ||
| Строка 362: | Строка 362: | ||
local extra = flatten_entry(entry) | local extra = flatten_entry(entry) | ||
local | local tplStr = "{{" .. tostring(tplPath) .. "|id=" .. tostring(id) | ||
if extra ~= "" then | if extra ~= "" then | ||
tplStr = tplStr .. "|" .. extra | tplStr = tplStr .. "|" .. extra | ||
| Строка 844: | Строка 838: | ||
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 "" | ||
| Строка 855: | Строка 848: | ||
local okDp, dp = pcall(require, "Module:GetField") | local okDp, dp = pcall(require, "Module:GetField") | ||
local calls = {} | local calls = {} | ||
local function makeCall(id, obj) | local function makeCall(id, obj) | ||
| Строка 875: | Строка 856: | ||
end | end | ||
local parts = { | local parts = { "{{" .. tplPath, "id=" .. id } | ||
if type(obj) == "table" then | if type(obj) == "table" then | ||