Module:Delink: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
revert - false values for gsub blank the whole match rather than preserving the string
(try capturing the whole of the pattern, in case it isn't doing this already)
(revert - false values for gsub blank the whole match rather than preserving the string)
Line 19:
-- Get display text
if not url_prefix then
return falses
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 falses
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 falses -- If it's not a valid link, return falsethe whole string.
end
-- Check for strings that are valid for titles but invalid for wikilinks.
Line 79:
for i,v in ipairs(other_invalid_link_strings) do
if mw.ustring.match(titlearea, v) then
return falses
end
end
Line 115:
local function _delink(args)
local text = args[1] or ""
text = mw.ustring.gsub(text, "(%[%[.-%]%])", delinkWikilink)
text = mw.ustring.gsub(text, "(%[.-%])", delinkURL)
return text
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu