Module:auto cat: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
Tag: Reverted
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
        local p_out_cats = {}
for _, pos in ipairs(d_pos) do
        for _, p_cat in ipairs(p_categories) do
        local p_out_cats = {}
            table.insert(p_out_cats, replace(p_cat, {["^%%pos"] = capitalize(pos), ["%%pos"] = pos}))
        for _, p_cat in ipairs(p_categories) do
        end
            table.insert(p_out_cats, replace(p_cat, {["%%l"] = l_data.name, ["%%c"] = l_code, ["^%%pos"] = capitalize(pos), ["%%pos"] = pos}))
        table.insert(out_patterns, to_pattern(replace(p_lua, {["^%%pos"] = capitalize(pos), ["%%pos"] = pos}), p_out_cats))
        end
    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