1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-04 14:04:11 +01:00

Clean some DTD-specific strings out of the top-level config namespace.

This commit is contained in:
Kris Maglione
2011-01-16 22:56:39 -05:00
parent ed696fe5c4
commit 9e5edb71f2
2 changed files with 20 additions and 24 deletions

View File

@@ -489,6 +489,7 @@ function call(fn) {
*/
function memoize(obj, key, getter) {
if (arguments.length == 1) {
obj = update({}, obj);
for (let prop in Object.getOwnPropertyNames(obj)) {
let get = objproto.__lookupGetter__.call(obj, prop);
if (get)

View File

@@ -41,9 +41,11 @@ var ConfigBase = Class("ConfigBase", {
this.timeout(function () {
services["dactyl:"].pages.dtd = function () [null,
iter(config.dtdExtra, (["dactyl." + s, config[s]] for each (s in config.dtdStrings)))
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v, /'/g, "&apos;"), "'>"].join(""))
.join("\n")]
iter(config.dtdExtra,
(["dactyl." + k, v] for ([k, v] in iter(config.dtd))),
(["dactyl." + s, config[s]] for each (s in config.dtdStrings)))
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v, /'/g, "&apos;"), "'>"].join(""))
.join("\n")]
});
},
@@ -119,17 +121,20 @@ var ConfigBase = Class("ConfigBase", {
return version;
}),
// TODO: DTD properties. Cleanup.
get home() "http://dactyl.sourceforge.net/",
get apphome() this.home + this.name,
code: "http://code.google.com/p/dactyl/",
get issues() this.home + "bug/" + this.name,
get plugins() "http://dactyl.sf.net/" + this.name + "/plugins",
get faq() this.home + this.name + "/faq",
"list.mailto": Class.memoize(function () config.name + "@googlegroups.com"),
"list.href": Class.memoize(function () "http://groups.google.com/group/" + config.name),
"hg.latest": Class.memoize(function () config.code + "source/browse/"), // XXX
"irc": "irc://irc.oftc.net/#pentadactyl",
dtd: memoize({
get home() "http://dactyl.sourceforge.net/",
get apphome() this.home + this.name,
code: "http://code.google.com/p/dactyl/",
get issues() this.home + "bug/" + this.name,
get plugins() "http://dactyl.sf.net/" + this.name + "/plugins",
get faq() this.home + this.name + "/faq",
"list.mailto": Class.memoize(function () config.name + "@googlegroups.com"),
"list.href": Class.memoize(function () "http://groups.google.com/group/" + config.name),
"hg.latest": Class.memoize(function () this.code + "source/browse/"), // XXX
"irc": "irc://irc.oftc.net/#pentadactyl",
}),
dtdExtra: {
"xmlns.dactyl": "http://vimperator.org/namespaces/liberator",
@@ -142,21 +147,11 @@ var ConfigBase = Class("ConfigBase", {
dtdStrings: [
"appName",
"apphome",
"code",
"faq",
"fileExt",
"hg.latest",
"home",
"host",
"hostbin",
"idName",
"irc",
"issues",
"list.href",
"list.mailto",
"name",
"plugins",
"version"
],