1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 17:54:13 +01:00

Fix yanking bug, and less sucky literal() parsing.

--HG--
extra : rebase_source : 94698268ac8c138de45088f77ecb8bffa5169da0
This commit is contained in:
Kris Maglione
2013-11-29 18:43:06 -08:00
parent da049fa175
commit c26a486ab3
3 changed files with 13 additions and 7 deletions

View File

@@ -150,19 +150,24 @@ this.lazyRequire("services", ["services"]);
this.lazyRequire("storage", ["File"]); this.lazyRequire("storage", ["File"]);
this.lazyRequire("util", ["FailedAssertion", "util"]); this.lazyRequire("util", ["FailedAssertion", "util"]);
literal.files = {};
literal.locations = {};
function literal(/* comment */) { function literal(/* comment */) {
let { caller } = Components.stack; let { caller } = Components.stack;
while (caller && caller.language != 2) while (caller && caller.language != 2)
caller = caller.caller; caller = caller.caller;
let file = caller.filename.replace(/.* -> /, ""); let file = caller.filename.replace(/.* -> /, "");
let key = "literal:" + file + ":" + caller.line; let key = "literal:" + file + ":" + caller.lineNumber;
if (Set.has(literal.locations, key))
return literal.locations[key];
let source = File.readURL(file); let source = literal.files[file] || File.readURL(file);
literal.files[file] = source;
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" + let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source); ".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
return match[1]; return literal.locations[key] = match[1];
// Later... // Later...
return cache.get(key, function () { return cache.get(key, function () {

View File

@@ -644,9 +644,10 @@ var Buffer = Module("Buffer", {
} }
let link = DOM("link[href][rev=canonical], \ let link = DOM("link[href][rev=canonical], \
link[href][rel=shortlink]", doc); link[href][rel=shortlink]", doc)
if (link.length) .attr("href");
return hashify(link.attr("href")); if (link)
return hashify(link);
return null; return null;
}, },

View File

@@ -31,7 +31,7 @@
<em:targetApplication> <em:targetApplication>
<Description <Description
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
em:minVersion="24.0" em:minVersion="22.0"
em:maxVersion="25.*"/> em:maxVersion="25.*"/>
</em:targetApplication> </em:targetApplication>
</Description> </Description>