Модуль:GetField: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 459: | Строка 459: | ||
return raw | return raw | ||
end | |||
local function split_template_spec(tplPath, tplArgs) | |||
tplPath = mw.text.unstripNoWiki(tplPath or "") | |||
tplArgs = normalize_template_args(tplArgs) | |||
if tplArgs == "" then | |||
local pipePos = string.find(tplPath, "|", 1, true) | |||
if pipePos then | |||
tplArgs = normalize_template_args(string.sub(tplPath, pipePos + 1)) | |||
tplPath = string.sub(tplPath, 1, pipePos - 1) | |||
end | |||
end | |||
return tplPath, tplArgs | |||
end | end | ||
| Строка 698: | Строка 713: | ||
tplArgs = args[4] or args.tplArgs or args.templateArgs or "" | tplArgs = args[4] or args.tplArgs or args.templateArgs or "" | ||
end | end | ||
tplPath, tplArgs = split_template_spec(tplPath, tplArgs) | |||
if pagePath == "" or keyPath == "" or tplPath == "" then | if pagePath == "" or keyPath == "" or tplPath == "" then | ||
| Строка 812: | Строка 829: | ||
local tplPath = mw.text.unstripNoWiki(args[3] or "") | local tplPath = mw.text.unstripNoWiki(args[3] or "") | ||
local tplArgs = args[4] or args.tplArgs or args.templateArgs or "" | local tplArgs = args[4] or args.tplArgs or args.templateArgs or "" | ||
tplPath, tplArgs = split_template_spec(tplPath, tplArgs) | |||
if id == "" or pagePath == "" or tplPath == "" then | if id == "" or pagePath == "" or tplPath == "" then | ||
| Строка 837: | Строка 855: | ||
local tplPath = mw.text.unstripNoWiki(args[4] or "") | local tplPath = mw.text.unstripNoWiki(args[4] or "") | ||
local tplArgs = args[5] or args.tplArgs or args.templateArgs or "" | local tplArgs = args[5] or args.tplArgs or args.templateArgs or "" | ||
tplPath, tplArgs = split_template_spec(tplPath, tplArgs) | |||
if searchId == "" or generatorId == "" or tplPath == "" then | if searchId == "" or generatorId == "" or tplPath == "" then | ||
| Строка 992: | Строка 1011: | ||
local tplPath = args[2] or "" | local tplPath = args[2] or "" | ||
local tplArgs = args[3] or args.tplArgs or args.templateArgs or "" | local tplArgs = args[3] or args.tplArgs or args.templateArgs or "" | ||
tplPath, tplArgs = split_template_spec(tplPath, tplArgs) | |||
if pagePath == "" or tplPath == "" then | if pagePath == "" or tplPath == "" then | ||
| Строка 1028: | Строка 1048: | ||
local tplPath = mw.text.unstripNoWiki(args[2] or args.template or "") | local tplPath = mw.text.unstripNoWiki(args[2] or args.template or "") | ||
local tplArgs = normalize_template_args(args[3] or args.tplArgs or args.templateArgs or "") | local tplArgs = normalize_template_args(args[3] or args.tplArgs or args.templateArgs or "") | ||
tplPath, tplArgs = split_template_spec(tplPath, tplArgs) | |||
if jsonStr == "" or tplPath == "" then | if jsonStr == "" or tplPath == "" then | ||