10,731
edits
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
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 | 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:" .. (is_s and replace(p_category, {["^%%s"] = capitalize(s_match), ["%%s"] = s_match}) or p_category) .. "]]" | ||
end | end | ||
return out | return out | ||
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 | ||
--[[ | |||
if mw.ustring.find(category_name, "^Rhymes%:%S+%/%S+$") and mw.site.stats.pagesInCategory(category_name, "pages") > 1 then | |||
-- 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") | |||
table.insert(p_categories, p_new) | |||
]]-- | |||
if mw.ustring.find(category_name, "^Rhymes%:%S+%/%S+$") and mw.site.stats.pagesInCategory(category_name, "pages") < 2 then | |||
-- Hide category if only one entry | |||
local return_cat = mw.ustring.gsub(category_name, "^Rhymes%:(%S+)%/%S+$", "__HIDDENCAT__\n[[Category:%1 inactive rhymes]]") | |||
return return_cat | |||
end | |||
-- Process the categories | |||
return process_category(category_name, p_lua, p_categories) | return process_category(category_name, p_lua, p_categories) | ||
end | end |