1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 17:37:57 +01:00

Fix some help linking and exporting bugs.

This commit is contained in:
Kris Maglione
2010-09-29 10:56:58 -04:00
parent 2e2e87c627
commit 5477acfad6
13 changed files with 51 additions and 44 deletions

View File

@@ -22,14 +22,7 @@ const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler;
const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService)
.getBranch("extensions.dactyl.");
let channel = Components.classesByID["{61ba33c0-3031-11d3-8cd0-0060b0fc14a3}"]
.getService(Ci.nsIProtocolHandler)
.newChannel(ioService.newURI("chrome://dactyl/content/data", null, null))
.QueryInterface(Ci.nsIRequest);
const systemPrincipal = channel.owner;
channel.cancel(NS_BINDING_ABORTED);
channel = null;
const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrincipal);
function dataURL(type, data) "data:" + (type || "application/xml;encoding=UTF-8") + "," + escape(data);
function makeChannel(url, orig) {
@@ -154,6 +147,8 @@ Dactyl.prototype = {
return makeChannel(url, uri);
case "help-tag":
let tag = decodeURIComponent(uri.path.substr(1));
if (tag in this.FILE_MAP)
return redirect("dactyl://help/" + tag, uri);
if (tag in this.HELP_TAGS)
return redirect("dactyl://help/" + this.HELP_TAGS[tag] + "#" + tag, uri);
}

View File

@@ -1183,9 +1183,9 @@ const Commands = Module("commands", {
function quote(q, list, map) {
map = map || Commands.quoteMap;
let re = RegExp("[" + list + "]", "g");
let res = function (str) q + String.replace(str, re, function ($0) $0 in map ? map[$0] : ("\\" + $0)) + q;
res.list = list;
return res;
function quote(str) q + String.replace(str, re, function ($0) $0 in map ? map[$0] : ("\\" + $0)) + q;
quote.list = list;
return quote;
};
Commands.quoteArg = {

View File

@@ -507,13 +507,14 @@ const Dactyl = Module("dactyl", {
'<?xml version="1.0"?>\n' +
'<?xml-stylesheet type="text/xsl" href="chrome://dactyl/content/help.xsl"?>\n' +
'<!DOCTYPE document SYSTEM "chrome://dactyl/content/dactyl.dtd">\n' +
unescape(encodeURI( // UTF-8 handling hack.
<document xmlns={NS}
name="plugins" title={config.appName + " Plugins"}>
<h1 tag="using-plugins">Using Plugins</h1>
<toc start="2"/>
{body}
</document>.toXMLString();
</document>.toXMLString()));
fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help];
addTags("plugins", util.httpGet("dactyl://help/plugins").responseXML);
@@ -551,7 +552,7 @@ const Dactyl = Module("dactyl", {
function fix(node) {
switch(node.nodeType) {
case Node.ELEMENT_NODE:
if (node instanceof HTMLScriptElement)
if (isinstance(node, [HTMLBaseElement, HTMLScriptElement]))
return;
data.push("<"); data.push(node.localName);
@@ -565,10 +566,13 @@ const Dactyl = Module("dactyl", {
set.add(styles, value);
}
if (name == "href") {
if (value.indexOf("dactyl://help-tag/") == 0)
value = services.get("io").newChannel(value, null, null).originalURI.path.substr(1);
if (!/[#\/]/.test(value))
value += ".xhtml";
value = node.href;
if (value.indexOf("dactyl://help-tag/") == 0) {
let uri = services.get("io").newChannel(value, null, null).originalURI;
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
}
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
value = value.replace(/(#|$)/, ".xhtml$1");
}
if (name == "src" && value.indexOf(":") > 0) {
chrome[value] = value.replace(/.*\//, "");;

View File

@@ -359,7 +359,15 @@
</xsl:template>
<xsl:template match="dactyl:link" mode="help-2">
<a href="{@topic}">
<a>
<xsl:choose>
<xsl:when test="regexp:match(@topic, '^([a-zA-Z]*:|[^/]*#|/)', '')">
<xsl:attribute name="href"><xsl:value-of select="@topic"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="concat('dactyl://help-tag/', @topic)"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="regexp:match(@topic, '^[a-zA-Z]*:', '')
and not(starts-with(@topic, 'mailto:'))">
<xsl:attribute name="rel">external</xsl:attribute>

View File

@@ -340,7 +340,7 @@ want to bypass &dactyl.appName;'s key handling and pass keys directly to
<p>
For example, at the URL
<tt>http://www.example.com/dir1/dir2/file.htm</tt>,
<k>2gu</k> opens <tt>http://www.example.com/dir1/</tt>.
2<k>gu</k> opens <tt>http://www.example.com/dir1/</tt>.
</p>
</description>
</item>

View File

@@ -219,7 +219,7 @@
<p>
Scroll window downwards by the amount specified in the
<o>scroll</o> option. With <oa>count</oa>, scroll as if
<o>scroll</o> were set to <o>count</o>.
<o>scroll</o> were set to <oa>count</oa>.
</p>
</description>
</item>
@@ -233,7 +233,7 @@
<p>
Scroll window upwards by the amount specified in the
<o>scroll</o> option. With <oa>count</oa>, scroll as if
<o>scroll</o> were set to <o>count</o>.
<o>scroll</o> were set to <oa>count</oa>.
</p>
</description>
</item>

View File

@@ -48,7 +48,7 @@
<p>
Opens the &dactyl.host; addon manager, where extensions and themes
may be installed, removed, disabled, and configured. See also
<ex>:extensions</ex>, <ex>:extinstall</ex>, <ex>:extoptions</ex>,
<ex>:extensions</ex>, <ex>:extadd</ex>, <ex>:extoptions</ex>,
<ex>:extenable</ex>, <ex>:extdisable</ex>, and <ex>:extdelete</ex>.
</p>
</description>

View File

@@ -8,7 +8,7 @@
title="&dactyl.appName; Insert Mode"
xmlns="&xmlns.dactyl;"
xmlns:html="&xmlns.html;">
<h1 tag="Insert-mode Insert mode-insert">Insert mode</h1>
<h1 tag="insert-mode insert mode-insert">Insert mode</h1>
<toc start="2"/>
<!-- TODO: This makes no sense. Rewrite. -->

View File

@@ -264,7 +264,7 @@
<p>&dactyl.host; options can be viewed and set with the following commands:</p>
<item>
<tags>:prefs :preferences</tags>
<tags>:pref :prefs :preferences</tags>
<spec>:pref<oa>erences</oa></spec>
<description>
<p>
@@ -277,7 +277,7 @@
</item>
<item>
<tags>:prefs! :preferences!</tags>
<tags>:pref! :prefs! :preferences!</tags>
<spec>:pref<oa>erences</oa>!</spec>
<description>
<p>
@@ -1401,7 +1401,7 @@
<item>
<tags>'verbose', 'vbs'</tags>
<tags>'vbs' 'verbose'</tags>
<spec>'verbose' 'vbs'</spec>
<type>number</type>
<default>1</default>

View File

@@ -178,7 +178,7 @@
line, you can use,
</p>
<code><ex>js</ex> &lt;&lt;<em>EOF</em>
<code><ex>:js</ex> &lt;&lt;<em>EOF</em>
<hl key="Object">var</hl> hello = <hl key="Key">function</hl> () {
alert(<str>Hello world</str>);
}

View File

@@ -275,7 +275,7 @@ const Util = Module("Util", {
* @param {boolean} asIterator Whether to return the results as an
* XPath iterator.
*/
evaluateXPath: (function () {
evaluateXPath: update(
function evaluateXPath(expression, doc, elem, asIterator) {
if (!doc)
doc = util.activeWindow.content.document;
@@ -296,15 +296,15 @@ const Util = Module("Util", {
: function () { for (let i = 0; i < this.snapshotLength; i++) yield this.snapshotItem(i); }
}
});
}
evaluateXPath.resolver = function lookupNamespaceURI(prefix) ({
},
{
resolver: function lookupNamespaceURI(prefix) ({
xul: XUL.uri,
xhtml: XHTML.uri,
xhtml2: "http://www.w3.org/2002/06/xhtml2",
dactyl: NS.uri
}[prefix] || null);
return evaluateXPath;
})(),
}[prefix] || null)
}),
extend: function extend(dest) {
Array.slice(arguments, 1).filter(util.identity).forEach(function (src) {

View File

@@ -147,7 +147,7 @@
<ul>
<li>Vim-like keybindings (<k>h</k>, <k>j</k>, <k>gg</k>, <k>ZZ</k>, <k name="C-f"/>, etc.)</li>
<li>Ex commands (<ex>:quit</ex>, <ex>:open www.foo.com</ex>, …)</li>
<li>Tab completion for all commands, highly configurable via <o>wildmode</o> and <o>wildoptions</o></li>
<li>Tab completion for all commands, highly configurable via <o>wildmode</o>, <o>autocomplete</o>, ...</li>
<li>Hit-a-hint like navigation of links (start with <k>f</k> to follow a link)</li>
<li>Advanced completion of bookmark and history URLs</li>
<li>Vim-like status line with a Wget-like progress bar</li>
@@ -157,8 +157,8 @@
<li>Count supported for many commands (<em>3</em><k name="C-o"/> will go back 3 pages)</li>
<li>Visual bell for errors (<o>visualbell</o>)</li>
<li>Marks support (<k>m</k><em>a</em> to set mark a, <k>'</k><em>a</em> to jump to it)</li>
<li><link topic="marks#quickmarks">QuickMark</link> support</li>
<li><ex>:map</ex>, <ex>:command</ex>, <ex>:feedkeys</ex>, and <t>macros</t></li>
<li><link topic="quickmarks">QuickMark</link> support</li>
<li><ex>:map</ex>, <ex>:command</ex>, <ex>:normal</ex>, and <t>macros</t></li>
<li><link topic="i_&lt;C-i>">Editing of text fields</link> with an <link topic="'editor'">external editor</link></li>
<li>AutoCommands to execute actions on certain events</li>
<li>A comprehensive help system, explaining all commands, mappings, options, and plugins</li>

View File

@@ -234,7 +234,7 @@
</p>
<p>
To test it, try this link: <link target="&dactyl.apphome;">&dactyl.appName; Homepage</link>.
To test it, try this link: <link topic="&dactyl.apphome;">&dactyl.appName; Homepage</link>.
Activate QuickHint mode with <k>f</k> or <k>F</k> to highlight all currently
visible links. Then start typing the text of the link. The link should be
uniquely identified soon, and &dactyl.appName; will open it. Once you're done,
@@ -372,9 +372,9 @@
&dactyl.appName; has an energetic and growing user base. If you've run into a problem
that you can't seem to solve with &dactyl.appName;, or if you think you might have
found a bug, please let us know! There is support available on the
<link href="http://code.google.com/p/dactyl/w/list?q=label%3Aproject-&dactyl.name;">wiki</link>
or in the <link href="irc://irc.oftc.net/pentadactyl">#pentadactyl</link> IRC
channel on <link href="http://oftc.net/">OFTC</link>.
<link topic="http://code.google.com/p/dactyl/w/list?q=label%3Aproject-&dactyl.name;">wiki</link>
or in the <link topic="irc://irc.oftc.net/pentadactyl">#pentadactyl</link> IRC
channel on <link topic="http://oftc.net/">OFTC</link>.
</p>
<p>