mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-29 02:02:28 +01:00
Fix yanking bug, and less sucky literal() parsing.
--HG-- extra : rebase_source : 94698268ac8c138de45088f77ecb8bffa5169da0
This commit is contained in:
@@ -150,19 +150,24 @@ this.lazyRequire("services", ["services"]);
|
||||
this.lazyRequire("storage", ["File"]);
|
||||
this.lazyRequire("util", ["FailedAssertion", "util"]);
|
||||
|
||||
literal.files = {};
|
||||
literal.locations = {};
|
||||
function literal(/* comment */) {
|
||||
let { caller } = Components.stack;
|
||||
while (caller && caller.language != 2)
|
||||
caller = caller.caller;
|
||||
|
||||
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) + "}" +
|
||||
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
|
||||
return match[1];
|
||||
return literal.locations[key] = match[1];
|
||||
|
||||
// Later...
|
||||
return cache.get(key, function () {
|
||||
|
||||
@@ -644,9 +644,10 @@ var Buffer = Module("Buffer", {
|
||||
}
|
||||
|
||||
let link = DOM("link[href][rev=canonical], \
|
||||
link[href][rel=shortlink]", doc);
|
||||
if (link.length)
|
||||
return hashify(link.attr("href"));
|
||||
link[href][rel=shortlink]", doc)
|
||||
.attr("href");
|
||||
if (link)
|
||||
return hashify(link);
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user