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:
-- First, we check whether or not there are colons in the link, and trim it accordingly.
if mw.ustring.match(s, ":") then
-- Check for categories and interwikis.▼
local colonprefix = mw.ustring.match(s, "%[%[(.-):.*|%]%]") or "" -- Get the text before the first colon.▼
if mw.language.isKnownLanguageTag(colonprefix) or mw.ustring.match(colonprefix, "^[Cc]ategory$") then▼
s = ""▼
-- Check for the
s = mw.ustring.match(s, "%[%[:.-:(.*)|%]%]")
Line 48 ⟶ 41:
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.
return delinkPipeTrick(text)
|