[library-web] [mallard] Let Mallard XSL decide on output filenames (GNOME bug 631100)
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [library-web] [mallard] Let Mallard XSL decide on output filenames (GNOME bug 631100)
- Date: Fri, 3 Dec 2010 10:13:50 +0000 (UTC)
commit bc1e5d0e1ce724c5cbc9611b9a6388adab4c13dd
Author: Frédéric Péters <fpeters 0d be>
Date: Thu Dec 2 23:05:14 2010 +0100
[mallard] Let Mallard XSL decide on output filenames (GNOME bug 631100)
data/xslt/mal2html.xsl | 112 ++++++++++++++++++----------------------------
src/modtypes/mallard.py | 3 +-
2 files changed, 46 insertions(+), 69 deletions(-)
---
diff --git a/data/xslt/mal2html.xsl b/data/xslt/mal2html.xsl
index 619b47d..7d03bfc 100644
--- a/data/xslt/mal2html.xsl
+++ b/data/xslt/mal2html.xsl
@@ -30,12 +30,13 @@ along with libgo; if not, write to the Free Software Foundation, Inc.,
version="1.0">
<!-- FIXME: Shaun's styles are under LGPL, is it OK to use GPL for this? -->
-<xsl:import href="/usr/share/xml/gnome/xslt/mallard/html/mal2html.xsl"/>
+<xsl:import href="/usr/share/yelp-xsl/xslt/mallard/html/mal2html.xsl"/>
<xsl:import href="heading.xsl"/>
<xsl:import href="gettext.xsl"/>
<!-- Setting parameters for included stylesheets -->
-<xsl:param name="mal.chunk.extension" select="concat('.html.',$libgo.lang)"/>
+<xsl:param name="mal.link.extension" select="concat('.html.',$libgo.lang)"/>
+<xsl:param name="html.extension" select="concat('.html.',$libgo.lang)"/>
<!-- output -->
<xsl:output method="html" encoding="UTF-8" indent="yes"
@@ -56,88 +57,63 @@ along with libgo; if not, write to the Free Software Foundation, Inc.,
<!-- Process -->
-<!-- = mal:page % mal.chunk.content.mode = -->
-<xsl:template mode="mal.chunk.content.mode" match="mal:page">
- <!-- FIXME: find a way to just select the version element -->
- <xsl:variable name="date">
- <xsl:for-each select="mal:info/mal:revision">
- <xsl:sort select="@date" data-type="text" order="descending"/>
- <xsl:if test="position() = 1">
- <xsl:value-of select="@date"/>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <xsl:variable name="revision"
- select="mal:info/mal:revision[ date = $date][last()]"/>
+<!-- == html.output == -->
+<xsl:template name="html.output">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="href">
+ <xsl:choose>
+ <xsl:when test="$node/@xml:id">
+ <xsl:value-of select="$node/@xml:id"/>
+ </xsl:when>
+ <xsl:when test="$node/@id">
+ <xsl:value-of select="$node/@id"/>
+ </xsl:when>
+ <xsl:when test="set:has-same-node($node, /*)">
+ <xsl:value-of select="$html.basename"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <exsl:document href="{$libgo.mallard.html.basedir}/{$href}{$html.extension}"
+ method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd">
+ <xsl:call-template name="html.page">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </exsl:document>
+ <xsl:apply-templates mode="html.output.after.mode" select="$node"/>
+</xsl:template>
+
+<xsl:template name="html.page">
+ <xsl:param name="node" select="."/>
<html>
<head>
<title>
- <xsl:value-of select="mal:title"/>
+ <xsl:apply-templates mode="html.title.mode" select="$node"/>
</title>
- <xsl:call-template name="mal2html.css"/>
+ <xsl:call-template name="html.js"/>
+ <xsl:call-template name="html.head.custom"/>
<xsl:call-template name="libgo.head"/>
</head>
<body>
+ <xsl:apply-templates mode="html.body.attr.mode" select="$node"/>
<xsl:call-template name="libgo.header">
<xsl:with-param name="lang"><xsl:value-of select="$libgo.lang"/></xsl:with-param>
</xsl:call-template>
<div class="head">
- <xsl:call-template name="mal2html.page.linktrails">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
+ <xsl:apply-templates mode="html.header.mode" select="$node"/>
</div>
<div class="body">
- <xsl:if test="$mal2html.editor_mode and $revision/@status != ''">
- <div class="version">
- <!-- FIXME: i18n -->
- <div class="title">
- <xsl:choose>
- <xsl:when test="$revision/@status = 'stub'">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'Stub'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$revision/@status = 'incomplete'">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'Incomplete'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$revision/@status = 'draft'">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'Draft'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$revision/@status = 'review'">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'Ready for review'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$revision/@status = 'final'">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'Final'"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </div>
- <p class="version">
- <!-- FIXME: i18n -->
- <xsl:text>Version </xsl:text>
- <xsl:value-of select="$revision/@version"/>
- <xsl:text> on </xsl:text>
- <xsl:value-of select="$revision/@date"/>
- </p>
- <xsl:apply-templates mode="mal2html.block.mode" select="$revision/*"/>
- </div>
- </xsl:if>
- <xsl:apply-templates select="."/>
+ <xsl:apply-templates mode="html.body.mode" select="$node"/>
+ </div>
+ <div class="footer">
+ <xsl:apply-templates mode="html.footer.mode" select="$node"/>
</div>
- <xsl:call-template name="mal2html.page.copyrights">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
</body>
</html>
</xsl:template>
-
-
</xsl:stylesheet>
diff --git a/src/modtypes/mallard.py b/src/modtypes/mallard.py
index 1b48d22..a851e06 100644
--- a/src/modtypes/mallard.py
+++ b/src/modtypes/mallard.py
@@ -237,8 +237,9 @@ class MallardModule(DocModule):
filename = os.path.splitext(doc_page)[0] + '.html.' + lang
# format docbook into html files
- cmd = ['xsltproc', '--output', web_output_dir + '/' + filename,
+ cmd = ['xsltproc',
'--nonet', '--xinclude',
+ '--stringparam', 'libgo.mallard.html.basedir', web_output_dir,
'--stringparam', 'mal.cache.file', temporary.name,
'--stringparam', 'libgo.lang', lang,
'--stringparam', 'libgo.channel', self.channel,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]