1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-04 12:15:45 +01:00

Make <toc/> tag explicit.

This commit is contained in:
Kris Maglione
2009-11-01 22:13:50 -05:00
parent eaf184ae9b
commit 8eea868626
23 changed files with 54 additions and 13 deletions

View File

@@ -115,14 +115,15 @@
<!-- Table of Contents {{{1 -->
<xsl:template name="toc">
<xsl:param name="level"/>
<xsl:param name="level" select="1"/>
<xsl:param name="context"/>
<xsl:param name="toc"/>
<xsl:variable name="tag" select="concat('h', $level)"/>
<xsl:variable name="lasttag" select="concat('h', $level - 1)"/>
<xsl:variable name="nodes" select="//following-sibling::liberator:*[
local-name() = $tag and preceding-sibling::*[local-name() = $lasttag][position() = 1 and . = $context]]"/>
<xsl:variable name="nodes" select="$toc/*[
local-name() = $tag and not(preceding::*[local-name() = $lasttag][position() = 1 and not(.=$context)])]"/>
<xsl:if test="$nodes">
<html:ol liberator:highlight="HelpOrderedList">
@@ -137,24 +138,37 @@
<xsl:call-template name="toc">
<xsl:with-param name="level" select="$level + 1"/>
<xsl:with-param name="context" select="."/>
<xsl:with-param name="toc" select="$toc"/>
</xsl:call-template>
</li>
</xsl:for-each>
</html:ol>
</xsl:if>
</xsl:template>
<xsl:template match="liberator:h1" mode="pass-2">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<xsl:if test="not($root//liberator:h1[2])">
<!-- Makes :help all impossibly slow. Why? -->
<xsl:template match="liberator:toc" mode="pass-2">
<xsl:variable name="TOC">
<context/>
<xsl:for-each
select="following::liberator:h1|following::liberator:h2|following::liberator:h3|following::liberator:h4|following::liberator:h5">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="toc" select="exsl:node-set($TOC)"/>
<xsl:if test="//liberator:toc[1 and self::*]">
<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>
<xsl:if test="@start">
<xsl:call-template name="toc">
<xsl:with-param name="level" select="number(@start)"/>
<xsl:with-param name="toc" select="$toc"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(@start)">
<xsl:call-template name="toc">
<xsl:with-param name="toc" select="$toc"/>
</xsl:call-template>
</xsl:if>
</html:div>
</xsl:if>
</xsl:template>

View File

@@ -10,6 +10,8 @@
xmlns:html="http://www.w3.org/1999/xhtml">
<tags>all</tags>
<toc/>
<include href="intro" tag="intro.html"/>
<include href="starting" tag="starting.html"/>
<include href="browsing" tag="browsing.html"/>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="autocommands">Automatic commands</h1>
<toc start="2"/>
<p>
Autocommands are a way to automatically execute code when

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="surfing browsing">Browsing</h1>
<toc start="2"/>
&liberator.appname; overrides nearly all &liberator.host; keys in order to make browsing more
pleasant for Vim users. On the rare occasions when you want to pass a keystroke

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="buffer document">Buffer</h1>
<toc start="2"/>
&liberator.appname; holds exactly one buffer object for each tab. It is usually an
(X)HTML document with advanced features.

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="Command-line-mode Command-line mode-cmdline">Command-line mode</h1>
<toc start="2"/>
Command-line mode is used to enter Ex commands (<k>:</k>) and text search patterns
(<k>/</k> and <k>?</k>).

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="developer-information">Developer information</h1>
<toc start="2"/>
<h2 tag="writing-docs documentation">Writing documentation</h2>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="expression expr eval">Expression evaluation</h1>
<toc start="2"/>
<!-- INTRO TO BE WRITTEN… -->

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="gui">&liberator.appname;'s GUI</h1>
<toc start="2"/>
<p>
Although &liberator.appname; offers the most frequently used &liberator.host; functionality via

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="quick-hints hints">Hints</h1>
<toc start="2"/>
Hints are the way in which &liberator.appname; allows you to follow links on a page. By
providing each link with a suitable hint, you can access all links with a

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="index">Index</h1>
<toc start="2"/>
This file contains a list of all available commands, mappings and options.

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="Insert-mode Insert mode-insert">Insert mode</h1>
<toc start="2"/>
<p>
Insert mode is used to enter text in text boxes and text areas. When

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1>Key mappings, abbreviations, and user-defined commands</h1>
<toc start="2"/>
<h2 tag="key-mapping mapping map macro">Key mapping</h2>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="different-marks marks">Marks</h1>
<toc start="2"/>
<p>
&liberator.appname; supports a number of different marks:
@@ -22,6 +23,7 @@
</ul>
<h1 tag="bookmarks">Bookmarks</h1>
<toc start="2"/>
<item>
<tags>a :bma :bmark</tags>
@@ -106,6 +108,7 @@
</item>
<!-- TODO: why is this duplicated in browsing? -->
<h1 tag="history">History</h1>
<toc start="2"/>
<item>
<tags><![CDATA[<C-o>]]></tags>
@@ -201,6 +204,7 @@
</item>
<h1 tag="quickmarks">QuickMarks</h1>
<toc start="2"/>
<item>
<tags>go</tags>
@@ -288,6 +292,7 @@
</description>
</item>
<h1 tag="localmarks">Local marks</h1>
<toc start="2"/>
<item>
<tags>m</tags>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="messages">Error and informational messages</h1>
<toc start="2"/>
<tags>message-history</tags>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="options">Options</h1>
<toc start="2"/>
<p>
&liberator.appname; has a number of internal variables and switches which can be set to

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="text-search-commands">Text search commands</h1>
<toc start="2"/>
<p>
&liberator.appname; provides a Vim-like interface to &liberator.host;'s standard text search

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="printing">Printing</h1>
<toc start="2"/>
<item>
<tags>:ha :hardcopy</tags>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="repeating">Repeating commands</h1>
<toc start="2"/>
<p>&liberator.appname; can repeat a number of commands and record macros.</p>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="starting">Starting &liberator.appname;</h1>
<toc start="2"/>
<tags>startup-options</tags>

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="styling">Styling the GUI and web pages</h1>
<toc start="2"/>
<p>
&liberator.appname; allows you to style both the browser and any web pages you view. All

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="tabs">Tabs</h1>
<toc start="2"/>
<p>
Tabs are used to be able to view many web pages at the same time. Each tab

View File

@@ -9,6 +9,7 @@
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1>Other help</h1>
<toc start="2"/>
<h2 tag="various">Various commands</h2>