diff --git a/common/content/commands.js b/common/content/commands.js index da1d0c4a..30e1d921 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -1175,23 +1175,23 @@ const Commands = Module("commands", { Commands.quoteMap = { "\n": "\\n", "\t": "\\t", - "'": "''" }; - function quote(q, list) { + function quote(q, list, map) { + map = map || Commands.quoteMap; let re = RegExp("[" + list + "]", "g"); - let res = function (str) q + String.replace(str, re, function ($0) $0 in Commands.quoteMap ? Commands.quoteMap[$0] : ("\\" + $0)) + q; + let res = function (str) q + String.replace(str, re, function ($0) $0 in map ? map[$0] : ("\\" + $0)) + q; res.list = list; return res; }; Commands.complQuote = { '"': ['"', quote("", '\n\t"\\\\'), '"'], - "'": ["'", quote("", "'"), "'"], + "'": ["'", quote("", "'", { "'": "''" }), "'"], "": ["", quote("", "\\\\ '\""), ""] }; Commands.quoteArg = { '"': quote('"', '\n\t"\\\\'), - "'": quote("'", "'"), + "'": quote("'", "'", { "'": "''" }), "": quote("", "\\\\\\s'\"") }; diff --git a/common/content/options.js b/common/content/options.js index d6e49667..7cf4de20 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -1169,6 +1169,7 @@ const Options = Module("options", { [option.value, "Current value"], [option.defaultValue, "Default value"] ].filter(function (f) f[0] !== "" && String(f[0]).length < 200); + context.quote = ["", util.identity, ""]; }); }