1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 22:07:59 +01:00

More stuff.

This commit is contained in:
Kris Maglione
2011-07-26 21:25:37 -04:00
parent cff57155e6
commit 969cdfc5dc
4 changed files with 11 additions and 11 deletions

View File

@@ -238,7 +238,7 @@ var Modes = Module("modes", {
return <></>; return <></>;
} }
return rec(roots).toXMLString(); return rec(roots);
} }
util.timeout(function () { util.timeout(function () {

View File

@@ -215,8 +215,8 @@ var ConfigBase = Class("ConfigBase", {
"xmlns.html": "http://www.w3.org/1999/xhtml", "xmlns.html": "http://www.w3.org/1999/xhtml",
"xmlns.xul": "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "xmlns.xul": "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"tag.command-line": '<link topic="command-line">command line</link>', "tag.command-line": <link topic="command-line">command line</link>,
"tag.status-line": '<link topic="status-line">status line</link>', "tag.status-line": <link topic="status-line">status line</link>,
}, },
dtdStrings: [ dtdStrings: [

View File

@@ -756,14 +756,12 @@ var Options = Module("options", {
opt.set(opt.globalValue, Option.SCOPE_GLOBAL, true); opt.set(opt.globalValue, Option.SCOPE_GLOBAL, true);
}, window); }, window);
function escape(str) str.replace(/[<&]/g, function (m) ({ "&": "&amp;", "<": "&lt;" })[m]);
services["dactyl:"].pages["options.dtd"] = function () [null, services["dactyl:"].pages["options.dtd"] = function () [null,
util.makeDTD( util.makeDTD(
iter(([["option", o.name, "default"].join("."), iter(([["option", o.name, "default"].join("."),
escape(o.type === "string" ? o.defaultValue.replace(/'/g, "''") : o.type === "string" ? o.defaultValue.replace(/'/g, "''") :
o.value === true ? "on" : o.value === true ? "on" :
o.value === false ? "off" : o.stringDefaultValue)] o.value === false ? "off" : o.stringDefaultValue]
for (o in self)), for (o in self)),
([["option", o.name, "type"].join("."), o.type] for (o in self)), ([["option", o.name, "type"].join("."), o.type] for (o in self)),

View File

@@ -1080,9 +1080,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @returns {string} The DTD fragment containing entity declaration * @returns {string} The DTD fragment containing entity declaration
* for *obj*. * for *obj*.
*/ */
makeDTD: function makeDTD(obj) iter(obj) makeDTD: let (map = { "'": "&apos;", '"': "&quot;", "%": "&#x25;", "&": "&amp;", "<": "&lt;", ">": "&gt;" })
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : v, /['%]/g, function makeDTD(obj) iter(obj)
function (m) ({ "'": "&apos;", "%": "&#x25;" })[m]), .map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : typeof v == "xml" ? v.toXMLString() : v,
typeof v == "xml" ? /['%]/g : /['"%&<>]/g,
function (m) map[m]),
"'>"].join("")) "'>"].join(""))
.join("\n"), .join("\n"),