mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-03 23:05:50 +01:00
Fix dtd generation bug.
This commit is contained in:
@@ -749,12 +749,14 @@ var Options = Module("options", {
|
||||
opt.set(opt.globalValue, Option.SCOPE_GLOBAL, true);
|
||||
}, window);
|
||||
|
||||
function escape(str) str.replace(/[<&]/g, function (m) ({ "&": "&", "<": "<" })[m]);
|
||||
|
||||
services["dactyl:"].pages["options.dtd"] = function () [null,
|
||||
util.makeDTD(
|
||||
iter(([["option", o.name, "default"].join("."),
|
||||
o.type === "string" ? o.defaultValue.replace(/'/g, "''") :
|
||||
o.value === true ? "on" :
|
||||
o.value === false ? "off" : o.stringDefaultValue]
|
||||
escape(o.type === "string" ? o.defaultValue.replace(/'/g, "''") :
|
||||
o.value === true ? "on" :
|
||||
o.value === false ? "off" : o.stringDefaultValue)]
|
||||
for (o in self)),
|
||||
|
||||
([["option", o.name, "type"].join("."), o.type] for (o in self)),
|
||||
|
||||
@@ -975,9 +975,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
},
|
||||
|
||||
makeDTD: function makeDTD(obj) unescape(encodeURI(iter(obj)
|
||||
.map(function ([k, v]) ["<!ENTITY ", k, ' "', String.replace(v == null ? "null" : v, /[&"<%]/g,
|
||||
function (m) ({ '"': """, "&": "&", "<": "<", "%": "%" })[m]),
|
||||
'">'].join(""))
|
||||
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : v, /['%]/g,
|
||||
function (m) ({ "'": "'", "%": "%" })[m]),
|
||||
"'>"].join(""))
|
||||
.join("\n"))),
|
||||
|
||||
map: deprecated("iter.map", function map(obj, fn, self) iter(obj).map(fn, self).toArray()),
|
||||
|
||||
Reference in New Issue
Block a user