devhelp support patch
- From: James Henstridge <james daa com au>
- To: gtk-doc-list gnome org
- Subject: devhelp support patch
- Date: Mon, 12 Aug 2002 22:09:31 +0800
Here is an update for my devhelp XSLT work. This time it is in the form
of a patch against gtk-doc. With the patch, a .devhelp file is
generated when you run gtkdoc-mkhtml in xml mode.
If the html files are installed into $(datadir)/devhelp/books/bookname
and the .devhelp file is put in $(datadir)/devhelp/specs/, the
documentation will appear in the documentation list in devhelp.
Creating the extra file doesn't add much to the processing time, so I
would be inclined to always generate the .devhelp file. Does anyone
have any comments on the patch?
James.
--
Email: james daa com au | Linux.conf.au http://linux.conf.au/
WWW: http://www.daa.com.au/~james/ | Jan 22-25 Perth, Western Australia.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk-doc/ChangeLog,v
retrieving revision 1.118
diff -u -p -r1.118 ChangeLog
--- ChangeLog 10 Aug 2002 08:36:46 -0000 1.118
+++ ChangeLog 12 Aug 2002 13:53:46 -0000
@@ -1,3 +1,10 @@
+2002-08-12 James Henstridge <james daa com au>
+
+ * gtk-doc.xsl: include devhelp.xsl, and call generate.devhelp when
+ processing the docbook/xml input.
+
+ * devhelp.xsl: new file, implements .devhelp file output.
+
2002-08-08 James Henstridge <james daa com au>
* gtk-doc.xsl: add a gtkdoc.bookname param, and include it in the
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk-doc/Makefile.am,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.am
--- Makefile.am 13 Jun 2002 17:22:25 -0000 1.17
+++ Makefile.am 12 Aug 2002 13:53:46 -0000
@@ -16,12 +16,14 @@ gtkdocdata_DATA = \
gtk-doc.dsl \
gtk-doc.dcl \
gtk-doc.xsl \
+ devhelp.xsl \
xml.dcl
EXTRA_DIST= \
gtk-doc.spec.in \
gtk-doc.dcl \
gtk-doc.xsl \
+ devhelp.xsl \
xml.dcl
dist-hook:
Index: gtk-doc.xsl
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtk-doc.xsl,v
retrieving revision 1.2
diff -u -p -r1.2 gtk-doc.xsl
--- gtk-doc.xsl 10 Aug 2002 08:36:46 -0000 1.2
+++ gtk-doc.xsl 12 Aug 2002 13:53:47 -0000
@@ -6,6 +6,7 @@
<!-- import the chunked XSL stylesheet -->
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
+ <xsl:include href="devhelp.xsl"/>
<xsl:output method="xml" indent="yes"/>
@@ -29,7 +30,8 @@
<!-- generate the index.sgml href index -->
<xsl:call-template name="generate.index"/>
- </xsl:template>
+ <xsl:call-template name="generate.devhelp"/>
+ </xsl:template>
<xsl:template name="generate.index">
<xsl:call-template name="write.text.chunk">
--- /dev/null Thu Apr 11 22:25:15 2002
+++ devhelp.xsl Mon Aug 12 19:47:09 2002
@@ -0,0 +1,126 @@
+<?xml version='1.0'?> <!--*- mode: xml -*-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'
+ xmlns="http://www.devhelp.net/book"
+ exclude-result-prefixes="#default">
+
+ <xsl:template name="generate.devhelp">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:choose>
+ <xsl:when test="$gtkdoc.bookname">
+ <xsl:value-of select="$gtkdoc.bookname"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>book</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>.devhelp</xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'"/>
+ <xsl:with-param name="indent" select="'yes'"/>
+ <xsl:with-param name="encoding" select="'utf-8'"/>
+ <xsl:with-param name="content">
+ <xsl:call-template name="devhelp"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="devhelp">
+ <xsl:variable name="title">
+ <xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
+ </xsl:variable>
+ <xsl:variable name="link">
+ <xsl:call-template name="href.target"/>
+ </xsl:variable>
+ <xsl:variable name="author">
+ <xsl:if test="articleinfo|bookinfo">
+ <xsl:apply-templates mode="generate.devhelp.authors"
+ select="articleinfo|bookinfo"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="toc.nodes" select="part|reference|preface|chapter|
+ appendix|article|bibliography|
+ glossary|index|refentry|
+ bridgehead"/>
+
+ <book title="{$title}" link="{$link}" author="{$author}" name="{$gtkdoc.bookname}">
+ <xsl:if test="$toc.nodes">
+ <chapters>
+ <xsl:apply-templates select="$toc.nodes"
+ mode="generate.devhelp.toc.mode"/>
+ </chapters>
+ </xsl:if>
+ <functions>
+ <xsl:apply-templates select="//refsect2"
+ mode="generate.devhelp.index.mode"/>
+ </functions>
+ </book>
+ </xsl:template>
+
+ <xsl:template match="*" mode="generate.devhelp.toc.mode">
+ <xsl:variable name="title">
+ <xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
+ </xsl:variable>
+ <xsl:variable name="target">
+ <xsl:variable name="anchor" select="title/anchor"/>
+ <xsl:choose>
+ <xsl:when test="$anchor">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$anchor"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="href.target"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <sub name="{$title}" link="{$target}">
+ <xsl:apply-templates select="section|sect1|sect2|
+ refentry|refsect|refsect1|refsect2|
+ bridgehead|part"
+ mode="generate.devhelp.toc.mode"/>
+ </sub>
+ </xsl:template>
+
+ <xsl:template match="*" mode="generate.devhelp.index.mode">
+ <xsl:variable name="title" select="title"/>
+ <xsl:variable name="anchor" select="title/anchor"/>
+ <xsl:if test="not($anchor/@href)">
+ <xsl:variable name="target">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$anchor"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <function name="{$title}" link="{$target}"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- get title -->
+ <xsl:template match="article" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="articleinfo/title"/>
+ </xsl:template>
+ <xsl:template match="book" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="bookinfo/title"/>
+ </xsl:template>
+ <xsl:template match="refentry" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="refmeta/refentrytitle"/>
+ </xsl:template>
+ <xsl:template match="*" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="title"/>
+ </xsl:template>
+
+ <!-- generate list of authors ... -->
+ <xsl:template match="articleinfo|bookinfo" mode="generate.devhelp.authors">
+ <xsl:for-each select="authorgroup/author">
+ <xsl:value-of select="firstname"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="surname"/>
+ <xsl:if test="not(last())">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]