mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 22:07:58 +01:00
Completely HTML-ize help transforms. Add intentionally undocumented :exporthelp.
This commit is contained in:
@@ -46,7 +46,7 @@ function fakeChannel(orig)
|
||||
function redirect(to, orig)
|
||||
{
|
||||
let html = <html><head><meta http-equiv="Refresh" content={"0;" + to}/></head></html>.toXMLString();
|
||||
return makeChannel(dataURL('text/html', html), orig);
|
||||
return makeChannel(dataURL('text/html', html), ioServices.newURI(to, null, null));
|
||||
}
|
||||
|
||||
function ChromeData() {}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
<!-- Header {{{1 -->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns="http://vimperator.org/namespaces/liberator"
|
||||
xmlns:liberator="http://vimperator.org/namespaces/liberator"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:liberator="http://vimperator.org/namespaces/liberator"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:str="http://exslt.org/strings"
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
@@ -76,9 +76,9 @@
|
||||
<!-- Process Inclusions {{{1 -->
|
||||
|
||||
<xsl:template match="liberator:include" mode="overlay-2">
|
||||
<xsl:copy>
|
||||
<div liberator:highlight="HelpInclude">
|
||||
<xsl:apply-templates select="document(@href)/liberator:document/node()" mode="overlay"/>
|
||||
</xsl:copy>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*|node()" mode="overlay">
|
||||
@@ -94,21 +94,20 @@
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:for-each select="$root/liberator:document">
|
||||
<html:html liberator:highlight="Help">
|
||||
<html:head>
|
||||
<html:title><xsl:value-of select="@title"/></html:title>
|
||||
<html:base href="liberator://help/{@name}"/>
|
||||
<html:script type="text/javascript"
|
||||
<html liberator:highlight="Help">
|
||||
<head>
|
||||
<title><xsl:value-of select="@title"/></title>
|
||||
<script type="text/javascript"
|
||||
src="chrome://liberator/content/help.js"/>
|
||||
</html:head>
|
||||
<html:body liberator:highlight="HelpBody">
|
||||
<html:div class="liberator-logo"/>
|
||||
</head>
|
||||
<body liberator:highlight="HelpBody">
|
||||
<div liberator:highlight="Logo"/>
|
||||
<xsl:call-template name="parse-tags">
|
||||
<xsl:with-param name="text" select="concat(@name, '.html')"/>
|
||||
</xsl:call-template>
|
||||
<xsl:apply-templates/>
|
||||
</html:body>
|
||||
</html:html>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
@@ -126,15 +125,15 @@
|
||||
local-name() = $tag and not(preceding::*[local-name() = $lasttag][position() = 1 and not(.=$context)])]"/>
|
||||
|
||||
<xsl:if test="$nodes">
|
||||
<html:ol liberator:highlight="HelpOrderedList">
|
||||
<ol liberator:highlight="HelpOrderedList">
|
||||
<xsl:for-each select="$nodes">
|
||||
<li>
|
||||
<html:a>
|
||||
<a>
|
||||
<xsl:if test="@tag">
|
||||
<xsl:attribute name="href"><xsl:value-of select="concat('#', substring-before(concat(@tag, ' '), ' '))"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</html:a>
|
||||
</a>
|
||||
<xsl:call-template name="toc">
|
||||
<xsl:with-param name="level" select="$level + 1"/>
|
||||
<xsl:with-param name="context" select="."/>
|
||||
@@ -142,7 +141,7 @@
|
||||
</xsl:call-template>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</html:ol>
|
||||
</ol>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:toc" mode="pass-2">
|
||||
@@ -156,7 +155,7 @@
|
||||
<xsl:variable name="toc" select="exsl:node-set($TOC)"/>
|
||||
|
||||
<xsl:if test="//liberator:toc[1 and self::*]">
|
||||
<html:div liberator:highlight="HelpTOC">
|
||||
<div liberator:highlight="HelpTOC">
|
||||
<h2>Contents</h2>
|
||||
<xsl:if test="@start">
|
||||
<xsl:call-template name="toc">
|
||||
@@ -169,41 +168,41 @@
|
||||
<xsl:with-param name="toc" select="$toc"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</html:div>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Items {{{1 -->
|
||||
|
||||
<xsl:template match="liberator:item" mode="pass-2">
|
||||
<xsl:copy>
|
||||
<div liberator:highlight="HelpItem">
|
||||
<xsl:apply-templates select="liberator:tags|liberator:spec"/>
|
||||
<html:hr style="border: 0; height: 0; margin: 0; width: 100%; float: right;"/>
|
||||
<html:div liberator:highlight="HelpOptInfo">
|
||||
<hr style="border: 0; height: 0; margin: 0; width: 100%; float: right;"/>
|
||||
<div liberator:highlight="HelpOptInfo">
|
||||
<xsl:apply-templates select="liberator:type|liberator:default"/>
|
||||
<html:div style="clear: both;"/>
|
||||
</html:div>
|
||||
<div style="clear: both;"/>
|
||||
</div>
|
||||
<xsl:apply-templates select="liberator:description"/>
|
||||
<html:div style="clear: both;"/>
|
||||
</xsl:copy>
|
||||
<div style="clear: both;"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:spec[preceding-sibling::liberator:spec]" mode="pass-2">
|
||||
<html:div style="clear: both;"/>
|
||||
<xsl:copy>
|
||||
<div style="clear: both;"/>
|
||||
<div liberator:highlight="HelpSpec">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:copy>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:default[not(@type='plain')]" mode="pass-2">
|
||||
<xsl:variable name="type" select="preceding-sibling::liberator:type[1] | following-sibling::liberator:type[1]"/>
|
||||
<xsl:copy>
|
||||
<span liberator:highlight="HelpDefault">(default:<xsl:text> </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($type, 'string')">
|
||||
<str><xsl:apply-templates/></str>
|
||||
<span liberator:highlight="HelpString"><xsl:apply-templates/></span>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<span>
|
||||
<xsl:attribute name="highlight" namespace="http://vimperator.org/namespaces/liberator">
|
||||
<xsl:attribute name="liberator:highlight">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$type = 'boolean'">Boolean</xsl:when>
|
||||
<xsl:when test="$type = 'number'">Number</xsl:when>
|
||||
@@ -213,14 +212,14 @@
|
||||
<xsl:apply-templates/>
|
||||
</span>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:copy>
|
||||
</xsl:choose>)
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Tag Definitions {{{1 -->
|
||||
|
||||
<xsl:template match="liberator:tags" mode="pass-2">
|
||||
<html:div style="clear: right"/>
|
||||
<div style="clear: right"/>
|
||||
<xsl:call-template name="parse-tags">
|
||||
<xsl:with-param name="text" select="."/>
|
||||
</xsl:call-template>
|
||||
@@ -232,98 +231,157 @@
|
||||
</xsl:template>
|
||||
<xsl:template name="parse-tags">
|
||||
<xsl:param name="text"/>
|
||||
<tags>
|
||||
<div liberator:highlight="HelpTags">
|
||||
<xsl:for-each select="str:tokenize($text)">
|
||||
<html:a id="{.}"><tag><xsl:value-of select="."/></tag></html:a>
|
||||
<a id="{.}" liberator:highlight="HelpTag"><xsl:value-of select="."/></a>
|
||||
</xsl:for-each>
|
||||
</tags>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Tag Links {{{1 -->
|
||||
|
||||
<xsl:template name="linkify-tag">
|
||||
<xsl:param name="contents"/>
|
||||
<xsl:param name="contents" select="text()"/>
|
||||
<xsl:variable name="tag" select="str:tokenize($contents, ' [')[1]"/>
|
||||
<html:a href="liberator://help-tag/{$tag}" style="color: inherit;">
|
||||
<a href="liberator://help-tag/{$tag}" style="color: inherit;">
|
||||
<xsl:if test="contains($tags, concat(' ', $tag, ' '))">
|
||||
<xsl:attribute name="href">#<xsl:value-of select="$tag"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="$contents"/>
|
||||
</html:a>
|
||||
</a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:o" mode="pass-2">
|
||||
<xsl:copy>
|
||||
<span liberator:highlight="HelpOption">
|
||||
<xsl:call-template name="linkify-tag">
|
||||
<xsl:with-param name="contents" select='concat("'", text(), "'")'/>
|
||||
</xsl:call-template>
|
||||
</xsl:copy>
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:k|liberator:t" mode="pass-2">
|
||||
<xsl:copy>
|
||||
<xsl:call-template name="linkify-tag">
|
||||
<xsl:with-param name="contents" select="text()"/>
|
||||
</xsl:call-template>
|
||||
</xsl:copy>
|
||||
<xsl:template match="liberator:t" mode="pass-2">
|
||||
<span liberator:highlight="HelpTopic">
|
||||
<xsl:call-template name="linkify-tag"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:k" mode="pass-2">
|
||||
<span liberator:highlight="HelpKey">
|
||||
<xsl:call-template name="linkify-tag"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:k[@name]" mode="pass-2">
|
||||
<xsl:copy>
|
||||
<span liberator:highlight="HelpKey">
|
||||
<xsl:call-template name="linkify-tag">
|
||||
<xsl:with-param name="contents" select="concat('<', @name, '>', .)"/>
|
||||
</xsl:call-template>
|
||||
</xsl:copy>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- HTML-ish elements {{{1 -->
|
||||
|
||||
<xsl:template match="liberator:ul" mode="pass-2">
|
||||
<html:ul liberator:highlight="HelpList"><xsl:apply-templates select="@*|node()"/></html:ul>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:ol" mode="pass-2">
|
||||
<html:ol liberator:highlight="HelpOrderedList"><xsl:apply-templates select="@*|node()"/></html:ol>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:ex" mode="pass-2">
|
||||
<xsl:copy>
|
||||
<xsl:call-template name="linkify-tag">
|
||||
<xsl:with-param name="contents" select="."/>
|
||||
</xsl:call-template>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:dl" mode="pass-2">
|
||||
<xsl:copy>
|
||||
<dl>
|
||||
<column/>
|
||||
<column/>
|
||||
<xsl:for-each select="liberator:dt">
|
||||
<tr>
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:apply-templates select="following-sibling::liberator:dd[position()=1]"/>
|
||||
<xsl:apply-templates select="following-sibling::liberator:dd[1]"/>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</xsl:copy>
|
||||
</dl>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:link" mode="pass-2">
|
||||
<html:a href="{@topic}"><xsl:apply-templates select="@*|node()"/></html:a>
|
||||
<a href="{@topic}"><xsl:apply-templates select="@*|node()"/></a>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Plugins {{1 -->
|
||||
<xsl:template match="liberator:em | liberator:tt | liberator:p |
|
||||
liberator:dt | liberator:dd |
|
||||
liberator:ol | liberator:ul | liberator:li |
|
||||
liberator:h1 | liberator:h2 | liberator:h3"
|
||||
mode="pass-2">
|
||||
<xsl:element name="html:{local-name()}">
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:code" mode="pass-2">
|
||||
<pre liberator:highlight="HelpCode"><xsl:apply-templates select="@*|node()"/></pre>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Help elements {{{1 -->
|
||||
|
||||
<xsl:template match="liberator:a" mode="pass-2">
|
||||
<span liberator:highlight="HelpArg">[<xsl:apply-templates select="@*|node()"/>]</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:oa" mode="pass-2">
|
||||
<span liberator:highlight="HelpOptionalArg">{<xsl:apply-templates select="@*|node()"/>}</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:note" mode="pass-2">
|
||||
<p>
|
||||
<span liberator:highlight="Note">Note:</span>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</p>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:warning" mode="pass-2">
|
||||
<p>
|
||||
<span liberator:highlight="Warning">Warning:</span>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</p>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:default" mode="pass-2">
|
||||
<span liberator:highlight="HelpDefault">
|
||||
(default:<xsl:text> </xsl:text><xsl:apply-templates select="@*|node()"/>)
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- HTML-ify other elements {{{1 -->
|
||||
|
||||
<xsl:template match="liberator:ex" mode="pass-2">
|
||||
<span liberator:highlight="HelpEx">
|
||||
<xsl:call-template name="linkify-tag">
|
||||
<xsl:with-param name="contents" select="."/>
|
||||
</xsl:call-template>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:description | liberator:example | liberator:spec" mode="pass-2">
|
||||
<div>
|
||||
<xsl:if test="self::liberator:description"><xsl:attribute name="liberator:highlight">HelpDescription</xsl:attribute></xsl:if>
|
||||
<xsl:if test="self::liberator:example"><xsl:attribute name="liberator:highlight">HelpExample</xsl:attribute></xsl:if>
|
||||
<xsl:if test="self::liberator:spec"><xsl:attribute name="liberator:highlight">HelpSpec</xsl:attribute></xsl:if>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:str | liberator:t | liberator:type" mode="pass-2">
|
||||
<span>
|
||||
<xsl:if test="self::liberator:str"><xsl:attribute name="liberator:highlight">HelpString</xsl:attribute></xsl:if>
|
||||
<xsl:if test="self::liberator:t"><xsl:attribute name="liberator:highlight">HelpTopic</xsl:attribute></xsl:if>
|
||||
<xsl:if test="self::liberator:type"><xsl:attribute name="liberator:highlight">HelpType</xsl:attribute></xsl:if>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Plugins {{{1 -->
|
||||
|
||||
<xsl:template name="info">
|
||||
<xsl:param name="label"/>
|
||||
<xsl:param name="prelink" select="''"/>
|
||||
<xsl:param name="link" select="@href"/>
|
||||
<html:div liberator:highlight="HelpInfo">
|
||||
<html:div liberator:highlight="HelpInfoLabel">
|
||||
<div liberator:highlight="HelpInfo">
|
||||
<div liberator:highlight="HelpInfoLabel">
|
||||
<xsl:value-of select="$label"/>:
|
||||
</html:div>
|
||||
<html:a liberator:highlight="HelpInfoValue">
|
||||
</div>
|
||||
<a liberator:highlight="HelpInfoValue">
|
||||
<xsl:if test="$link">
|
||||
<xsl:attribute name="href"><xsl:value-of select="concat($prelink, $link)"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates/>
|
||||
</html:a>
|
||||
</html:div>
|
||||
</a>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:author" mode="pass-2">
|
||||
<xsl:call-template name="info">
|
||||
@@ -338,19 +396,23 @@
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
<xsl:template match="liberator:plugin" mode="pass-2">
|
||||
<html:div liberator:highlight="HelpInfo">
|
||||
<html:div liberator:highlight="HelpInfoLabel">
|
||||
<div liberator:highlight="HelpInfo">
|
||||
<div liberator:highlight="HelpInfoLabel">
|
||||
Plugin:
|
||||
</html:div>
|
||||
<html:a liberator:highlight="HelpInfoValue" href="{@href}">
|
||||
</div>
|
||||
<a liberator:highlight="HelpInfoValue" href="{@href}">
|
||||
<xsl:value-of select="@name"/>
|
||||
</html:a>
|
||||
</html:div>
|
||||
</a>
|
||||
</div>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Special Element Templates {{{1 -->
|
||||
|
||||
<xsl:template match="liberator:logo">
|
||||
<span liberator:highlight="Logo"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="liberator:pan[liberator:handle]">
|
||||
<form style="text-align:center" xmlns="http://www.w3.org/1999/xhtml"
|
||||
action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
||||
|
||||
@@ -567,6 +567,23 @@ const liberator = (function () //{{{
|
||||
});
|
||||
});
|
||||
|
||||
commands.add(["exporth[elp]"],
|
||||
"Exports " + config.name + "'s help system to the named zip file",
|
||||
function (args)
|
||||
{
|
||||
liberator.echomsg("Exporting help to " + args[0].quote() + ". Please wait...");
|
||||
util.exportHelp(args[0]);
|
||||
liberator.echomsg("Help exported to " + args[0].quote() + ".");
|
||||
},
|
||||
{
|
||||
argCount: "1",
|
||||
completer: function (context) {
|
||||
context.filters.push(function ({ item: f }) f.isDirectory() || /\.zip/.test(f.leafName));
|
||||
completion.file(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["javas[cript]", "js"],
|
||||
"Run a JavaScript command through eval()",
|
||||
function (args)
|
||||
@@ -1845,6 +1862,18 @@ const liberator = (function () //{{{
|
||||
liberator.reportError(e);
|
||||
}
|
||||
|
||||
let img = Image();
|
||||
img.src = config.logo || "chrome://" + config.name.toLowerCase() + "/content/logo.png";
|
||||
img.onload = function () {
|
||||
highlight.set("Logo", String(<>
|
||||
display: inline-block;
|
||||
background: url({img.src});
|
||||
width: {img.width}px;
|
||||
height: {img.height}px;
|
||||
</>));
|
||||
delete img;
|
||||
};
|
||||
|
||||
// commands must always be the first module to be initialized
|
||||
loadModule("commands", Commands);
|
||||
loadModule("options", Options);
|
||||
|
||||
@@ -117,6 +117,7 @@ function Services()
|
||||
self.addClass("file:", "@mozilla.org/network/protocol;1?name=file", Ci.nsIFileProtocolHandler);
|
||||
self.addClass("find", "@mozilla.org/embedcomp/rangefind;1", Ci.nsIFind);
|
||||
self.addClass("process", "@mozilla.org/process/util;1", Ci.nsIProcess);
|
||||
self.addClass("zipWriter", "@mozilla.org/zipwriter;1", Ci.nsIZipWriter);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -123,80 +123,100 @@ Highlights.prototype.CSS = <![CDATA[
|
||||
|
||||
Help font-size: 8pt; line-height: 1.4em; font-family: -moz-fixed;
|
||||
|
||||
HelpArg,liberator|a color: #6A97D4;
|
||||
HelpArg::before content: "{";
|
||||
HelpArg::after content: "}";
|
||||
HelpArg color: #6A97D4;
|
||||
HelpOptionalArg,liberator|oa color: #6A97D4;
|
||||
HelpOptionalArg::before content: "[";
|
||||
HelpOptionalArg::after content: "]";
|
||||
|
||||
HelpBody display: block; margin: 1em auto; max-width: 100ex;
|
||||
HelpBorder,liberator|* border-color: silver; border-width: 0px; border-style: solid;
|
||||
HelpCode,liberator|code display: block; white-space: pre; margin-left: 2em; font-family: courier, monospace;
|
||||
HelpBorder,*,liberator://help/* border-color: silver; border-width: 0px; border-style: solid;
|
||||
HelpCode display: block; white-space: pre; margin-left: 2em; font-family: courier, monospace;
|
||||
|
||||
HelpDefault,liberator|default margin-right: 1ex; white-space: pre;
|
||||
HelpDefault::after content: ")"
|
||||
HelpDefault::before content: "(default: ";
|
||||
HelpDefault margin-right: 1ex; white-space: pre;
|
||||
|
||||
HelpDescription,liberator|description display: block;
|
||||
HelpEm,liberator|em font-weight: bold;
|
||||
HelpDescription display: block;
|
||||
HelpEm,html|em,liberator://help/* font-weight: bold; font-style: normal;
|
||||
|
||||
HelpEx,liberator|ex display: inline-block; color: #527BBD; font-weight: bold;
|
||||
HelpEx display: inline-block; color: #527BBD; font-weight: bold;
|
||||
HelpEx:hover text-decoration: underline; cursor: pointer;
|
||||
|
||||
HelpExample,liberator|example display: block; margin: 1em 0;
|
||||
HelpExample display: block; margin: 1em 0;
|
||||
HelpExample::before content: "Example: "; font-weight: bold;
|
||||
HelpHead,liberator|h1 display: block; margin: 1em 0; padding-bottom: .2ex; border-bottom-width: 1px; font-size: 2em; font-weight: bold; color: #527BBD; clear: both;
|
||||
|
||||
HelpInfo display: block; width: 20em; margin-left: auto;
|
||||
HelpInfoLabel display: inline-block; width: 6em; color: magenta; font-weight: bold; vertical-align: text-top;
|
||||
HelpInfoValue display: inline-block; width: 14em; text-decoration: none; vertical-align: text-top;
|
||||
|
||||
HelpItem,liberator|item display: block; margin: 1em 1em 1em 10em; clear: both;
|
||||
HelpItem display: block; margin: 1em 1em 1em 10em; clear: both;
|
||||
|
||||
HelpKey,liberator|k color: #102663;
|
||||
HelpKey color: #102663;
|
||||
|
||||
HelpLink,liberator|*>html|a[href] text-decoration: none;
|
||||
HelpLink,html|a,liberator://help/* text-decoration: none;
|
||||
HelpLink:hover text-decoration: underline;
|
||||
|
||||
HelpList display: block; list-style: outside disc;
|
||||
HelpOrderedList display: block; list-style: outside decimal;
|
||||
HelpListItem,liberator|li display: list-item;
|
||||
HelpList,html|ul,liberator://help/* display: block; list-style: outside disc;
|
||||
HelpOrderedList,html|ol,liberator://help/* display: block; list-style: outside decimal;
|
||||
HelpListItem,html|li,liberator://help/* display: list-item;
|
||||
|
||||
HelpNote,liberator|note display: block; margin: 1em 0em;
|
||||
HelpNote::before content: "Note: "; color: red; font-weight: bold;
|
||||
HelpNote color: red; font-weight: bold;
|
||||
|
||||
HelpOpt,liberator|o color: #106326;
|
||||
HelpOpt color: #106326;
|
||||
HelpOpt:hover text-decoration: underline; cursor: pointer;
|
||||
HelpOptInfo display: inline-block; margin-bottom: 1ex;
|
||||
|
||||
HelpParagraph,liberator|p display: block; margin: 1em 0em;
|
||||
HelpSpec,liberator|spec display: block; margin-left: -10em; float: left; clear: left; color: #527BBD;
|
||||
HelpParagraph,html|p,liberator://help/* display: block; margin: 1em 0em;
|
||||
HelpSpec display: block; margin-left: -10em; float: left; clear: left; color: #527BBD;
|
||||
|
||||
HelpString,liberator|str display: inline-block; color: green; font-weight: normal; vertical-align: text-top;
|
||||
HelpString display: inline-block; color: green; font-weight: normal; vertical-align: text-top;
|
||||
HelpString::before content: '"';
|
||||
HelpString::after content: '"';
|
||||
|
||||
HelpSubhead,liberator|h2 display: block; margin: 1em 0; padding-bottom: .2ex; border-bottom-width: 1px; font-size: 1.2em; font-weight: bold; color: #527BBD; clear: both;
|
||||
HelpSubsubhead,liberator|h3 display: block; margin: 1em 0; padding-bottom: .2ex; font-size: 1.1em; font-weight: bold; color: #527BBD; clear: both;
|
||||
HelpHead,html|h1,liberator://help/* {
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
padding-bottom: .2ex;
|
||||
border-bottom-width: 1px;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
color: #527BBD;
|
||||
clear: both;
|
||||
}
|
||||
HelpSubhead,html|h2,liberator://help/* {
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
padding-bottom: .2ex;
|
||||
border-bottom-width: 1px;
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
color: #527BBD;
|
||||
clear: both;
|
||||
}
|
||||
HelpSubsubhead,html|h3,liberator://help/* {
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
padding-bottom: .2ex;
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
color: #527BBD;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
HelpTOC
|
||||
HelpTOC>ol ol margin-left: -1em;
|
||||
|
||||
HelpTab,liberator|dl display: table; width: 100%; margin: 1em 0; border-bottom-width: 1px; border-top-width: 1px; padding: .5ex 0; table-layout: fixed;
|
||||
HelpTabColumn,liberator|column display: table-column;
|
||||
HelpTab,html|dl,liberator://help/* display: table; width: 100%; margin: 1em 0; border-bottom-width: 1px; border-top-width: 1px; padding: .5ex 0; table-layout: fixed;
|
||||
HelpTabColumn,html|column,liberator://help/* display: table-column;
|
||||
HelpTabColumn:first-child width: 25%;
|
||||
HelpTabTitle,liberator|dt display: table-cell; padding: .1ex 1ex; font-weight: bold;
|
||||
HelpTabDescription,liberator|dd display: table-cell; padding: .1ex 1ex;
|
||||
HelpTabRow,liberator|dl>tr display: table-row;
|
||||
HelpTabTitle,html|dt,liberator://help/* display: table-cell; padding: .1ex 1ex; font-weight: bold;
|
||||
HelpTabDescription,html|dd,liberator://help/* display: table-cell; padding: .1ex 1ex; border-width: 0px;
|
||||
HelpTabRow,html|dl>html|tr,liberator://help/* display: table-row;
|
||||
|
||||
HelpTag,liberator|tag display: inline-block; color: #527BBD; margin-left: 1ex; font-size: 8pt; font-weight: bold;
|
||||
HelpTags,liberator|tags display: block; float: right; clear: right;
|
||||
HelpTopic,liberator|t color: #102663;
|
||||
HelpType,liberator|type margin-right: 2ex;
|
||||
HelpTag display: inline-block; color: #527BBD; margin-left: 1ex; font-size: 8pt; font-weight: bold;
|
||||
HelpTags display: block; float: right; clear: right;
|
||||
HelpTopic color: #102663;
|
||||
HelpType margin-right: 2ex;
|
||||
|
||||
HelpWarning,liberator|warning display: block; margin: 1em 0em;
|
||||
HelpWarning::before content: "Warning: "; color: red; font-weight: bold;
|
||||
HelpWarning color: red; font-weight: bold;
|
||||
|
||||
Logo
|
||||
|
||||
Search,,* {
|
||||
font-size: inherit;
|
||||
|
||||
@@ -318,6 +318,107 @@ const util = { //{{{
|
||||
</item>.toXMLString();
|
||||
},
|
||||
|
||||
exportHelp: function (path)
|
||||
{
|
||||
const FILE = io.File(path);
|
||||
const PATH = FILE.leafName.replace(/\..*/, "") + "/";
|
||||
const TIME = Date.now();
|
||||
|
||||
let zip = services.create("zipWriter");
|
||||
zip.open(FILE.file, io.MODE_CREATE | io.MODE_WRONLY | io.MODE_TRUNCATE);
|
||||
function addURIEntry(file, uri)
|
||||
zip.addEntryChannel(PATH + file, TIME, 9,
|
||||
services.get("io").newChannel(uri, null, null),
|
||||
false);
|
||||
function addDataEntry(file, data) // Inideal to an extreme.
|
||||
addURIEntry(file, "data:text/plain;charset=UTF-8," + encodeURI(data));
|
||||
|
||||
let empty = util.Array.toObject(
|
||||
"area base basefont br col frame hr img input isindex link meta param"
|
||||
.split(" ").map(Array.concat));
|
||||
let chrome = {};
|
||||
for (let [file,] in Iterator(services.get("liberator:").FILE_MAP))
|
||||
{
|
||||
liberator.open("liberator://help/" + file);
|
||||
events.waitForPageLoad();
|
||||
let data = [
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\n',
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n',
|
||||
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
|
||||
];
|
||||
function fix(node)
|
||||
{
|
||||
switch(node.nodeType)
|
||||
{
|
||||
case Node.ELEMENT_NODE:
|
||||
if (node instanceof HTMLScriptElement)
|
||||
return;
|
||||
|
||||
data.push("<"); data.push(node.localName);
|
||||
if (node instanceof HTMLHtmlElement)
|
||||
data.push(' xmlns="' + XHTML.uri + '"');
|
||||
|
||||
for (let { name: name, value: value } in util.Array.itervalues(node.attributes))
|
||||
{
|
||||
if (name == "liberator:highlight")
|
||||
{
|
||||
name = "class";
|
||||
value = "hl-" + value;
|
||||
}
|
||||
if (name == "href")
|
||||
{
|
||||
if (value.indexOf("liberator://help-tag/") == 0)
|
||||
value = services.get("io").newChannel(value, null, null).originalURI.path.substr(1);
|
||||
if (!/[#\/]/.test(value))
|
||||
value += ".xhtml";
|
||||
}
|
||||
if (name == "src" && value.indexOf(":") > 0)
|
||||
{
|
||||
chrome[value] = value.replace(/.*\//, "");;
|
||||
value = value.replace(/.*\//, "");
|
||||
}
|
||||
data.push(" ");
|
||||
data.push(name);
|
||||
data.push('="');
|
||||
data.push(<>{value}</>.toXMLString());
|
||||
data.push('"')
|
||||
}
|
||||
if (node.localName in empty)
|
||||
data.push(" />");
|
||||
else
|
||||
{
|
||||
data.push(">");
|
||||
if (node instanceof HTMLHeadElement)
|
||||
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
||||
Array.map(node.childNodes, arguments.callee);
|
||||
data.push("</"); data.push(node.localName); data.push(">");
|
||||
}
|
||||
break;
|
||||
case Node.TEXT_NODE:
|
||||
data.push(<>{node.textContent}</>.toXMLString());
|
||||
}
|
||||
}
|
||||
fix(content.document.documentElement);
|
||||
addDataEntry(file + ".xhtml", data.join(""));
|
||||
}
|
||||
|
||||
let data = [h.selector.replace(/^\[.*?=(.*?)\]/, ".hl-$1").replace(/html\|/, "") +
|
||||
"\t{" + h.value + "}"
|
||||
for (h in highlight) if (/^Help|^Logo/.test(h.class))];
|
||||
|
||||
data = data.join("\n");
|
||||
addDataEntry("help.css", data.replace(/chrome:[^ ")]+\//g, ""));
|
||||
|
||||
let re = /(chrome:[^ ");]+\/)([^ ");]+)/g;
|
||||
while (m = re.exec(data))
|
||||
chrome[m[0]] = m[2];
|
||||
|
||||
for (let [uri, leaf] in Iterator(chrome))
|
||||
addURIEntry(leaf, uri);
|
||||
|
||||
zip.close();
|
||||
},
|
||||
|
||||
/**
|
||||
* Sends a synchronous HTTP request to <b>url</b> and returns the
|
||||
* XMLHttpRequest object. If <b>callback</b> is specified the request is
|
||||
|
||||
@@ -198,20 +198,6 @@ const config = (function () //{{{
|
||||
////////////////////// STYLES //////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
let img = Image();
|
||||
img.src = "chrome://muttator/content/logo.png";
|
||||
img.onload = function () {
|
||||
styles.addSheet(true, "logo", "chrome://liberator/locale/*",
|
||||
".muttator-logo {" + <>
|
||||
display: inline-block;
|
||||
background: url({img.src});
|
||||
width: {img.width}px;
|
||||
height: {img.height}px;
|
||||
</> + "}",
|
||||
true);
|
||||
delete img;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
@@ -155,20 +155,6 @@ const config = { //{{{
|
||||
////////////////////// STYLES //////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
let img = Image();
|
||||
img.src = "chrome://vimperator/content/logo.png";
|
||||
img.onload = function () {
|
||||
styles.addSheet(true, "logo", "chrome://liberator/locale/*",
|
||||
".liberator-logo {" + <>
|
||||
display: inline-block;
|
||||
background: url({img.src});
|
||||
width: {img.width}px;
|
||||
height: {img.height}px;
|
||||
</> + "}",
|
||||
true);
|
||||
delete img;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
xmlns="http://vimperator.org/namespaces/liberator"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<logo/>
|
||||
|
||||
<html:p style="text-align: center; font-weight: bold;">
|
||||
First there was a Navigator, then there was an Explorer.
|
||||
Later it was time for a Konqueror. Now it's time for an Imperator, the
|
||||
@@ -152,6 +150,10 @@ web browser, as key bindings differ according to which mode you are in.
|
||||
<link topic="various">Various commands</link>:
|
||||
Other help which didn't fit into any other category.
|
||||
</li>
|
||||
<li>
|
||||
<link topic="plugins">Plugins</link>:
|
||||
Documentation for any plugins you may have installed.
|
||||
</li>
|
||||
<li>
|
||||
<link topic="index">Index</link>:
|
||||
An index of all commands and options.
|
||||
|
||||
@@ -249,20 +249,6 @@ const config = { //{{{
|
||||
////////////////////// STYLES //////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
let img = Image();
|
||||
img.src = "chrome://xulmus/content/logo.png";
|
||||
img.onload = function () {
|
||||
styles.addSheet(true, "logo", "chrome://liberator/locale/*",
|
||||
".xulmus-logo {" + <>
|
||||
display: inline-block;
|
||||
background: url({img.src});
|
||||
width: {img.width}px;
|
||||
height: {img.height}px;
|
||||
</> + "}",
|
||||
true);
|
||||
delete img;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
Reference in New Issue
Block a user