[gnome-doc-utils/mallard] Build and stylesheet changes prepping for Yelp work



commit b6eb32f41becc5550c1f512ea7635de786d7ac3b
Author: Shaun McCance <shaunm gnome org>
Date:   Mon Jun 1 02:58:51 2009 -0500

    Build and stylesheet changes prepping for Yelp work
---
 configure.in                        |    1 -
 doc/Makefile.am                     |    2 +-
 doc/mallard/C/mal_info.xml          |   17 ++++---
 sandbox/mallard/html/Makefile       |   14 +++++-
 tools/gnome-doc-utils.pc.in         |    2 +
 xslt/docbook/html/db2xhtml.xsl      |    2 +-
 xslt/mallard/common/Makefile.am     |    2 +-
 xslt/mallard/common/mal-chunk.xsl   |   85 +++++++++++++++++++++++++++++++++++
 xslt/mallard/common/mal-link.xsl    |    4 +-
 xslt/mallard/html/mal2html-page.xsl |   26 ++++++++---
 xslt/mallard/html/mal2html.xsl      |   11 ++++-
 xslt/mallard/html/mal2xhtml.xsl     |   16 ++++++-
 12 files changed, 159 insertions(+), 23 deletions(-)

diff --git a/configure.in b/configure.in
index 76ff019..35b4381 100644
--- a/configure.in
+++ b/configure.in
@@ -55,7 +55,6 @@ data/templates/Makefile
 data/watermarks/Makefile
 doc/Makefile
 doc/gnome-doc-make/Makefile
-doc/mallard/Makefile
 doc/xslt/Makefile
 po/Makefile.in
 rng/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index bd60514..8ab2702 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1 +1 @@
-SUBDIRS = gnome-doc-make mallard xslt
+SUBDIRS = gnome-doc-make xslt #mallard
diff --git a/doc/mallard/C/mal_info.xml b/doc/mallard/C/mal_info.xml
index 7251eb5..adb20c4 100644
--- a/doc/mallard/C/mal_info.xml
+++ b/doc/mallard/C/mal_info.xml
@@ -14,14 +14,15 @@
 mal_info = element info {
   attribute * - (mal:* | local:*) { text } *,
 
-  element * - (mal:* | local:*) { mal_inline } *
-&amp; <link xref="mal_info_desc">mal_info_desc</link> ?
-&amp; <link xref="mal_info_credit">mal_info_credit</link> *
-&amp; <link xref="mal_info_copyright">mal_info_copyright</link> *
-&amp; <link xref="mal_info_license">mal_info_license</link> *
-&amp; <link xref="mal_info_link">mal_info_link</link> *
-&amp; <link xref="mal_info_title">mal_info_title</link> *
-&amp; <link xref="mal_info_revision">mal_info_revision</link> *
+  ( element * - (mal:* | local:*) { mal_inline } *
+  &amp; <link xref="mal_info_desc">mal_info_desc</link> ?
+  &amp; <link xref="mal_info_credit">mal_info_credit</link> *
+  &amp; <link xref="mal_info_copyright">mal_info_copyright</link> *
+  &amp; <link xref="mal_info_license">mal_info_license</link> *
+  &amp; <link xref="mal_info_link">mal_info_link</link> *
+  &amp; <link xref="mal_info_title">mal_info_title</link> *
+  &amp; <link xref="mal_info_revision">mal_info_revision</link> *
+  )
 }
 </code></synopsis>
 <!--
diff --git a/sandbox/mallard/html/Makefile b/sandbox/mallard/html/Makefile
index f7cbe6d..f5921c6 100644
--- a/sandbox/mallard/html/Makefile
+++ b/sandbox/mallard/html/Makefile
@@ -1,6 +1,7 @@
 xslts=$(wildcard ../../../xslt/mallard/common/*.xsl) $(wildcard ../../../xslt/mallard/html/*.xsl)
 specs=$(filter-out ../../../doc/mallard/C/legal.xml, $(wildcard ../../../doc/mallard/C/*.xml))
 pages=$(patsubst %.xml,%.html, $(notdir $(specs)))
+xhtmls=$(patsubst %.xml,%.xhtml, $(notdir $(specs)))
 icons=admon-bug.png admon-caution.png admon-important.png admon-note.png admon-tip.png admon-warning.png
 marks=watermark-blockquote-201C.png watermark-code.png
 
@@ -23,13 +24,24 @@ $(marks):
 
 $(pages) : mallard.cache $(xslts)
 $(pages) : %.html : ../../../doc/mallard/C/%.xml
-	xsltproc -o $@ \
+	xsltproc \
 	  --stringparam mal.cache.file `pwd`/mallard.cache \
 	  --stringparam theme.icon.admon.path '' \
+	  --param mal.chunk.chunk_top 1 \
 	  --param theme.icon.admon.size 24 \
 	  --param mal2html.editor_mode 1 \
 	  ../../../xslt/mallard/html/mal2html.xsl $<
 
+$(xhtmls) : mallard.cache $(xslts)
+$(xhtmls) : %.xhtml : ../../../doc/mallard/C/%.xml
+	xsltproc \
+	  --stringparam mal.cache.file `pwd`/mallard.cache \
+	  --stringparam theme.icon.admon.path '' \
+	  --param mal.chunk.chunk_top 1 \
+	  --param theme.icon.admon.size 24 \
+	  --param mal2html.editor_mode 1 \
+	  ../../../xslt/mallard/html/mal2xhtml.xsl $<
+
 figures:
 	if [ ! -d figures ]; then mkdir figures; fi
 	cp ../../../doc/mallard/C/figures/*.png figures/
diff --git a/tools/gnome-doc-utils.pc.in b/tools/gnome-doc-utils.pc.in
index 6c81eec..86583b0 100644
--- a/tools/gnome-doc-utils.pc.in
+++ b/tools/gnome-doc-utils.pc.in
@@ -8,6 +8,8 @@ gettext=${xsltdir}/gettext/gettext.xsl
 db2html=${xsltdir}/docbook/html/db2html.xsl
 db2xhtml=${xsltdir}/docbook/html/db2xhtml.xsl
 db2omf=${xsltdir}/docbook/omf/db2omf.xsl
+mal2html=${xsltdir}/mallard/html/mal2html.xsl
+mal2xhtml=${xsltdir}/mallard/html/mal2xhtml.xsl
 
 Name: gnome-doc-utils
 Description: GNOME Documentation Utilities
diff --git a/xslt/docbook/html/db2xhtml.xsl b/xslt/docbook/html/db2xhtml.xsl
index 629e415..d043983 100644
--- a/xslt/docbook/html/db2xhtml.xsl
+++ b/xslt/docbook/html/db2xhtml.xsl
@@ -28,7 +28,7 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 <!--#@ db.chunk.doctype_system -->
 <xsl:param name="db.chunk.doctype_system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'"/>
 
-<xsl:output method="html"
+<xsl:output method="xml"
             doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
             doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
 
diff --git a/xslt/mallard/common/Makefile.am b/xslt/mallard/common/Makefile.am
index 9c808fc..9501408 100644
--- a/xslt/mallard/common/Makefile.am
+++ b/xslt/mallard/common/Makefile.am
@@ -1,5 +1,5 @@
 xsldir=$(datadir)/xml/gnome/xslt/mallard/common
 
-xsl_DATA = mal-link.xsl
+xsl_DATA = mal-chunk.xsl mal-link.xsl
 
 EXTRA_DIST=$(xsl_DATA)
diff --git a/xslt/mallard/common/mal-chunk.xsl b/xslt/mallard/common/mal-chunk.xsl
new file mode 100644
index 0000000..72531c3
--- /dev/null
+++ b/xslt/mallard/common/mal-chunk.xsl
@@ -0,0 +1,85 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
+<!--
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; see the file COPYING.LGPL.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+                xmlns:exsl="http://exslt.org/common";
+                extension-element-prefixes="exsl"
+                version="1.0">
+
+<!--!!==========================================================================
+Chunking
+
+REMARK: Describe this module
+-->
+
+
+<!--@@==========================================================================
+mal.chunk.chunk_top
+Whether the top-level page should be output with the chunking mechanism
+
+REMARK: Describe what this does
+-->
+<xsl:param name="mal.chunk.chunk_top" select="false()"/>
+
+
+<!--@@==========================================================================
+mal.chunk.extension
+The default file extension for new output documents
+
+REMARK: Describe what this does
+-->
+<xsl:param name="mal.chunk.extension"/>
+
+
+<!--@@==========================================================================
+mal.chunk.doctype_public
+The public DOCTYPE for output files
+
+REMARK: Describe this
+-->
+<xsl:param name="mal.chunk.doctype_public"/>
+
+
+<!--@@==========================================================================
+mal.chunk.doctype_system
+The system DOCTYPE for output files
+
+REMARK: Describe this
+-->
+<xsl:param name="mal.chunk.doctype_system"/>
+
+
+<!--**==========================================================================
+mal.chunk
+Creates a new page of output
+$node: The source element for the output page
+$href: The name of the file for the output page
+
+REMARK: Describe
+-->
+<xsl:template name="mal.chunk">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="href" select="concat($node/@id, $mal.chunk.extension)"/>
+  <exsl:document href="{$href}"
+                 doctype-public="{$mal.chunk.doctype_public}"
+                 doctype-system="{$mal.chunk.doctype_system}">
+    <xsl:apply-templates mode="mal.chunk.content.mode" select="$node"/>
+  </exsl:document>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/common/mal-link.xsl b/xslt/mallard/common/mal-link.xsl
index de5817d..fd00a77 100644
--- a/xslt/mallard/common/mal-link.xsl
+++ b/xslt/mallard/common/mal-link.xsl
@@ -127,12 +127,12 @@ $href: The #{href} attribute of ${link}
       <xsl:variable name="pageid" select="substring-before($xref, '#')"/>
       <xsl:variable name="sectionid" select="substring-after($xref, '#')"/>
       <xsl:if test="$pageid != ''">
-        <xsl:value-of select="concat($pageid, $mal.extension)"/>
+        <xsl:value-of select="concat($pageid, $mal.chunk.extension)"/>
       </xsl:if>
       <xsl:value-of select="concat('#', $sectionid)"/>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:value-of select="concat($xref, $mal.extension)"/>
+      <xsl:value-of select="concat($xref, $mal.chunk.extension)"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 01be58a..cc96415 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -465,9 +465,23 @@ REMARK: Describe this template
 
 <!-- = / = -->
 <xsl:template match="/">
+  <xsl:choose>
+    <xsl:when test="$mal.chunk.chunk_top">
+      <xsl:call-template name="mal.chunk">
+        <xsl:with-param name="node" select="mal:page"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates mode="mal.chunk.content.mode" select="mal:page"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- = 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:page/mal:info/mal:revision">
+    <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"/>
@@ -475,17 +489,17 @@ REMARK: Describe this template
     </xsl:for-each>
   </xsl:variable>
   <xsl:variable name="revision"
-                select="mal:page/mal:info/mal:revision[ date = $date][last()]"/>
+                select="mal:info/mal:revision[ date = $date][last()]"/>
   <html>
     <head>
       <title>
-        <xsl:value-of select="mal:page/mal:title"/>
+        <xsl:value-of select="mal:title"/>
       </title>
       <xsl:call-template name="mal2html.css"/>
     </head>
     <body>
       <xsl:call-template name="mal2html.page.linktrails">
-        <xsl:with-param name="node" select="mal:page"/>
+        <xsl:with-param name="node" select="."/>
       </xsl:call-template>
       <div class="body">
         <xsl:if test="$mal2html.editor_mode and $revision/@status != ''">
@@ -519,10 +533,10 @@ REMARK: Describe this template
             <xsl:apply-templates mode="mal2html.block.mode" select="$revision/*"/>
           </div>
         </xsl:if>
-        <xsl:apply-templates select="mal:page"/>
+        <xsl:apply-templates select="."/>
       </div>
       <xsl:call-template name="db2html.page.copyrights">
-        <xsl:with-param name="node" select="mal:page"/>
+        <xsl:with-param name="node" select="."/>
       </xsl:call-template>
     </body>
   </html>
diff --git a/xslt/mallard/html/mal2html.xsl b/xslt/mallard/html/mal2html.xsl
index 441c57b..6a4e5de 100644
--- a/xslt/mallard/html/mal2html.xsl
+++ b/xslt/mallard/html/mal2html.xsl
@@ -22,6 +22,14 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
                 exclude-result-prefixes="mal"
                 version="1.0">
 
+<xsl:import href="../../gettext/gettext.xsl"/>
+
+<!--#@ mal.chunk.doctype_public -->
+<xsl:param name="mal.chunk.doctype_public" select="'-//W3C//DTD HTML 4.01 Transitional//EN'"/>
+
+<!--#@ mal.chunk.doctype_system -->
+<xsl:param name="mal.chunk.doctype_system" select="'http://www.w3.org/TR/html4/loose.dtd'"/>
+
 <xsl:output method="html"
             doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
             doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
@@ -30,7 +38,7 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 <!--#@ mal2html.namespace -->
 <xsl:param name="mal2html.namespace" select="''"/>
 
-<xsl:param name="mal.extension" select="'.html'"/>
+<xsl:param name="mal.chunk.extension" select="'.html'"/>
 
 
 <!--!!==========================================================================
@@ -39,6 +47,7 @@ Mallard to HTML
 REMARK: Describe this module
 -->
 
+<xsl:include href="../common/mal-chunk.xsl"/>
 <xsl:include href="../common/mal-link.xsl"/>
 
 <xsl:include href="mal2html-block.xsl"/>
diff --git a/xslt/mallard/html/mal2xhtml.xsl b/xslt/mallard/html/mal2xhtml.xsl
index df7a07d..2f556e7 100644
--- a/xslt/mallard/html/mal2xhtml.xsl
+++ b/xslt/mallard/html/mal2xhtml.xsl
@@ -22,10 +22,23 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
                 exclude-result-prefixes="mal"
                 version="1.0">
 
+
+<xsl:import href="../../gettext/gettext.xsl"/>
+
+<!--#@ mal.chunk.doctype_public -->
+<xsl:param name="mal.chunk.doctype_public" select="'-//W3C//DTD XHTML 1.0 Strict//EN'"/>
+
+<!--#@ mal.chunk.doctype_system -->
+<xsl:param name="mal.chunk.doctype_system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'"/>
+
+<xsl:output method="xml"
+            doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
+
 <!--#@ mal2html.namespace -->
 <xsl:param name="mal2html.namespace" select="'http://www.w3.org/1999/xhtml'"/>
 
-<xsl:param name="mal.extension" select="'.xhtml'"/>
+<xsl:param name="mal.chunk.extension" select="'.xhtml'"/>
 
 <!--!!==========================================================================
 Mallard to HTML
@@ -33,6 +46,7 @@ Mallard to HTML
 REMARK: Describe this module
 -->
 
+<xsl:include href="../common/mal-chunk.xsl"/>
 <xsl:include href="../common/mal-link.xsl"/>
 
 <xsl:include href="mal2html-block.xsl"/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]