Anonymous user
Module:Delink: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
better decoding support
(group the bad characters together) |
(better decoding support) |
||
Line 33:
local function delinkWikilink(s)
-- Deal with the reverse pipe trick.
if mw.ustring.match(
return delinkReversePipeTrick(
end
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local titlearea
if mw.ustring.match(
titlearea = mw.ustring.match(
else
titlearea = mw.ustring.match(
end
-- Check for bad characters.
Line 55 ⟶ 56:
-- Check for categories, interwikis, and files.
local colonprefix = mw.ustring.match(
if mw.language.isKnownLanguageTag(colonprefix)
or mw.ustring.match(colonprefix, "^[Cc]ategory$")
Line 64 ⟶ 65:
-- Remove the colon if the link is using the [[Help:Colon trick]].
if mw.ustring.match(
end
-- Deal with links using the [[Help:Pipe trick]].
if mw.ustring.match(
return delinkPipeTrick(
end
-- Find the display area of the wikilink
if mw.ustring.match(result, "|") then -- Find if we're dealing with a piped link.
▲ local display
-- Remove new lines from the display of multiline piped links,
-- where the pipe is before the first new line.
else
end
return
end
Line 109:
if not url_prefix then
return s
if mw.ustring.match(s_decoded, "%c") then
return s
else
return s_decoded
end
end
|