Anonymous user
Module:Delink: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
move the colon trick processing to earlier in the chain
(move cat/interwiki/file check earlier to the start of the processing chain) |
(move the colon trick processing to earlier in the chain) |
||
Line 14:
-- We need to deal with colons, brackets, and commas, per [[Help:Pipe trick]].
-- First,
if mw.ustring.match(s, ":") then
s = mw.ustring.match(s,
-- Check for the [[Help:Colon trick]].▼
if mw.ustring.match(s, "%[%[:") then▼
s = mw.ustring.match(s, "%[%[:.-:(.*)|%]%]")▼
end▼
-- If there are no colons, grab all of the text apart from the square brackets and the pipe.
else
Line 40 ⟶ 31:
end
local function delinkOne(
-- First, check for categories, interwikis, and files.
local colonprefix = mw.ustring.match(
if mw.language.isKnownLanguageTag(colonprefix)
or mw.ustring.match(colonprefix, "^[Cc]ategory$")
Line 49 ⟶ 40:
return ""
end
if mw.ustring.match(text, "[^|].*|%]%]") or mw.ustring.match(text, "%[%[|") then -- Weed out the pipe tricks first.▼
return delinkPipeTrick(text)▼
▲ if mw.ustring.match(
end
-- Find the link area and display area of the wikilink
local linkarea, display
if mw.ustring.match(
linkarea, display = mw.ustring.match(
else
-- If the link isn't piped, the display area and the link area are the same.
linkarea = mw.ustring.match(
display = linkarea
end
|