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

Automagically tagify index entries without existing help tags rather than eliding them entirely.

This commit is contained in:
Kris Maglione
2011-02-20 16:50:40 -05:00
parent 67079b8f54
commit 12c8074057
2 changed files with 14 additions and 6 deletions

View File

@@ -213,9 +213,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let results = array((params.iterateIndex || params.iterate).call(params, commands.get(name).newArgs())) let results = array((params.iterateIndex || params.iterate).call(params, commands.get(name).newArgs()))
.array.sort(function (a, b) String.localeCompare(a.name, b.name)); .array.sort(function (a, b) String.localeCompare(a.name, b.name));
for (let obj in values(results)) for (let obj in values(results)) {
if (obj.helpTag in services["dactyl:"].HELP_TAGS) let res = dactyl.generateHelp(obj, null, null, true);
yield dactyl.generateHelp(obj, null, null, true); if (!set.has(services["dactyl:"].HELP_TAGS, obj.helpTag))
res[1].@tag = obj.helpTag;
yield res;
}
}; };
}, },
@@ -786,6 +790,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
]; ];
} }
addTags("versions", util.httpGet("dactyl://help/versions").responseXML); addTags("versions", util.httpGet("dactyl://help/versions").responseXML);
addTags("plugins", util.httpGet("dactyl://help/plugins").responseXML);
default xml namespace = NS; default xml namespace = NS;
@@ -799,7 +804,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}</dl>, <>{"\n\n"}</>))) + }</dl>, <>{"\n\n"}</>))) +
'\n</overlay>']; '\n</overlay>'];
addTags("plugins", util.httpGet("dactyl://help/plugins").responseXML); addTags("index", util.httpGet("dactyl://help/index").responseXML);
this.helpInitialized = true; this.helpInitialized = true;
} }
}, },
@@ -969,7 +975,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
template.linkifyHelp(obj.description ? obj.description.replace(/\.$/, "") : "", true) template.linkifyHelp(obj.description ? obj.description.replace(/\.$/, "") : "", true)
}</dd></res>; }</dd></res>;
if (specOnly) if (specOnly)
return res.*; return res.elements();
res.* += <> res.* += <>
<item> <item>

View File

@@ -12,7 +12,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("commands", { defineModule("commands", {
exports: ["ArgType", "Command", "Commands", "CommandOption", "Ex", "commands"], exports: ["ArgType", "Command", "Commands", "CommandOption", "Ex", "commands"],
require: ["contexts"], require: ["contexts"],
use: ["config", "options", "template", "util"] use: ["config", "options", "services", "template", "util"]
}, this); }, this);
/** /**
@@ -1540,6 +1540,8 @@ var Commands = Module("commands", {
cmd.hive == commands.builtin ? "" : <span highlight="Object" style="padding-right: 1em;">{cmd.hive.name}</span> cmd.hive == commands.builtin ? "" : <span highlight="Object" style="padding-right: 1em;">{cmd.hive.name}</span>
] ]
})), })),
iterateIndex: function (args) let (tags = services["dactyl:"].HELP_TAGS)
this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || set.has(cmd.helpTag)),
format: { format: {
headings: ["Command", "Group", "Description"], headings: ["Command", "Group", "Description"],
description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")), description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")),