Module:auto cat: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 23: Line 23:
-- given data
-- given data
local function to_pattern(pattern, categories)
local function to_pattern(pattern, categories)
     return {"^" .. pattern .. "$", categories}
     return {"^" .. capitalize(pattern) .. "$", categories}
end
end


Line 58: Line 58:
                    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, capitalize(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 66: Line 66:
            table.insert(p_out_cats, capitalize(replace(p_cat, {["%%l"] = l_data.name, ["%%ps"] = pluralize(pos), ["%%p"] = pos})))
            table.insert(p_out_cats, capitalize(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 107: Line 107:
             table.insert(p_out_cats, capitalize(replace(p_cat, {["%%ps"] = pluralize(pos), ["%%p"] = pos})))
             table.insert(p_out_cats, capitalize(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

Navigation menu