]> granicus.if.org Git - docbook-dsssl/commitdiff
Improve the quality of the OPF spine regression by ensuring that the spine
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Thu, 20 Aug 2009 20:10:08 +0000 (20:10 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Thu, 20 Aug 2009 20:10:08 +0000 (20:10 +0000)
elements for deeply nested refentries are in order and adjacent to their
opening wrapper XHTML chunk.

xsl/epub/bin/spec/epub_regressions_spec.rb
xsl/epub/docbook.xsl

index af7c7f19bf53c693e4af233ff12f0f4444b05a87..512f85bcf1c2c5adbbd5d60435cd229454bcb4f8 100755 (executable)
@@ -182,6 +182,14 @@ describe DocBook::Epub do
     opf_lns.to_s.should =~ /<itemref idref="#{re01_id}"/
   end
 
+  it "should include chunked refentries in the spine in the correct order and adjacency even when they're deeply nested" do
+    opf_lns = opf_lines('orm.book.001.xml', @filedir)
+    before_refentry_id = opf_lns.to_s.sub(/.+<item id="([^"]+)" href="apa.html".+/m, '\1')
+    re01_id = opf_lns.to_s.sub(/.+<item id="([^"]+)" href="re01.html".+/m, '\1')
+    re02_id = opf_lns.to_s.sub(/.+<item id="([^"]+)" href="re02.html".+/m, '\1')
+    opf_lns.to_s.should =~ /<itemref idref="#{before_refentry_id}"[^>]*[^<]*<itemref idref="#{re01_id}"[^>]*>[^<]*<itemref idref="#{re02_id}"/m
+  end
+
   after(:all) do
     FileUtils.rm_r(@tmpdir, :force => true)
   end  
index 19c9c5f28f989ec86f17f953653f038799d97fd4..6df4a1b39f8ead992feb1730a62ed9bff32e62b1 100644 (file)
       <!-- TODO: be nice to have a idref="titlepage" here -->
       <xsl:choose>
         <xsl:when test="$root.is.a.chunk != '0'">
-          <xsl:apply-templates select="/*|//refentry" mode="opf.spine"/>
+          <xsl:apply-templates select="/*" mode="opf.spine"/>
         </xsl:when>
         <xsl:otherwise>
-          <xsl:apply-templates select="/*/*|//refentry" mode="opf.spine"/>
+          <xsl:apply-templates select="/*/*" mode="opf.spine"/>
         </xsl:otherwise>
       </xsl:choose>
                                    
           <xsl:value-of select="generate-id(.)"/>
         </xsl:attribute>
       </xsl:element>
-      <xsl:apply-templates select="*" mode="opf.spine"/>
+      <xsl:apply-templates select="*|.//refentry" mode="opf.spine"/>
     </xsl:if>
   </xsl:template>