mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-04 05:15:46 +01:00
Make INFO work from *.penta files.
This commit is contained in:
@@ -413,7 +413,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
({ file: fileName, line: lineNumber, context: ctxt }) = info;
|
({ file: fileName, line: lineNumber, context: ctxt }) = info;
|
||||||
|
|
||||||
if (!context && fileName && fileName[0] !== "[")
|
if (!context && fileName && fileName[0] !== "[")
|
||||||
context = _userContext || ctxt;
|
context = ctxt || _userContext;
|
||||||
|
|
||||||
if (isinstance(context, ["Sandbox"]))
|
if (isinstance(context, ["Sandbox"]))
|
||||||
return Cu.evalInSandbox(str, context, "1.8", fileName, lineNumber);
|
return Cu.evalInSandbox(str, context, "1.8", fileName, lineNumber);
|
||||||
@@ -668,20 +668,30 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
let body = XML();
|
let body = XML();
|
||||||
for (let [, context] in Iterator(plugins.contexts))
|
for (let [, context] in Iterator(plugins.contexts))
|
||||||
if (context && context.INFO instanceof XML) {
|
try {
|
||||||
let info = context.INFO;
|
let info;
|
||||||
if (info.*.@lang.length()) {
|
if (isinstance(context, ["Sandbox"]))
|
||||||
let lang = config.bestLocale(String(a) for each (a in info.*.@lang));
|
info = "INFO" in context && XML(dactyl.userEval("this.INFO instanceof XML && this.INFO.toXMLString()", context));
|
||||||
|
else if (context && context.INFO instanceof XML)
|
||||||
|
info = context.INFO;
|
||||||
|
|
||||||
info.* = info.*.(function::attribute("lang").length() == 0 || @lang == lang);
|
if (info) {
|
||||||
|
if (info.*.@lang.length()) {
|
||||||
|
let lang = config.bestLocale(String(a) for each (a in info.*.@lang));
|
||||||
|
|
||||||
for each (let elem in info.NS::info)
|
info.* = info.*.(function::attribute("lang").length() == 0 || @lang == lang);
|
||||||
for each (let attr in ["@name", "@summary", "@href"])
|
|
||||||
if (elem[attr].length())
|
for each (let elem in info.NS::info)
|
||||||
info[attr] = elem[attr];
|
for each (let attr in ["@name", "@summary", "@href"])
|
||||||
|
if (elem[attr].length())
|
||||||
|
info[attr] = elem[attr];
|
||||||
|
}
|
||||||
|
body += <h2 xmlns={NS.uri} tag={info.@name + '-plugin'}>{info.@summary}</h2> +
|
||||||
|
info;
|
||||||
}
|
}
|
||||||
body += <h2 xmlns={NS.uri} tag={context.INFO.@name + '-plugin'}>{context.INFO.@summary}</h2> +
|
}
|
||||||
context.INFO;
|
catch (e) {
|
||||||
|
util.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
let help =
|
let help =
|
||||||
|
|||||||
@@ -316,6 +316,11 @@ var File = Class("File", {
|
|||||||
return self;
|
return self;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {nsIFileURL} Returns the nsIFileURL object for this file.
|
||||||
|
*/
|
||||||
|
get URI() services.io.newFileURI(this),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over the objects in this directory.
|
* Iterates over the objects in this directory.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user