summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKris Maglione <kris@vimperator.org>2009-10-30 07:53:37 -0400
committerKris Maglione <kris@vimperator.org>2009-10-30 07:53:37 -0400
commit43b9d560fab74a70de833041c2b77899b28a80f6 (patch)
treea2bb5e030fe66fdd80c1b8a8e8356aa908c567e5 /common
parent7449d40f73157f2c3e861311c9b5a1ad99d8b4f5 (diff)
downloadpentadactyl-43b9d560fab74a70de833041c2b77899b28a80f6.tar.gz
Add fold markers (that I don't use) to style.xsl; minor cleanup.
Diffstat (limited to 'common')
-rw-r--r--common/content/help.xsl152
1 files changed, 88 insertions, 64 deletions
diff --git a/common/content/help.xsl b/common/content/help.xsl
index 270d1674..989ab016 100644
--- a/common/content/help.xsl
+++ b/common/content/help.xsl
@@ -1,15 +1,28 @@
<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">
+<!-- Header {{{1 -->
<xsl:stylesheet version="1.0"
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:liberator="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="str">
<xsl:output method="xml" indent="no"/>
+ <!-- Variable Definitions {{{1 -->
+
+ <xsl:variable name="tags">
+ <xsl:text> </xsl:text>
+ <xsl:for-each select="//@tag|//liberator:tags/text()|//liberator:tag/text()">
+ <xsl:value-of select="concat(., ' ')"/>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- Root {{{1 -->
+
<xsl:template match="liberator:document">
<html:html liberator:highlight="Help">
<html:head>
@@ -28,30 +41,17 @@
</html:html>
</xsl:template>
- <xsl:template match="liberator:include" mode="pass-2">
- <xsl:apply-templates select="document(@href)/liberator:document/node()"/>
- </xsl:template>
+ <!-- Table of Contents {{{1 -->
- <xsl:template match="liberator:h1" mode="pass-2">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- <html:div liberator:highlight="HelpTOC">
- <h2>Contents</h2>
- <xsl:call-template name="toc">
- <xsl:with-param name="level" select="2"/>
- </xsl:call-template>
- </html:div>
- </xsl:template>
<xsl:template name="toc">
<xsl:param name="level"/>
- <xsl:param name="context" select="false()"/>
+ <xsl:param name="context"/>
<xsl:variable name="tag" select="concat('h', $level)"/>
<xsl:variable name="lasttag" select="concat('h', $level - 1)"/>
<xsl:variable name="nodes" select="//liberator:document/liberator:*[
- local-name() = $tag and preceding-sibling::*[local-name() = $lasttag][not($context) or (position() = 1 and . = $context)]]"/>
+ local-name() = $tag and preceding-sibling::*[local-name() = $lasttag][position() = 1 and . = $context]]"/>
<xsl:if test="$nodes">
<html:ol liberator:highlight="HelpOrderedList">
@@ -72,39 +72,20 @@
</html:ol>
</xsl:if>
</xsl:template>
-
- <xsl:template match="liberator:dl" mode="pass-2">
+ <xsl:template match="liberator:h1" mode="pass-2">
<xsl:copy>
- <column/>
- <column/>
- <xsl:for-each select="liberator:dt">
- <tr>
- <xsl:apply-templates select="."/>
- <xsl:apply-templates select="following-sibling::liberator:dd[position()=1]"/>
- </tr>
- </xsl:for-each>
+ <xsl:apply-templates select="@*|node()"/>
</xsl:copy>
+ <html:div liberator:highlight="HelpTOC">
+ <h2>Contents</h2>
+ <xsl:call-template name="toc">
+ <xsl:with-param name="level" select="2"/>
+ <xsl:with-param name="context" select="."/>
+ </xsl:call-template>
+ </html:div>
</xsl:template>
- <xsl:template match="liberator:tags" mode="pass-2">
- <html:div style="clear: right"/>
- <xsl:call-template name="parse-tags">
- <xsl:with-param name="text" select="."/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="liberator:tag|@tag" mode="pass-2">
- <xsl:call-template name="parse-tags">
- <xsl:with-param name="text"><xsl:value-of select="."/></xsl:with-param>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="parse-tags">
- <xsl:param name="text"/>
- <tags>
- <xsl:for-each select="str:tokenize($text)">
- <html:a id="{.}"><tag><xsl:value-of select="."/></tag></html:a>
- </xsl:for-each>
- </tags>
- </xsl:template>
+ <!-- Items {{{1 -->
<xsl:template match="liberator:item" mode="pass-2">
<xsl:copy>
@@ -134,17 +115,13 @@
</xsl:when>
<xsl:otherwise>
<span>
- <xsl:choose>
- <xsl:when test="$type = 'boolean'">
- <xsl:attribute name="highlight" namespace="http://vimperator.org/namespaces/liberator">Boolean</xsl:attribute>
- </xsl:when>
- <xsl:when test="$type = 'number'">
- <xsl:attribute name="highlight" namespace="http://vimperator.org/namespaces/liberator">Number</xsl:attribute>
- </xsl:when>
- <xsl:when test="$type = 'charlist'">
- <xsl:attribute name="highlight" namespace="http://vimperator.org/namespaces/liberator">String</xsl:attribute>
- </xsl:when>
- </xsl:choose>
+ <xsl:attribute name="highlight" namespace="http://vimperator.org/namespaces/liberator">
+ <xsl:choose>
+ <xsl:when test="$type = 'boolean'">Boolean</xsl:when>
+ <xsl:when test="$type = 'number'">Number</xsl:when>
+ <xsl:when test="$type = 'charlist'">String</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
<xsl:apply-templates/>
</span>
</xsl:otherwise>
@@ -152,19 +129,41 @@
</xsl:copy>
</xsl:template>
+ <!-- Tag Definitions {{{1 -->
+
+ <xsl:template match="liberator:tags" mode="pass-2">
+ <html:div style="clear: right"/>
+ <xsl:call-template name="parse-tags">
+ <xsl:with-param name="text" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template match="liberator:tag|@tag" mode="pass-2">
+ <xsl:call-template name="parse-tags">
+ <xsl:with-param name="text"><xsl:value-of select="."/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="parse-tags">
+ <xsl:param name="text"/>
+ <tags>
+ <xsl:for-each select="str:tokenize($text)">
+ <html:a id="{.}"><tag><xsl:value-of select="."/></tag></html:a>
+ </xsl:for-each>
+ </tags>
+ </xsl:template>
+
+ <!-- Tag Links {{{1 -->
+
<xsl:template name="linkify-tag">
<xsl:param name="contents"/>
<xsl:variable name="tag" select="str:tokenize($contents, ' [')[1]"/>
<html:a href="liberator://help-tag/{$tag}" style="color: inherit;">
- <xsl:if test="
- //liberator:tags[contains(concat(' ', ., ' '), concat(' ', $tag, ' '))] |
- //liberator:tag[contains(concat(' ', ., ' '), concat(' ', $tag, ' '))] |
- //@tag[contains(concat(' ', ., ' '), concat(' ', $tag, ' '))]">
+ <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>
</xsl:template>
+
<xsl:template match="liberator:o" mode="pass-2">
<xsl:copy>
<xsl:call-template name="linkify-tag">
@@ -186,6 +185,9 @@
</xsl:call-template>
</xsl:copy>
</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>
@@ -200,10 +202,25 @@
</xsl:copy>
</xsl:template>
+ <xsl:template match="liberator:dl" mode="pass-2">
+ <xsl:copy>
+ <column/>
+ <column/>
+ <xsl:for-each select="liberator:dt">
+ <tr>
+ <xsl:apply-templates select="."/>
+ <xsl:apply-templates select="following-sibling::liberator:dd[position()=1]"/>
+ </tr>
+ </xsl:for-each>
+ </xsl:copy>
+ </xsl:template>
+
<xsl:template match="liberator:link" mode="pass-2">
<html:a href="{@topic}"><xsl:apply-templates select="@*|node()"/></html:a>
</xsl:template>
+ <!-- Special Element Templates {{{1 -->
+
<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">
@@ -214,9 +231,14 @@
</form>
</xsl:template>
- <!-- This does't work. Why?
- <xsl:include href="chrome://liberator/content/overlay.xsl"/>
- -->
+ <!-- Process Inclusions {{{1 -->
+
+ <xsl:template match="liberator:include" mode="pass-2">
+ <xsl:apply-templates select="document(@href)/liberator:document/node()"/>
+ </xsl:template>
+
+ <!-- Process Overlays {{{1 -->
+
<xsl:variable name="overlay" select="concat('liberator://help-overlay/', /liberator:document/@name)"/>
<xsl:variable name="overlaydoc" select="document($overlay)/liberator:overlay"/>
@@ -262,6 +284,8 @@
</xsl:call-template>
</xsl:template>
+ <!-- Process Tree {{{1 -->
+
<xsl:template match="@*|node()" mode="pass-2">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
@@ -272,4 +296,4 @@
</xsl:template>
</xsl:stylesheet>
-<!-- vim:se ft=xslt sts=4 sw=4 et: -->
+<!-- vim:se ft=xslt sts=4 sw=4 et fdm=marker: -->