[gtk-doc] xsl: fixing a regression that was breaking the ONLINE tags in index.sgml



commit d8ea880a3d05219300f038ef280de45446f96eb2
Author: Stefan Kost <ensonic users sf net>
Date:   Wed May 12 15:13:00 2010 +0300

    xsl: fixing a regression that was breaking the ONLINE tags in index.sgml
    
    Adding a sanity check test, that verify some basics (certain files are generated
    and non empty). Add a content check for index.sgml.

 gtk-doc.xsl       |    6 +++---
 tests/Makefile.am |    2 +-
 tests/sanity.sh   |   36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 4 deletions(-)
---
diff --git a/gtk-doc.xsl b/gtk-doc.xsl
index ec3f7b8..418eaae 100644
--- a/gtk-doc.xsl
+++ b/gtk-doc.xsl
@@ -306,7 +306,7 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
     <xsl:call-template name="write.text.chunk">
       <xsl:with-param name="filename" select="'index.sgml'"/>
       <xsl:with-param name="content">
-        <xsl:apply-templates select="/book/bookinforeleaseinfo/ulink"
+        <xsl:apply-templates select="/book/bookinfo/releaseinfo/ulink"
                              mode="generate.index.mode"/>
         <!-- check all anchor and refentry elements -->
         <xsl:apply-templates select="//anchor|//refentry|//refsect1|$gtkdoc.refsect2|//refsynopsisdiv|//varlistentry"
@@ -334,8 +334,8 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
   <xsl:template match="/book/bookinfo/releaseinfo/ulink" mode="generate.index.mode">
     <xsl:if test="@role='online-location'">
       <xsl:text>&lt;ONLINE href=&quot;</xsl:text>
-        <xsl:value-of select="@url"/>
-        <xsl:text>&quot;&gt;&#10;</xsl:text>
+      <xsl:value-of select="@url"/>
+      <xsl:text>&quot;&gt;&#10;</xsl:text>
     </xsl:if>
   </xsl:template>
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 106df63..2c721eb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,7 +4,7 @@ SUBDIRS = gobject bugs annotations fail empty .
 
 if BUILD_TESTS
 
-TESTS = tools.sh gobject.sh bugs.sh annotations.sh fail.sh empty.sh
+TESTS = tools.sh gobject.sh bugs.sh annotations.sh fail.sh empty.sh sanity.sh
 TESTS_ENVIRONMENT = \
 	ABS_TOP_BUILDDIR=$(abs_top_builddir) \
 	ABS_TOP_SRCDIR=$(abs_top_srcdir) \
diff --git a/tests/sanity.sh b/tests/sanity.sh
new file mode 100755
index 0000000..02d6cb1
--- /dev/null
+++ b/tests/sanity.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+dir=`dirname $0`
+
+failed=0
+tested=0
+
+# check the presence and non-emptyness of certain files
+nok=0
+for path in $dir/*/docs*/html; do
+  if test ! -s $path/index.html ; then nok=$(($nok + 1)); break; fi
+  if test ! -s $path/index.sgml ; then nok=$(($nok + 1)); break; fi
+  if test ! -s $path/home.png ; then nok=$(($nok + 1)); break; fi
+done
+if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
+tested=$(($tested + 1))
+
+
+# check online tags
+nok=0
+for file in $dir/*/docs*/html/index.sgml; do
+  grep >/dev/null "<ONLINE href=" $file
+  if test $? = 1 ; then nok=$(($nok + 1)); break; fi
+  grep >/dev/null "<ANCHOR id=" $file
+  if test $? = 1 ; then nok=$(($nok + 1)); break; fi
+done
+if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
+tested=$(($tested + 1))
+
+
+# summary
+rate=$((100*($tested - $failed)/$tested));
+echo "$rate %: Checks $tested, Failures: $failed"
+
+test $failed = 0
+exit $?



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