Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 613: | Строка 613: | ||
local valueReplace = mw.text.unstripNoWiki(args.value_replace or "\\1") | local valueReplace = mw.text.unstripNoWiki(args.value_replace or "\\1") | ||
local | local pairPattern = mw.text.unstripNoWiki(args.pattern or "") | ||
local | local pairReplace = mw.text.unstripNoWiki(args.replace or "\\1") | ||
local out = {} | local out = {} | ||
| Строка 640: | Строка 640: | ||
text = apply_pattern(text, patt, repl) | text = apply_pattern(text, patt, repl) | ||
local line | |||
if outputType == "enum" then | if outputType == "enum" then | ||
line = text | |||
else | else | ||
line = bullet .. text | |||
end | end | ||
if pairPattern ~= "" then | |||
line = apply_pattern(line, pairPattern, pairReplace) | |||
end | |||
table.insert(out, line) | |||
end | end | ||
end | end | ||
| Строка 684: | Строка 691: | ||
if vStr ~= "" then | if vStr ~= "" then | ||
local line | |||
if outputType == "enum" then | if outputType == "enum" then | ||
line = vStr .. " " .. keyStr | |||
else | else | ||
line = bullet .. keyStr .. sep .. vStr | |||
end | end | ||
if pairPattern ~= "" then | |||
line = apply_pattern(line, pairPattern, pairReplace) | |||
end | |||
table.insert(out, line) | |||
end | end | ||
end | end | ||
end | end | ||
if outputType == "enum" then | if outputType == "enum" then | ||
return frame:preprocess(table.concat(out, ", ")) | |||
else | else | ||
return frame:preprocess(table.concat(out, "\n")) | |||
end | end | ||
end | end | ||
return p | return p | ||