Module:auto cat: Difference between revisions

Jump to navigation Jump to search
m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
mNo edit summary
Tag: Reverted
Line 56: Line 56:
                    local p_out_cats = {}
                    local p_out_cats = {}
                    for _, p_cat in ipairs(p_categories) do
                    for _, p_cat in ipairs(p_categories) do
                    table.insert(p_out_cats, capitalize(replace(p_cat, {["%%l"] = l_data.name, ["%%u"] = l2_data.name, ["%%ps"] = pluralize(pos), ["%%p"] = pos})))
                    table.insert(p_out_cats, replace(p_cat, {["%%l"] = l_data.name, ["%%u"] = l2_data.name, ["%%ps"] = pluralize(pos), ["%%p"] = pos}))
                    end
                    end
                    table.insert(out_patterns, to_pattern(capitalize(replace(p_lua, {["%%l"] = sanitize(l_data.name), ["%%u"] = sanitize(l2_data.name), ["%%ps"] = pluralize(pos), ["%%p"] = pos})), p_out_cats))
                    table.insert(out_patterns, to_pattern(replace(p_lua, {["%%l"] = sanitize(l_data.name), ["%%u"] = sanitize(l2_data.name), ["%%ps"] = pluralize(pos), ["%%p"] = pos}), p_out_cats))
                end
                end
            end
            end
Line 64: Line 64:
            local p_out_cats = {}
            local p_out_cats = {}
            for _, p_cat in ipairs(p_categories) do
            for _, p_cat in ipairs(p_categories) do
            table.insert(p_out_cats, capitalize(replace(p_cat, {["%%l"] = l_data.name, ["%%ps"] = pluralize(pos), ["%%p"] = pos})))
            table.insert(p_out_cats, replace(p_cat, {["%%l"] = l_data.name, ["%%ps"] = pluralize(pos), ["%%p"] = pos}))
            end
            end
            table.insert(out_patterns, to_pattern(capitalize(replace(p_lua, {["%%l"] = sanitize(l_data.name), ["%%ps"] = pluralize(pos), ["%%p"] = pos})), p_out_cats))
            table.insert(out_patterns, to_pattern(replace(p_lua, {["%%l"] = sanitize(l_data.name), ["%%ps"] = pluralize(pos), ["%%p"] = pos}), p_out_cats))
        end
        end
     end
     end
Line 105: Line 105:
     local p_out_cats = {}
     local p_out_cats = {}
         for _, p_cat in ipairs(p_categories) do
         for _, p_cat in ipairs(p_categories) do
             table.insert(p_out_cats, capitalize(replace(p_cat, {["%%ps"] = pluralize(pos), ["%%p"] = pos})))
             table.insert(p_out_cats, replace(p_cat, {["%%ps"] = pluralize(pos), ["%%p"] = pos}))
         end
         end
         table.insert(out_patterns, to_pattern(capitalize(replace(p_lua, {["%%ps"] = pluralize(pos), ["%%p"] = pos})), p_out_cats))
         table.insert(out_patterns, to_pattern(replace(p_lua, {["%%ps"] = pluralize(pos), ["%%p"] = pos}), p_out_cats))
end
end
end
end
Line 123: Line 123:
             hydrate_pattern_p(out_patterns, p_lua, p_categories)
             hydrate_pattern_p(out_patterns, p_lua, p_categories)
         else
         else
             table.insert(out_patterns, to_pattern(capitalize(p_lua, p_categories)))
             table.insert(out_patterns, to_pattern(p_lua, p_categories))
         end
         end
     end
     end
Line 134: Line 134:
     local _, _, s_match = mw.ustring.find(category_name, p_lua)
     local _, _, s_match = mw.ustring.find(category_name, p_lua)
     for _, p_category in ipairs(p_categories) do
     for _, p_category in ipairs(p_categories) do
         out = out .. "[[Category:" .. (is_s and replace(p_category, {["%%s"] = s_match}) or p_category) .. "]]"
         out = out .. "[[Category:" .. capitalize(is_s and replace(p_category, {["%%s"] = s_match}) or p_category) .. "]]"
     end
     end
     return out
     return out

Navigation menu