Module:Template redirect regex/sandbox
Appearance
This is the module sandbox page for Module:Template redirect regex (diff). |
This Lua module is used on approximately 987,000 pages, or roughly 2% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
About
[edit]For use within other modules.
Returns a table of regular expressions, sorted by descending popularity, for a parent template and all redirects to it as of a certain date, or nil.
See also
[edit]local p = {}
--returns a table of regular expressions, sorted by descending popularity, for a parent template and all redirects to it as of a certain date, or nil
--regex for the 1st pipe and surrounding whitespace are purposefully omitted to give the calling modules more flexibility
function p.main( template )
--expand the following table as-needed, following the same regex and comment format
local tCanonical_templates = {
['Category redirect'] = {
--the following 11 pages (6 condensed) redirect to {{Category redirect}}, as of 2022/9:
'{{ *[Cc]ate?g?o?r?y?[ _]*[rR]edirect', --parent+505+312+243+1 transclusions
'{{ *[Cc]atr', --21
'{{ *[Cc]at[ _]*[rR]edir', --5+3
'{{ *[Cc]at[ _]*[rR]ed', --3+2
'{{ *[Cc]at[ _]*[mM]ove', --1
'{{ *[Cc]ategory[ _]*[mM]ove', --0
},
['Taxonbar'] = {
--the following 6 pages (3 condensed) redirect to {{Taxonbar}}, as of 2023/8:
'{{ *[Tt]axon?[ _-]?[bB]ar', --parent+50+11+2+2 transclusions
'{{ *[Tt]axon[Ii]ds', --45
'{{ *[Tt]axon[ _]*[iI]dentifiers', --1
},
}
return tCanonical_templates[template] or nil
end
return p