Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Resolve category redirect
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} --Returns the target of {{Category redirect}}, if it exists, else returns the original cat. function rtarget( cat ) local catcontent = mw.title.new( cat or '', 'Category' ):getContent() if string.match( catcontent or '', '{{ *[Cc]at' ) then local regex = { --the following 11 pages (6 condensed) redirect to [[Template:Category redirect]], in descending order, as of 9/2022: '{{ *[Cc]ate?g?o?r?y?[ _]*[rR]edirect', --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 } for _, v in pairs (regex) do local rtarget = mw.ustring.match( catcontent, v..'%s*|%s*([^|}]+)' ) if rtarget then rtarget = mw.ustring.gsub(rtarget, '^1%s*=%s*', '') rtarget = string.gsub(rtarget, '^[Cc]ategory:', '') return rtarget end end end return cat end function p.main( frame ) local args = frame:getParent().args local cat = args[1] if (cat == '') or (cat == nil) then return '' end return rtarget( cat ) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Resolve category redirect/doc
(
edit
)
Module:Resolve category redirect/doc
(
edit
)