Module:auto cat: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 146: Line 146:
         local p_lua, p_categories = p_data[1], p_data[2]
         local p_lua, p_categories = p_data[1], p_data[2]
         if mw.ustring.find(category_name, p_lua) ~= nil then
         if mw.ustring.find(category_name, p_lua) ~= nil then
        
         local pre = ""
        --[[
         if mw.ustring.find(category_name, "^Rhymes%:%S+%/%S+$") then
         if mw.ustring.find(category_name, "^Rhymes%:%S+%/%S+$") and mw.site.stats.pagesInCategory(category_name, "pages") > 1 then
        if mw.site.stats.pagesInCategory(category_name, "pages") > 1 then
        -- Add active rhymes category if Rhyme category and also contains more than two terms
        -- Add active rhymes category if Rhyme category and also contains more than two terms
        local p_new = mw.ustring.gsub(category_name, "^Rhymes%:(%S+)%/(%S+)$", "%1 active rhymes|%2")
        local p_new = mw.ustring.gsub(category_name, "^Rhymes%:(%S+)%/(%S+)$", "%1 active rhymes|%2")
        table.insert(p_categories, p_new)
        table.insert(p_categories, p_new)
    ]]--
    else
    if mw.ustring.find(category_name, "^Rhymes%:%S+%/%S+$") and mw.site.stats.pagesInCategory(category_name, "pages") == 1 then
        -- Hide category if only one entry
        -- Hide category if only one entry
        pre = pre .. "__HIDDENCAT__"
        return "__HIDDENCAT__" .. process_category(category_name, p_lua, p_categories)
        end
         end
         end
         -- Process the categories
         -- Process the categories
             return process_category(category_name, p_lua, p_categories)
             return pre .. process_category(category_name, p_lua, p_categories)
         end
         end
     end
     end

Navigation menu