Module:Delink: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(html comments are probably mostly removed by the parser anyway - testing)
(make each parse optional)
Line 138: Line 138:
local function _delink(args)
local function _delink(args)
local text = args[1] or ""
local text = args[1] or ""
if not (args.comments == "no") then
-- text = mw.ustring.gsub(text, "<!%-%-.-%-%->", "") -- Remove html comments.
text = delinkLinkClass(text, "^%[%[.-%]%]", delinkWikilink) -- De-link wikilinks.
text = mw.ustring.gsub(text, "<!%-%-.-%-%->", "") -- Remove html comments.
end
text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
if not (args.wikilinks == "no") then
text = mw.ustring.gsub(text, "%s+", " ") -- Remove extra whitespace.
text = delinkLinkClass(text, "^%[%[.-%]%]", delinkWikilink) -- De-link wikilinks.
end
if not (args.urls == "no") then
text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
end
if not (args.whitespace == "no") then
text = mw.ustring.gsub(text, "%s+", " ") -- Remove extra whitespace.
end
return text
return text
end
end