Module:Template redirect regex: Difference between revisions
From Neodyland Wiki
More actions
-non-existing taxonbar |
+regexs for Commons |
||
| Line 8: | Line 8: | ||
local tCanonical_templates = { | local tCanonical_templates = { | ||
['Category redirect'] = { | ['Category redirect'] = { | ||
--the following 11 pages (6 condensed) redirect to [[Template:Category redirect]], as of 2022/9: | -- the following 11 pages (6 condensed) redirect to [[Template:Category redirect]], as of 2022/9: | ||
-- Commons June 2024: 12 | |||
-- https://commons.wikimedia.org/wiki/Special:WhatLinksHere?target=Template%3ACategory+redirect&namespace=&hidetrans=1&hidelinks=1 | |||
'{{ *[Cc]ate?g?o?r?y?[ _]*[rR]edirect', --parent+505+312+243+1 transclusions | '{{ *[Cc]ate?g?o?r?y?[ _]*[rR]edirect', --parent+505+312+243+1 transclusions | ||
'{{ *[Cc]atr', --21 | '{{ *[Cc]atr', --21 | ||
'{{ *[Cc]at[ _]*[rR]edir', --5+3 | '{{ *[Cc]at[ _]*[rR]edir', --5+3 | ||
'{{ *[Cc]at[ _]*[rR]ed', --3+2 | '{{ *[Cc]at[ _]*[rR]ed', --3+2 | ||
'{{ *[Cc]at[ _]*[ | '{{ *[Ss]ee[ _]?cat', | ||
'{{ *[Cc]ategory[ _]*[ | '{{ *[Cc]ategoryredirect', | ||
'{{ *[Cc]at[ _]?redirect', | |||
'{{ *[Cc]atredir', | |||
'{{ *[Rr]edirect[ _]category', | |||
'{{ *[Cc]at-?red', | |||
'{{ *[Rr]edirect[ _]cat', | |||
'{{ *[Cc]ategory[ _]Redirect', | |||
'{{ *[Cc]at-redirect', | |||
}, | }, | ||
Revision as of 07:22, 4 June 2024
This documentation is transcluded from Module:Template redirect regex/doc.
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 format
local tCanonical_templates = {
['Category redirect'] = {
-- the following 11 pages (6 condensed) redirect to [[Template:Category redirect]], as of 2022/9:
-- Commons June 2024: 12
-- https://commons.wikimedia.org/wiki/Special:WhatLinksHere?target=Template%3ACategory+redirect&namespace=&hidetrans=1&hidelinks=1
'{{ *[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
'{{ *[Ss]ee[ _]?cat',
'{{ *[Cc]ategoryredirect',
'{{ *[Cc]at[ _]?redirect',
'{{ *[Cc]atredir',
'{{ *[Rr]edirect[ _]category',
'{{ *[Cc]at-?red',
'{{ *[Rr]edirect[ _]cat',
'{{ *[Cc]ategory[ _]Redirect',
'{{ *[Cc]at-redirect',
},
}
return tCanonical_templates[template] or nil
end
return p