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 sfalse
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 sfalse
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 sfalse -- If it's not a valid link, return the whole stringfalse.
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 sfalse
end
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu