Anonymous user
Module:Delink: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
use pcall and mw.title.new to check for valid titles
(remove extra whitespace) |
(use pcall and mw.title.new to check for valid titles) |
||
Line 67:
local titlearea
if mw.ustring.match(s, "|") then -- Find if we're dealing with a piped link.
titlearea = mw.ustring.match(s, "^%[%[(.-)|.*%]%]")
else
titlearea = mw.ustring.match(s, "^%[%[(.-)%]%]")
end
--
-- Use pcall in case we're over the expensive functions limit.
local goodcall, title = pcall(mw.title.new, titlearea, "")
if not (goodcall and title) then
return s
end
-- Check for characters that are allowed in titles but not in wikilinks.
local other_invalid_link_strings = { '�' }
for i,v in ipairs(other_invalid_link_strings) do
|