Changes
Jump to navigation
Jump to search
--[[
This is a clone of mw.text.nowiki. When the mw.text library is installed,
this can be replaced by a call to that library. ]]
function nowiki( s )
-- string.gsub is safe here, because we're only caring about ASCII chars
s = string.gsub( s, '["&\'<=>%[%]{|}]', {
['"'] = '"',
['&'] = '&',
["'"] = ''',
['<'] = '<',
['='] = '=',
['>'] = '>',
['['] = '[',
[']'] = ']',
['{'] = '{',
['|'] = '|',
['}'] = '}',
} )
s = string.sub( string.gsub( '\n' .. s, '\n[#*:;]', {
["\n#"] = "\n#",
["\n*"] = "\n*",
["\n:"] = "\n:",
["\n;"] = "\n;",
} ), 2 )
s = string.gsub( s, '://', '://' )
s = string.gsub( s, 'ISBN ', 'ISBN ' )
s = string.gsub( s, 'RFC ', 'RFC ' )
return s
end
The "mw.text" library was installed years ago
end
function externallinkid(args)
local t0 = onlyinprint(args.label .. sep .. args.id)
local t1 = hideinprint("[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[" .. args.prefix .. url_string .. args.suffix .. " " .. mw.text. nowiki(args.id) .. "]")
return t0 .. t1