]> granicus.if.org Git - docbook-dsssl/commitdiff
== General epub test support
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Tue, 15 Apr 2008 03:19:23 +0000 (03:19 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Tue, 15 Apr 2008 03:19:23 +0000 (03:19 +0000)
$ spec -O ~/.spec.opts spec/epub_spec.rb

DocBook::Epub
- should be able to be created
- should fail on a nonexistent file
- should be able to render to a file
- should create a file after rendering
- should have the correct mimetype after rendering
- should be valid .epub after rendering an article
- should be valid .epub after rendering an article without sections
- should be valid .epub after rendering a book
- should be valid .epub after rendering a book even if it has one graphic
- should be valid .epub after rendering a book even if it has many graphics
- should be valid .epub after rendering a book even if it has many duplicated graphics
- should report an empty file as invalid
- should confirm that a valid .epub file is valid
- should not include PDFs in rendered epub files as valid image inclusions
- should include a TOC link in rendered epub files for <book>s

Finished in 20.608395 seconds

15 examples, 0 failures

== Verbose epub test coverage against _all_ of the testdocs

Fails on only (errors truncated):
1)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/calloutlist.003.xml [30]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/calloutlist.003.epub: could not parse OEBPS/index.html: duplicate id: dos

2)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/cmdsynopsis.001.xml [35]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/cmdsynopsis.001.epub/OEBPS/re01.html(5): element "p" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context

3)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/cmdsynopsis.002.xml [36]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/cmdsynopsis.002.epub/OEBPS/index.html(4): element "div" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context

4)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/extensions.002.xml [50]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/extensions.002.epub/OEBPS/index.html(3): attribute "type" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/extensions.002.epub/OEBPS/index.html(3): attribute "show" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/extensions.002.epub/OEBPS/index.html(3): attribute "actuate" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored

5)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/extensions.004.xml [52]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/extensions.004.epub/OEBPS/index.html(5): attribute "type" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/extensions.004.epub/OEBPS/index.html(5): attribute "show" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/extensions.004.epub/OEBPS/index.html(5): attribute "actuate" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored

6)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/funcsynopsis.001.xml [65]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/funcsynopsis.001.epub/OEBPS/index.html(5): element "code" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context

7)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/imageobjectco.001.xml [70]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/imageobjectco.001.epub/OEBPS/index.html(3): attribute "border" not allowed at this point; ignored

8)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/olink.001.xml [118]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/olink.001.epub/OEBPS/index.html(3): 'OEBPS/file:///sourceforge/projects/docbook/testdocs/tests/olink.001.html': referenced resource missing in the package

9)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/programlisting.002.xml [129]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/programlisting.002.epub/OEBPS/index.html(3): attribute "type" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/programlisting.002.epub/OEBPS/index.html(3): attribute "show" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/programlisting.002.epub/OEBPS/index.html(3): attribute "actuate" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored

10)
RuntimeError in 'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/programlisting.006.xml [133]'
Could not render as .epub to /tmp/epubspecsmoke/programlisting.006.epub (xsltproc --xinclude --stringparam chunk.quietly 1 --stringparam callout.graphics.path images/callouts/ --stringparam callout.graphics.number.limit 15 --stringparam callout.graphics.extension .png --stringparam base.dir /tmp/epubspecsmoke/OEBPS/ --stringparam epub.metainf.dir /tmp/epubspecsmoke/META-INF/ --stringparam epub.oebps.dir /tmp/epubspecsmoke/OEBPS/ /Users/keith/work/docbook-dev/trunk/xsl/epub/docbook.xsl /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/programlisting.006.xml)

11)
RuntimeError in 'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/programlistingco.002.xml [135]'
Could not render as .epub to /tmp/epubspecsmoke/programlistingco.002.epub (xsltproc --xinclude --stringparam chunk.quietly 1 --stringparam callout.graphics.path images/callouts/ --stringparam callout.graphics.number.limit 15 --stringparam callout.graphics.extension .png --stringparam base.dir /tmp/epubspecsmoke/OEBPS/ --stringparam epub.metainf.dir /tmp/epubspecsmoke/META-INF/ --stringparam epub.oebps.dir /tmp/epubspecsmoke/OEBPS/ /Users/keith/work/docbook-dev/trunk/xsl/epub/docbook.xsl /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/programlistingco.002.xml)

12)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/refentry.007.xml [148]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/refentry.007.epub/OEBPS/rn01re01.html(5): element "code" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context

13)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/table.003.xml [191]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/table.003.epub/OEBPS/index.html(4): 'ftn.id964170': fragment identifier is not defined in 'OEBPS/index.html'

14)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/textobject.001.xml [207]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/textobject.001.epub/OEBPS/index.html(3): attribute "type" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/textobject.001.epub/OEBPS/index.html(3): attribute "show" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/textobject.001.epub/OEBPS/index.html(3): attribute "actuate" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored

15)
'DocBook::Epub should be able to render a valid .epub for the test document /Users/keith/work/docbook-dev/trunk/xsl/epub/bin/spec/testdocs/textobject.002.xml [208]' FAILED
 expected .epub file to be valid, but validation produced these errors:
 /tmp/epubspecsmoke/textobject.002.epub/OEBPS/index.html(3): attribute "type" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/textobject.002.epub/OEBPS/index.html(3): attribute "show" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored
/tmp/epubspecsmoke/textobject.002.epub/OEBPS/index.html(3): attribute "actuate" from namespace "http://www.w3.org/1999/xlink" not allowed at this point; ignored

Finished in 629.89194 seconds

224 examples, 15 failures

224 examples, 15 failures yields 6% failure rate

xsl/common/l10n.xsl

index 9d9eb4073eef30c4608603aec17fbdc2a01c07b6..7fc142936ed70cced4fc711aa6339979221d0bcd 100644 (file)
   <xsl:copy-of select="ancestor-or-self::*[@dir][1]/@dir"/>
 </xsl:template>
 
+<!-- Duplication of language.attribute template to allow for xml:lang attribute
+     creation for XHTML 1.1 and epub target -->
+<xsl:template name="xml.language.attribute">
+  <xsl:param name="node" select="."/>
+
+  <xsl:variable name="language">
+    <xsl:choose>
+      <xsl:when test="$l10n.gentext.language != ''">
+        <xsl:value-of select="$l10n.gentext.language"/>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <!-- can't do this one step: attributes are unordered! -->
+        <xsl:variable name="lang-scope"
+                      select="$node/ancestor-or-self::*
+                              [@lang or @xml:lang][1]"/>
+        <xsl:variable name="lang-attr"
+                      select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
+
+        <xsl:choose>
+          <xsl:when test="string($lang-attr) = ''">
+            <xsl:value-of select="$l10n.gentext.default.language"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$lang-attr"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:if test="$language != ''">
+    <xsl:attribute name="xml:lang">
+      <xsl:choose>
+        <xsl:when test="$l10n.lang.value.rfc.compliant != 0">
+          <xsl:value-of select="translate($language, '_', '-')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$language"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:if>
+
+  <!-- FIXME: This is sort of hack, but it was the easiest way to add at least partial support for dir attribute -->
+  <xsl:copy-of select="ancestor-or-self::*[@dir][1]/@dir"/>
+</xsl:template>
+
 <xsl:template name="gentext">
   <xsl:param name="key" select="local-name(.)"/>
   <xsl:param name="lang">