Module:auto cat: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 30: Line 30:
local function process_category(category_name, p_lua, p_categories)
local function process_category(category_name, p_lua, p_categories)
     local out = ""
     local out = ""
     local is_s, _, _, s_match = mw.ustring.find(p_lua, "%%s") ~= nil
     local is_s, _, 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 tostring(mw.ustring.gsub(this_cat, "%%s", s_match)) or p_category) .. "]]"
         out = out .. "[[Category:" .. (is_s ~= nil and tostring(mw.ustring.gsub(p_category, "%%s", s_match)) or p_category) .. "]]"
     end
     end
     return out
     return out