Anonymous user
Module:Delink: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
return false for bad links rather than returning the entire string
(check for characters that are allowed in titles but not in link title areas) |
(return false for bad links rather than returning the entire string) |
||
Line 19:
-- Get display text
if not url_prefix then
return
else
s = mw.ustring.match(s, "^%[" .. url_prefix .. "(.*)%]") -- Grab all of the text after the URL prefix and before the final square bracket.
Line 30:
local function delinkReversePipeTrick(s)
if mw.ustring.match(s, "^%[%[|.*|") then -- Check for multiple pipes.
return
else
return mw.ustring.match(s, "%[%[|(.*)%]%]")
Line 73:
-- Clear the title of the fragment (the section link).
if not mw.title.makeTitle("", titlearea) then
return
end
-- Check for strings that are valid for titles but invalid for wikilinks.
local other_invalid_link_strings = { '�' }
for i,v in ipairs(other_invalid_link_strings) do
if mw.ustring.match(titlearea, v) then
return
end
end
|