45,646
edits
No edit summary |
No edit summary |
||
Line 60: | Line 60: | ||
(indicating a missing code). If `not_real_lang` is given, this check is suppressed. | (indicating a missing code). If `not_real_lang` is given, this check is suppressed. | ||
]=] | ]=] | ||
-- Convert risky characters to HTML entities, which minimizes interference once returned (e.g. for "sms:a", "<!-- -->" etc.). | |||
local function escape_risky_characters(text) | |||
local encode_entities = require("Module:string/encode entities") | |||
-- Spacing characters in isolation generally need to be escaped in order to be properly processed by the MediaWiki software. | |||
if umatch(text, "^%s*$") then | |||
return encode_entities(text, text) | |||
else | |||
return encode_entities(text, "!#%&*+/:;<=>?@[\\]_{|}") | |||
end | |||
end | |||
-- Process carets (and any escapes). Default to simple removal, if no pattern/replacement is given. | -- Process carets (and any escapes). Default to simple removal, if no pattern/replacement is given. |