diff options
author | Alistair Thomas <astavale@yahoo.co.uk> | 2017-03-05 20:07:26 +0000 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2017-03-12 14:15:48 +0100 |
commit | 0e6ca4cf4703687ae2f8f1e273e9629ab29e17a7 (patch) | |
tree | af60aeb0188aa1c07a41e6c173e388bcd2cd6cf3 /doc | |
parent | 5d846a2cc6ad11c1f931b682d7d67f49e07c9043 (diff) | |
download | vala-0e6ca4cf4703687ae2f8f1e273e9629ab29e17a7.tar.gz |
manual: Generate section and sub-section numbers
Diffstat (limited to 'doc')
-rw-r--r-- | doc/manual/Makefile.am | 4 | ||||
-rw-r--r-- | doc/manual/default.css | 15 | ||||
-rw-r--r-- | doc/manual/xhtml.xsl | 60 |
3 files changed, 60 insertions, 19 deletions
diff --git a/doc/manual/Makefile.am b/doc/manual/Makefile.am index 08ec8182b..342feb46e 100644 --- a/doc/manual/Makefile.am +++ b/doc/manual/Makefile.am @@ -11,7 +11,7 @@ book_DATA = \ endif $(builddir)/devhelp/*: devhelp -devhelp: manual.xml version.xml devhelp.xsl xhtml.xsl +devhelp: manual.xml version.xml devhelp.xsl xhtml.xsl default.css @$(MKDIR_P) $@ $(AM_V_GEN)$(XSLTPROC) \ --xinclude \ @@ -26,7 +26,7 @@ devhelp: manual.xml version.xml devhelp.xsl xhtml.xsl @cp $(srcdir)/default.css $@ @touch $@ -html: manual.xml version.xml xhtml.xsl +html: manual.xml version.xml xhtml.xsl default.css @$(MKDIR_P) $@ $(AM_V_GEN)$(XSLTPROC) \ --xinclude \ diff --git a/doc/manual/default.css b/doc/manual/default.css index 3c432ccb4..93d3ee39e 100644 --- a/doc/manual/default.css +++ b/doc/manual/default.css @@ -47,6 +47,21 @@ a:link, a:visited, a:hover, a:active { background-color: #ddd; } +.page_toc { + list-style: none; +} + +.page_toc a { + width: 18em; + display: block; + border-radius: 0.4em; + padding-left: 0.4em; +} + +.page_toc a:hover, .page_toc a:focus { + background: #ddd; +} + h3 { /* ensure anchors don't vanish below the fixed header */ padding-top: 1.4em; diff --git a/doc/manual/xhtml.xsl b/doc/manual/xhtml.xsl index 97338467c..ca7f39b93 100644 --- a/doc/manual/xhtml.xsl +++ b/doc/manual/xhtml.xsl @@ -26,6 +26,7 @@ <xsl:apply-templates select="article/section/title[1]" mode="html-head"/> </head><xsl:call-template name="whitespace-newline"/> <body><xsl:call-template name="whitespace-newline"/> + <xsl:apply-templates select="/article/section/title" mode="navigation-bar"/> <xsl:apply-templates select="article" mode="toc"/> </body><xsl:call-template name="whitespace-newline"/> </html> @@ -49,18 +50,21 @@ <xsl:apply-templates select="title" mode="html-head"/> </head> <body> - <div class="header"> - <a href="index.html"><xsl:value-of select="/article/section/title"/></a> - </div> - <xsl:apply-templates select="title"/> + <xsl:apply-templates + select="/article/section/title" + mode="navigation-bar" + /> + <xsl:apply-templates select="title" mode="heading"/> <xsl:if test="count(section) > 0"> <ul class="page_toc"> <xsl:for-each select="section"> <li> <xsl:call-template name="linkto"> + <xsl:with-param name="title"> + <xsl:apply-templates select="title" mode="numbered-level-two"/> + </xsl:with-param> <xsl:with-param name="page" select="../title"/> <xsl:with-param name="subpage" select="title"/> - <xsl:with-param name="title" select="title"/> </xsl:call-template> </li> </xsl:for-each> @@ -96,22 +100,23 @@ <xsl:apply-templates select="articleinfo|section"/> </xsl:template> - <xsl:template match="article/section/title"> + <xsl:template match="article/section/title" mode="navigation-bar"> <div class="header"> <a href="index.html"><xsl:value-of select="."/></a> </div> - <h1><xsl:value-of select="."/></h1> </xsl:template> <xsl:template match="article/section" mode="toc"> - <xsl:apply-templates select="title"/> + <h1><xsl:apply-templates select="title"/></h1> <xsl:apply-templates select="document('version.xml')/articleinfo" mode="toc"/> <ul class="toc"> <xsl:for-each select="section"> <li> <xsl:call-template name="linkto"> + <xsl:with-param name="title"> + <xsl:apply-templates select="title" mode="numbered-level-one"/> + </xsl:with-param> <xsl:with-param name="page" select="title"/> - <xsl:with-param name="title" select="title"/> </xsl:call-template> <xsl:if test="count(section) > 0"> <xsl:call-template name="whitespace-newline"/> @@ -119,9 +124,11 @@ <xsl:for-each select="section"> <li> <xsl:call-template name="linkto"> + <xsl:with-param name="title"> + <xsl:apply-templates select="title" mode="numbered-level-two"/> + </xsl:with-param> <xsl:with-param name="page" select="../title"/> <xsl:with-param name="subpage" select="title"/> - <xsl:with-param name="title" select="title"/> </xsl:call-template> </li> </xsl:for-each> @@ -151,12 +158,8 @@ </table> </xsl:template> - <xsl:template match="article/section/section/title"> - <h2><xsl:value-of select="."/></h2> - </xsl:template> - - <xsl:template match="article/section/section/section"> - <xsl:apply-templates select="para|section|programlisting|screen|itemizedlist|title|informaltable"/> + <xsl:template match="article/section/section/title" mode="heading"> + <h2><xsl:apply-templates select="." mode="numbered-level-one"/></h2> </xsl:template> <xsl:template match="article/section/section/section/title"> @@ -167,7 +170,30 @@ </xsl:variable> <xsl:call-template name="whitespace-newline"/> <xsl:call-template name="whitespace-newline"/> - <h3 id="{$id}"><xsl:value-of select="."/></h3> + <h3 id="{$id}"><xsl:apply-templates select="." mode="numbered-level-two"/></h3> + </xsl:template> + + <xsl:template match="title" mode="numbered-level-one"> + <xsl:number + count="/article/section/section[ancestor::*]" + from="/article/section" + level="multiple" + format="1. " + /> + <xsl:value-of select="text()"/> + </xsl:template> + + <xsl:template match="title" mode="numbered-level-two"> + <xsl:number + count="article/section/section|article/section/section/section" + level="multiple" + format="1 " + /> + <xsl:value-of select="text()"/> + </xsl:template> + + <xsl:template match="article/section/section/section"> + <xsl:apply-templates select="para|section|programlisting|screen|itemizedlist|title|informaltable"/> </xsl:template> <xsl:template match="article/section/section/section/section"> |