mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 23:57:59 +01:00
Better dactyl: charset handling. Fix some option completion issues.
This commit is contained in:
@@ -248,7 +248,7 @@ function LocaleChannel(pkg, path, orig) {
|
|||||||
|
|
||||||
function StringChannel(data, contentType, uri) {
|
function StringChannel(data, contentType, uri) {
|
||||||
let channel = services.StreamChannel(uri);
|
let channel = services.StreamChannel(uri);
|
||||||
channel.contentStream = services.StringStream(data);
|
channel.contentStream = services.CharsetConv("UTF-8").convertToInputStream(data);
|
||||||
if (contentType)
|
if (contentType)
|
||||||
channel.contentType = contentType;
|
channel.contentType = contentType;
|
||||||
channel.contentCharset = "UTF-8";
|
channel.contentCharset = "UTF-8";
|
||||||
|
|||||||
@@ -686,14 +686,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
'<?xml version="1.0"?>\n' +
|
'<?xml version="1.0"?>\n' +
|
||||||
'<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
|
'<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
|
||||||
'<!DOCTYPE document SYSTEM "resource://dactyl-content/dactyl.dtd">\n' +
|
'<!DOCTYPE document SYSTEM "resource://dactyl-content/dactyl.dtd">\n' +
|
||||||
unescape(encodeURI( // UTF-8 handling hack.
|
|
||||||
<document xmlns={NS}
|
<document xmlns={NS}
|
||||||
name="plugins" title={config.appName + " Plugins"}>
|
name="plugins" title={config.appName + " Plugins"}>
|
||||||
<h1 tag="using-plugins">{_("help.title.Using Plugins")}</h1>
|
<h1 tag="using-plugins">{_("help.title.Using Plugins")}</h1>
|
||||||
<toc start="2"/>
|
<toc start="2"/>
|
||||||
|
|
||||||
{body}
|
{body}
|
||||||
</document>.toXMLString()));
|
</document>.toXMLString();
|
||||||
fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help];
|
fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help];
|
||||||
|
|
||||||
fileMap["versions"] = function () {
|
fileMap["versions"] = function () {
|
||||||
@@ -792,14 +791,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
'<?xml version="1.0"?>\n' +
|
'<?xml version="1.0"?>\n' +
|
||||||
'<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
|
'<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
|
||||||
'<!DOCTYPE document SYSTEM "resource://dactyl-content/dactyl.dtd">\n' +
|
'<!DOCTYPE document SYSTEM "resource://dactyl-content/dactyl.dtd">\n' +
|
||||||
unescape(encodeURI( // UTF-8 handling hack.
|
|
||||||
<document xmlns={NS} xmlns:dactyl={NS}
|
<document xmlns={NS} xmlns:dactyl={NS}
|
||||||
name="versions" title={config.appName + " Versions"}>
|
name="versions" title={config.appName + " Versions"}>
|
||||||
<h1 tag="versions news NEWS">{config.appName} Versions</h1>
|
<h1 tag="versions news NEWS">{config.appName} Versions</h1>
|
||||||
<toc start="2"/>
|
<toc start="2"/>
|
||||||
|
|
||||||
{body}
|
{body}
|
||||||
</document>.toXMLString()))
|
</document>.toXMLString()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
addTags("versions", util.httpGet("dactyl://help/versions").responseXML);
|
addTags("versions", util.httpGet("dactyl://help/versions").responseXML);
|
||||||
@@ -810,11 +808,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
overlayMap["index"] = ['text/xml;charset=UTF-8',
|
overlayMap["index"] = ['text/xml;charset=UTF-8',
|
||||||
'<?xml version="1.0"?>\n' +
|
'<?xml version="1.0"?>\n' +
|
||||||
'<overlay xmlns="' + NS + '">\n' +
|
'<overlay xmlns="' + NS + '">\n' +
|
||||||
unescape(encodeURI( // UTF-8 handling hack.
|
|
||||||
template.map(dactyl.indices, function ([name, iter])
|
template.map(dactyl.indices, function ([name, iter])
|
||||||
<dl insertafter={name + "-index"}>{
|
<dl insertafter={name + "-index"}>{
|
||||||
template.map(iter(), util.identity)
|
template.map(iter(), util.identity)
|
||||||
}</dl>, <>{"\n\n"}</>))) +
|
}</dl>, <>{"\n\n"}</>) +
|
||||||
'\n</overlay>'];
|
'\n</overlay>'];
|
||||||
|
|
||||||
addTags("index", util.httpGet("dactyl://help-overlay/index").responseXML);
|
addTags("index", util.httpGet("dactyl://help-overlay/index").responseXML);
|
||||||
|
|||||||
@@ -969,7 +969,7 @@ var Commands = Module("commands", {
|
|||||||
util.assert(!error, error);
|
util.assert(!error, error);
|
||||||
|
|
||||||
// if we add the argument to an option after a space, it MUST not be empty
|
// if we add the argument to an option after a space, it MUST not be empty
|
||||||
if (sep != "=" && !quote && arg.length == 0)
|
if (sep != "=" && !quote && arg.length == 0 && !complete)
|
||||||
arg = null;
|
arg = null;
|
||||||
|
|
||||||
count++; // to compensate the "=" character
|
count++; // to compensate the "=" character
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ var Styles = Module("Styles", {
|
|||||||
services["dactyl:"].providers["style"] = function styleProvider(uri) {
|
services["dactyl:"].providers["style"] = function styleProvider(uri) {
|
||||||
let id = /^\/(\d*)/.exec(uri.path)[1];
|
let id = /^\/(\d*)/.exec(uri.path)[1];
|
||||||
if (set.has(styles.allSheets, id))
|
if (set.has(styles.allSheets, id))
|
||||||
return ["text/css", unescape(encodeURI(styles.allSheets[id].fullCSS))];
|
return ["text/css", styles.allSheets[id].fullCSS];
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -974,11 +974,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
.map(function (node) "//" + node).join(" | ");
|
.map(function (node) "//" + node).join(" | ");
|
||||||
},
|
},
|
||||||
|
|
||||||
makeDTD: function makeDTD(obj) unescape(encodeURI(iter(obj)
|
makeDTD: function makeDTD(obj) iter(obj)
|
||||||
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : v, /['%]/g,
|
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : v, /['%]/g,
|
||||||
function (m) ({ "'": "'", "%": "%" })[m]),
|
function (m) ({ "'": "'", "%": "%" })[m]),
|
||||||
"'>"].join(""))
|
"'>"].join(""))
|
||||||
.join("\n"))),
|
.join("\n"),
|
||||||
|
|
||||||
map: deprecated("iter.map", function map(obj, fn, self) iter(obj).map(fn, self).toArray()),
|
map: deprecated("iter.map", function map(obj, fn, self) iter(obj).map(fn, self).toArray()),
|
||||||
writeToClipboard: deprecated("dactyl.clipboardWrite", function writeToClipboard(str, verbose) util.dactyl.clipboardWrite(str, verbose)),
|
writeToClipboard: deprecated("dactyl.clipboardWrite", function writeToClipboard(str, verbose) util.dactyl.clipboardWrite(str, verbose)),
|
||||||
|
|||||||
Reference in New Issue
Block a user