10,731
edits
TheNightAvl (talk | contribs) No edit summary Tag: Reverted |
TheNightAvl (talk | contribs) No edit summary Tag: Reverted |
||
Line 88: | Line 88: | ||
local function hydrate_pattern_pos(out_patterns, p_lua, p_categories) | local function hydrate_pattern_pos(out_patterns, p_lua, p_categories) | ||
for _, pos in ipairs(d_pos) do | for l_code, l_data in pairs(d_languages) do | ||
for _, pos in ipairs(d_pos) do | |||
local p_out_cats = {} | |||
for _, p_cat in ipairs(p_categories) do | |||
table.insert(p_out_cats, replace(p_cat, {["%%l"] = l_data.name, ["%%c"] = l_code, ["^%%pos"] = capitalize(pos), ["%%pos"] = pos})) | |||
end | |||
table.insert(out_patterns, to_pattern(replace(p_lua, {["^%%pos"] = capitalize(pos), ["%%pos"] = pos}), p_out_cats)) | |||
end | |||
end | |||
end | end | ||
Line 106: | Line 108: | ||
elseif mw.ustring.find(p_template, "%%c") ~= nil then | elseif mw.ustring.find(p_template, "%%c") ~= nil then | ||
hydrate_pattern_c(out_patterns, p_lua, p_categories) | hydrate_pattern_c(out_patterns, p_lua, p_categories) | ||
elseif mw.ustring.find(p_template, "%%pos") ~= nil then | |||
hydrate_pattern_c(out_patterns, p_lua, p_categories) | |||
else | else | ||
table.insert(out_patterns, to_pattern(p_lua, p_categories)) | table.insert(out_patterns, to_pattern(p_lua, p_categories)) | ||
end | end | ||
end | end | ||
mw.logObject(out_patterns) | |||
return out_patterns | return out_patterns | ||
end | end |