diff options
author | infirit <[email protected]> | 2014-01-08 17:18:07 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-01-08 17:18:07 +0100 |
commit | 8cd560b2f3ba55a1ac45f4dcd859f8470897ffe4 (patch) | |
tree | 6117cb4524e23e78e6bf8bbf7a0cfca460908983 | |
parent | 2ff6fb9f311f46c757fdbff994b6c45673b1369d (diff) | |
download | python-caja-8cd560b2f3ba55a1ac45f4dcd859f8470897ffe4.tar.bz2 python-caja-8cd560b2f3ba55a1ac45f4dcd859f8470897ffe4.tar.xz |
Bring gtk-doc up to date.
It should build again and be properly included with make dist.
Based on nautilus-python changes, see below for the details.
https://git.gnome.org/browse/nautilus-python/log/docs?h=nautilus-3.0
-rw-r--r-- | docs/Makefile.am | 38 | ||||
-rw-r--r-- | docs/xsl/common.xsl | 19 | ||||
-rw-r--r-- | docs/xsl/devhelp.xsl | 154 | ||||
-rwxr-xr-x | docs/xsl/fixxref.py | 67 | ||||
-rw-r--r-- | docs/xsl/html.xsl | 285 | ||||
-rw-r--r-- | docs/xsl/pdf-style.xsl | 11 | ||||
-rw-r--r-- | docs/xsl/pdf.xsl | 259 | ||||
-rw-r--r-- | docs/xsl/ref-html-style.xsl | 54 | ||||
-rw-r--r-- | docs/xsl/style.css | 10 |
9 files changed, 886 insertions, 11 deletions
diff --git a/docs/Makefile.am b/docs/Makefile.am index 6416f94..d406f66 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -3,10 +3,10 @@ BUILDDIR = $(top_builddir)/docs REF_VERSION = $(VERSION) FULL_VERSION = $(VERSION) -HTML_STYLE = $(PYGOBJECT_DATADIR)/pygobject/xsl/ref-html-style.xsl -PDF_STYLE = $(PYGOBJECT_DATADIR)/pygobject/xsl/pdf-style.xsl +FIXXREF = $(srcdir)/xsl/fixxref.py +HTML_STYLE = $(srcdir)/xsl/ref-html-style.xsl -XMLFILES = \ +XML_FILES = \ reference/caja-python-ref.xml \ reference/caja-python-overview.xml \ reference/caja-python-overview-example.xml \ @@ -27,7 +27,7 @@ XMLFILES = \ reference/caja-python-operation-result.xml HTMLdir = $(datadir)/gtk-doc/html/caja-python -HTMLFILES = \ +HTML_FILES = \ html/index.html \ html/index.sgml \ html/caja-python-overview.html \ @@ -48,39 +48,55 @@ HTMLFILES = \ html/caja-python-enum-reference.html \ html/enum-caja-python-operation-result.html \ html/caja-python.devhelp +HTML_DATA = $(HTML_FILES) -CSS_FILES = $(PYGOBJECT_PYGDOCS)/style.css +XSL_FILES = \ + xsl/common.xsl \ + xsl/devhelp.xsl \ + xsl/html.xsl \ + xsl/pdf-style.xsl \ + xsl/pdf.xsl \ + xsl/style.css +XSL_DATA = $(XSL_FILES) $(FIXXREF) +XSLdir = $(BUILDDIR)/xsl + +CSS_FILES = xsl/style.css CSSdir = $(HTMLdir) CSS_DATA = $(CSS_FILES) BUILT_SOURCES = \ reference/builddate.xml \ - $(HTMLFILES) + $(HTML_FILES) CLEANFILES = \ caja-python-ref.* \ reference/builddate.xml \ - $(HTMLFILES) + $(HTML_FILES) EXTRA_DIST = \ - $(XMLFILES) + $(XML_FILES) \ + $(XSL_FILES) \ + $(FIXXREF) \ + $(HTML_STYLE) REFERENCE_DEPS = \ reference \ - $(XMLFILES) + $(XML_FILES) \ + $(XSL_FILES) \ + $(FIXXREF) if ENABLE_GTK_DOC reference/builddate.xml: $(REFERENCE_DEPS) $(PYTHON) -c 'import datetime; print datetime.date.today()' > $@ -$(HTMLFILES): $(REFERENCE_DEPS) +$(HTML_FILES): $(REFERENCE_DEPS) xsltproc --nonet --xinclude -o $(BUILDDIR)/html/ \ --path $(BUILDDIR)/reference:$(srcdir)/reference \ --stringparam gtkdoc.bookname "caja-python" \ --stringparam gtkdoc.version ${REF_VERSION} \ $(HTML_STYLE) $(srcdir)/reference/caja-python-ref.xml - $(PYGOBJECT_FIXXREF) -i $(PYGOBJECT_PYGDOCS) $(BUILDDIR)/html + $(FIXXREF) -i xsl $(BUILDDIR)/html touch $@ endif diff --git a/docs/xsl/common.xsl b/docs/xsl/common.xsl new file mode 100644 index 0000000..606313f --- /dev/null +++ b/docs/xsl/common.xsl @@ -0,0 +1,19 @@ +<?xml version='1.0'?> +<!DOCTYPE xsl:stylesheet [ +]> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + +<xsl:template match="parameter"> + <xsl:choose> + <xsl:when test="@role = 'keyword'"> + <xsl:call-template name="inline.boldmonoseq"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="inline.italicmonoseq"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> diff --git a/docs/xsl/devhelp.xsl b/docs/xsl/devhelp.xsl new file mode 100644 index 0000000..ce27739 --- /dev/null +++ b/docs/xsl/devhelp.xsl @@ -0,0 +1,154 @@ +<?xml version='1.0'?> +<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|sect1"/> + + <book title="{$title}" link="{$link}" author="{$author}" name="{$gtkdoc.bookname}" language="python"> + <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="//refsect1" + mode="generate.devhelp.constructor.index.mode"/> + <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| + refentry|refsect| + bridgehead|part|chapter" + 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:variable name="target"> + <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> + <function name="{$title}" link="{$target}"/> + </xsl:template> + + <xsl:template match="*" mode="generate.devhelp.constructor.index.mode"> + <xsl:variable name="title" select="title"/> + <xsl:variable name="anchor" select="title/anchor"/> + <xsl:variable name="target"> + <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> + <xsl:if test="$title='Constructor'"> + <xsl:variable name ="constructor" select="programlisting//methodname"/> + <function name="{$constructor}" 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="refnamediv/refname"/> + </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> diff --git a/docs/xsl/fixxref.py b/docs/xsl/fixxref.py new file mode 100755 index 0000000..f3287b3 --- /dev/null +++ b/docs/xsl/fixxref.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- + +import getopt +import os +import re +import sys + +anchors = {} +anchor_pat = re.compile(r'''^\s*<ANCHOR\s+id\s*=\s*"([^"]*)"\s+ + href\s*=\s*"([^"]*)"\s*>''', + re.MULTILINE | re.VERBOSE) +link_pat = re.compile(r'''<PYGTKDOCLINK\s+HREF="([^"]*)"\s*>(.*?) + </PYGTKDOCLINK\s*>''', re.DOTALL | re.VERBOSE) +def scan_index_dir(idir): + for root, dirs, files in os.walk(idir): + if 'index.sgml' in files: + scan_index_file(os.path.join(root, 'index.sgml')) + return + +def scan_index_file(ifile): + buf = open(ifile).read() + for id, href in anchor_pat.findall(buf): + anchors[id] = href + +def fix_xrefs(hdir): + for f in os.listdir(hdir): + if os.path.splitext(f)[1] == '.html': + fix_html_file(os.path.join(hdir, f)) + +def link_subst(m): + id, text = m.groups() + if anchors.has_key(id): + return '<a\nhref="../' + anchors[id] + '"\n>' + text + '</a>' + return text + +def fix_html_file(hfile): + buf = open(hfile).read() + buf = link_pat.sub(link_subst, buf) + open(hfile, 'w').write(buf) + +def usage(e=None): + if e: + sys.stderr.write('fixxref.py: %s\n' % e) + sys.stderr.write('usage: fixxref.py [-i index-dir] html-dir\n') + sys.exit(1) + +if __name__ == '__main__': + try: + opts, args = getopt.getopt(sys.argv[1:], "i:h:", + ["index-dir=", "html-dir="]) + except getopt.error, e: + usage(e) + + index_dirs = [] + for opt, arg in opts: + if opt in ('-i', '--index-dir'): + index_dirs.append(arg) + + if len(args) != 1: + usage() + + for idir in index_dirs: + scan_index_dir(idir) + + html_dir = args[0] + fix_xrefs(html_dir) diff --git a/docs/xsl/html.xsl b/docs/xsl/html.xsl new file mode 100644 index 0000000..d8fea78 --- /dev/null +++ b/docs/xsl/html.xsl @@ -0,0 +1,285 @@ +<?xml version='1.0'?> +<!DOCTYPE xsl:stylesheet [ +<!ENTITY RE " "> +<!ENTITY nbsp " "> +]> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + +<xsl:param name="html.stylesheet">style.css</xsl:param> +<xsl:param name="use.id.as.filename" select="1"/> +<xsl:param name="chunk.fast" select="1"/> +<xsl:param name="chunker.output.encoding" select="'utf-8'"/> + +<xsl:param name="linenumbering.extension" select="1"/> +<xsl:param name="variablelist.as.table" select="1"/> + +<xsl:template match="blockquote"> + <div class="{local-name(.)}"> + <xsl:if test="@lang or @xml:lang"> + <xsl:call-template name="language.attribute"/> + </xsl:if> + <xsl:call-template name="anchor"/> + + <xsl:choose> + <xsl:when test="attribution"> + <table border="0" width="100%" + cellspacing="0" cellpadding="0" class="blockquote" + summary="Block quote"> + <tr> + <td width="10%" valign="top"> </td> + <td width="80%" valign="top"> + <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/> + </td> + <td width="10%" valign="top"> </td> + </tr> + <tr> + <td colspan="2" align="right" valign="top"> + <xsl:text>--</xsl:text> + <xsl:apply-templates select="attribution"/> + </td> + <td width="10%" valign="top"> </td> + </tr> + </table> + </xsl:when> + <xsl:when test="@role = 'properties' or @role = 'prototypes'"> + <table width="100%" border="0" bgcolor="#E0E0E0"> + <tr> + <td valign="top"> + <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/> + </td> + </tr> + </table> + </xsl:when> + <xsl:otherwise> + <blockquote class="{local-name(.)}"> + <xsl:apply-templates/> + </blockquote> + </xsl:otherwise> + </xsl:choose> + </div> +</xsl:template> + + <!-- support for Python language for synopsises --> + <xsl:template match="classsynopsis + |fieldsynopsis + |methodsynopsis + |constructorsynopsis + |destructorsynopsis"> + <xsl:param name="language"> + <xsl:choose> + <xsl:when test="@language"> + <xsl:value-of select="@language"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-classsynopsis-language"/> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + <xsl:choose> + <xsl:when test="$language='python'"> + <xsl:apply-templates select="." mode="python"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-imports/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="classsynopsis" mode="python"> + <table bgcolor="#D0E0F0" width="100%"> + <tr><td> + <pre class="{name(.)}"> + <xsl:text>class </xsl:text> + <xsl:apply-templates select="ooclass[1]" mode="python"/> + <xsl:if test="ooclass[position() > 1]"> + <xsl:text>(</xsl:text> + <xsl:apply-templates select="ooclass[position() > 1]" mode="python"/> <xsl:text>)</xsl:text> + </xsl:if> + <xsl:text>:&RE;</xsl:text> + + <xsl:apply-templates select="constructorsynopsis + |destructorsynopsis + |fieldsynopsis + |methodsynopsis + |classsynopsisinfo" mode="python"/> + </pre></td></tr></table> + </xsl:template> + + <xsl:template match="classsynopsisinfo" mode="python"> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="ooclass|oointerface|ooexception" mode="python"> + <xsl:if test="position() > 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> + + <xsl:template match="modifier" mode="python"> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + <xsl:text> </xsl:text> + </span> + </xsl:template> + + <xsl:template match="classname" mode="python"> + <xsl:if test="name(preceding-sibling::*[1]) = 'classname'"> + <xsl:text>, </xsl:text> + </xsl:if> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> + + <xsl:template match="interfacename" mode="python"> + <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'"> + <xsl:text>, </xsl:text> + </xsl:if> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> + + <xsl:template match="exceptionname" mode="python"> + <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'"> + <xsl:text>, </xsl:text> + </xsl:if> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> + + <xsl:template match="fieldsynopsis" mode="python"> + <code class="{name(.)}"> + <xsl:text> </xsl:text> + <xsl:apply-templates mode="python"/> + </code> + <xsl:call-template name="synop-break"/> + </xsl:template> + + <xsl:template match="type" mode="python"> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + <xsl:text> </xsl:text> + </span> + </xsl:template> + + <xsl:template match="varname" mode="python"> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + <xsl:text> </xsl:text> + </span> + </xsl:template> + + <xsl:template match="initializer" mode="python"> + <span class="{name(.)}"> + <xsl:text>=</xsl:text> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> + + <xsl:template match="void" mode="python"> + <span class="{name(.)}"> + <xsl:text>void </xsl:text> + </span> + </xsl:template> + + <xsl:template match="methodname" mode="python"> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> + + <xsl:template match="methodparam" mode="python"> + <xsl:if test="position() > 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> + + <xsl:template mode="python" + match="destructorsynopsis|methodsynopsis"> + + <code class="{name(.)}"> + <xsl:text> def </xsl:text> + <xsl:apply-templates select="methodname" mode="python"/> + <xsl:text>(</xsl:text> + <xsl:apply-templates select="methodparam" mode="python"/> + <xsl:text>)</xsl:text> + </code> + <xsl:call-template name="synop-break"/> + </xsl:template> + + <xsl:template mode="python" + match="constructorsynopsis"> + + <code class="{name(.)}"> + <xsl:text> </xsl:text> + <xsl:apply-templates select="methodname" mode="python"/> + <xsl:text>(</xsl:text> + <xsl:apply-templates select="methodparam" mode="python"/> + <xsl:text>)</xsl:text> + </code> + <xsl:call-template name="synop-break"/> + </xsl:template> + +<!-- this was the original parameter python mode styling + <xsl:template match="parameter" mode="python"> + <span class="{name(.)}"> + <xsl:apply-templates mode="python"/> + </span> + </xsl:template> +--> + + <!-- hack --> + <xsl:template match="link" mode="python"> + <xsl:apply-templates select="."/> + </xsl:template> + + <!-- ========================================================= --> + <!-- template to output gtkdoclink elements for the unknown targets --> + + <xsl:template match="link"> + <xsl:choose> + <xsl:when test="id(@linkend)"> + <xsl:apply-imports/> + </xsl:when> + <xsl:otherwise> + <PYGTKDOCLINK HREF="{@linkend}"> + <xsl:apply-templates/> + </PYGTKDOCLINK> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="parameter" mode="python"> + <span class="{name(.)}"> + <xsl:choose> + <xsl:when test="@role = 'keyword'"> + <xsl:call-template name="inline.boldmonoseq"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="inline.italicmonoseq"/> + </xsl:otherwise> + </xsl:choose> + </span> +</xsl:template> + +<xsl:template match="variablelist"> + <table border="0" width="100%" bgcolor="#FFECCE"> + <col align="left" valign="top" width="0*"> + </col> + <tbody> + <xsl:apply-templates select="varlistentry" mode="varlist-table"/> + </tbody> + </table> +</xsl:template> + +</xsl:stylesheet> diff --git a/docs/xsl/pdf-style.xsl b/docs/xsl/pdf-style.xsl new file mode 100644 index 0000000..d4a8e02 --- /dev/null +++ b/docs/xsl/pdf-style.xsl @@ -0,0 +1,11 @@ +<?xml version='1.0'?> <!--*- mode: xml -*--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> +<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/> +<xsl:include href="common.xsl"/> +<xsl:include href="pdf.xsl"/> + +<xsl:param name="section.autolabel" select="1"/> +<xsl:param name="section.label.includes.component.label" select="1"/> + +</xsl:stylesheet> diff --git a/docs/xsl/pdf.xsl b/docs/xsl/pdf.xsl new file mode 100644 index 0000000..375ba40 --- /dev/null +++ b/docs/xsl/pdf.xsl @@ -0,0 +1,259 @@ +<?xml version='1.0'?> +<!DOCTYPE xsl:stylesheet [ +<!ENTITY RE " "> +<!ENTITY nbsp " "> +]> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version='1.0'> + +<xsl:param name="body.margin.top">0.5in</xsl:param> + +<xsl:template name="is.graphic.extension"> + <xsl:param name="ext"></xsl:param> + <xsl:if test="$ext = 'png' + or $ext = 'pdf' + or $ext = 'jpeg' + or $ext = 'gif' + or $ext = 'tif' + or $ext = 'tiff' + or $ext = 'bmp'">1</xsl:if> +</xsl:template> + + <!-- support for Python language for synopsises --> + <xsl:template match="classsynopsis + |fieldsynopsis + |methodsynopsis + |constructorsynopsis + |destructorsynopsis"> + <xsl:param name="language"> + <xsl:choose> + <xsl:when test="@language"> + <xsl:value-of select="@language"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-classsynopsis-language"/> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + <xsl:choose> + <xsl:when test="$language='python'"> + <xsl:apply-templates select="." mode="python"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-imports/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="classsynopsis" mode="python"> + <fo:block wrap-option='no-wrap' + white-space-collapse='false' + linefeed-treatment="preserve" + xsl:use-attribute-sets="monospace.verbatim.properties" + background-color="#E0E0E0"> + <xsl:text>class </xsl:text> + <xsl:apply-templates select="ooclass[1]" mode="python"/> + <xsl:if test="ooclass[position() > 1]"> + <xsl:text>(</xsl:text> + <xsl:apply-templates select="ooclass[position() > 1]" mode="python"/> + <xsl:text>)</xsl:text> + </xsl:if> + <xsl:text> :</xsl:text> + + <xsl:apply-templates select="constructorsynopsis + |destructorsynopsis + |fieldsynopsis + |methodsynopsis + |classsynopsisinfo" mode="python"/> + + </fo:block> + <xsl:text>&RE;</xsl:text> + </xsl:template> + + <xsl:template match="classsynopsisinfo" mode="python"> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="ooclass|oointerface|ooexception" mode="python"> + <xsl:if test="position() > 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="modifier" mode="python"> + <xsl:apply-templates mode="python"/> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="classname" mode="python"> + <xsl:if test="name(preceding-sibling::*[1]) = 'classname'"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="interfacename" mode="python"> + <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="exceptionname" mode="python"> + <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="fieldsynopsis" mode="python"> + <fo:block wrap-option='no-wrap' + white-space-collapse='false' + linefeed-treatment="preserve" + xsl:use-attribute-sets="monospace.verbatim.properties"> + <xsl:text> </xsl:text> + <xsl:apply-templates mode="python"/> + <xsl:call-template name="synop-break"/> + </fo:block> + </xsl:template> + + <xsl:template match="type" mode="python"> + <xsl:apply-templates mode="python"/> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="varname" mode="python"> + <xsl:apply-templates mode="python"/> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="initializer" mode="python"> + <xsl:text>=</xsl:text> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="void" mode="python"> + <xsl:text>void </xsl:text> + </xsl:template> + + <xsl:template match="methodname" mode="python"> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template match="methodparam" mode="python"> + <xsl:if test="position() > 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:apply-templates mode="python"/> + </xsl:template> + + <xsl:template mode="python" + match="destructorsynopsis|methodsynopsis"> + + <fo:block wrap-option='no-wrap' + white-space-collapse='false' + linefeed-treatment="preserve" + xsl:use-attribute-sets="monospace.verbatim.properties"> + <xsl:text> def </xsl:text> + <xsl:apply-templates select="methodname" mode="python"/> + <xsl:text>(</xsl:text> + <xsl:apply-templates select="methodparam" mode="python"/> + <xsl:text>)</xsl:text> +<!-- <xsl:call-template name="synop-break"/> --> + </fo:block> + </xsl:template> + + <xsl:template mode="python" + match="constructorsynopsis"> + <fo:block wrap-option='no-wrap' + white-space-collapse='false' + linefeed-treatment="preserve" + xsl:use-attribute-sets="monospace.verbatim.properties"> + <xsl:text> </xsl:text> + <xsl:apply-templates select="methodname" mode="python"/> + <xsl:text>(</xsl:text> + <xsl:apply-templates select="methodparam" mode="python"/> + <xsl:text>)</xsl:text> + </fo:block> + </xsl:template> + + <!-- hack --> + <xsl:template match="link" mode="python"> + <xsl:apply-templates select="."/> + </xsl:template> + +<!-- +<xsl:template match="variablelist" mode="vl.as.blocks"> + <xsl:variable name="id"> + <xsl:call-template name="object.id"/> + </xsl:variable> + + <xsl:if test="title"> + <xsl:apply-templates select="title" mode="list.title.mode"/> + </xsl:if> + + <fo:block id="{$id}" + xsl:use-attribute-sets="list.block.spacing" + background-color="#FFECCE"> + <xsl:apply-templates mode="vl.as.blocks"/> + </fo:block> +</xsl:template> +--> + +<!-- +<xsl:template match="variablelist"> + <fo:table border="0" + width="100%" + background-color="#FFECCE" + table-layout="fixed"> + <fo:table-column + align="left" + column-width="20%" + column-number="1"> + </fo:table-column> + <fo:table-column + align="left" + column-width="80%" + column-number="2"> + </fo:table-column> + <fo:table-body> + <xsl:apply-templates select="varlistentry"/> + </fo:table-body> + </fo:table> +</xsl:template> + +<xsl:template match="varlistentry"> + <fo:table-row> + <fo:table-cell> + <fo:block + background-color="#FFECCE"> + <xsl:apply-templates select="term"/> + </fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block + background-color="#FFECCE"> + <xsl:apply-templates select="listitem"/> + </fo:block> + </fo:table-cell> + </fo:table-row> +</xsl:template> + +<xsl:template match="varlistentry/term"> + <xsl:apply-templates/> + <xsl:text>, </xsl:text> +</xsl:template> + +<xsl:template match="varlistentry/term[position()=last()]" priority="2"> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="varlistentry/listitem"> + <xsl:apply-templates/> +</xsl:template> +--> + +</xsl:stylesheet> diff --git a/docs/xsl/ref-html-style.xsl b/docs/xsl/ref-html-style.xsl new file mode 100644 index 0000000..380e6a6 --- /dev/null +++ b/docs/xsl/ref-html-style.xsl @@ -0,0 +1,54 @@ +<?xml version='1.0'?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> +<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/> +<xsl:include href="common.xsl"/> +<xsl:include href="html.xsl"/> +<xsl:include href="devhelp.xsl"/> + + <!-- ========================================================= --> + <!-- template to create the index.sgml anchor index --> + + <xsl:template name="generate.index"> + <xsl:call-template name="write.text.chunk"> + <xsl:with-param name="filename" select="'index.sgml'"/> + <xsl:with-param name="content"> + <!-- check all anchor and refentry elements --> + <xsl:apply-templates select="//anchor|//refentry|//refsect1|//refsect2|//book" + mode="generate.index.mode"/> + </xsl:with-param> + <xsl:with-param name="encoding" select="'utf-8'"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="*" mode="generate.index.mode"> + <xsl:if test="not(@href)"> + <xsl:if test="@id"> + <xsl:text><ANCHOR id="</xsl:text> + <xsl:value-of select="@id"/> + <xsl:text>" href="</xsl:text> + <xsl:if test="$gtkdoc.bookname"> + <xsl:value-of select="$gtkdoc.bookname"/> + <xsl:text>/</xsl:text> + </xsl:if> + <xsl:call-template name="href.target"/> + <xsl:text>"> + </xsl:text> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:param name="gtkdoc.version" select="''"/> + <xsl:param name="gtkdoc.bookname" select="''"/> + + <xsl:param name="refentry.generate.name" select="0"/> + <xsl:param name="refentry.generate.title" select="1"/> + <xsl:param name="chapter.autolabel" select="0"/> + + <xsl:template match="book|article"> + <xsl:apply-imports/> + <xsl:call-template name="generate.devhelp"/> + <xsl:call-template name="generate.index"/> + </xsl:template> + +</xsl:stylesheet> diff --git a/docs/xsl/style.css b/docs/xsl/style.css new file mode 100644 index 0000000..59abc74 --- /dev/null +++ b/docs/xsl/style.css @@ -0,0 +1,10 @@ +.programlisting { +font: monospace; +background-color: #E0E0E0; +padding: 5; +} + +pre.synopsis { +background-color: #E0E0E0; +padding: 5; +} |