Anonymous user
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
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.
Line 79:
for i,v in ipairs(other_invalid_link_strings) do
if mw.ustring.match(titlearea, v) then
return
end
end
Line 115:
local function _delink(args)
local text = args[1] or ""
text = mw.ustring.gsub(text, "
text = mw.ustring.gsub(text, "
return text
end
|