Module:Delink: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(deal with categories/interwikis and the colon trick) |
(move cat/interwiki/file check earlier to the start of the processing chain) |
||
Line 16: | Line 16: | ||
-- First, we check whether or not there are colons in the link, and trim it accordingly. |
-- First, we check whether or not there are colons in the link, and trim it accordingly. |
||
if mw.ustring.match(s, ":") then |
if mw.ustring.match(s, ":") then |
||
-- If the link contains a colon, it could be a category or an interwiki, |
|||
-- or it could use the [[Help:Colon trick]]. |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
-- Check for the |
-- Check for the [[Help:Colon trick]]. |
||
if mw.ustring.match(s, "%[%[:") then |
|||
s = mw.ustring.match(s, "%[%[:.-:(.*)|%]%]") |
s = mw.ustring.match(s, "%[%[:.-:(.*)|%]%]") |
||
Line 48: | Line 41: | ||
local function delinkOne(text) |
local function delinkOne(text) |
||
⚫ | |||
⚫ | |||
if mw.language.isKnownLanguageTag(colonprefix) |
|||
⚫ | |||
or mw.ustring.match(colonprefix, "^[Ff]ile$") |
|||
or mw.ustring.match(colonprefix, "^[Ii]mage$") then |
|||
⚫ | |||
⚫ | |||
if mw.ustring.match(text, "[^|].*|%]%]") or mw.ustring.match(text, "%[%[|") then -- Weed out the pipe tricks first. |
if mw.ustring.match(text, "[^|].*|%]%]") or mw.ustring.match(text, "%[%[|") then -- Weed out the pipe tricks first. |
||
return delinkPipeTrick(text) |
return delinkPipeTrick(text) |