From: Keith Fahlgren Date: Thu, 10 Jul 2008 17:20:14 +0000 (+0000) Subject: Finishing support for covers in epub files destined for .mobi and the Kindle X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2aea65cbbe302525a6de2a537de1abe976c63f3c;p=docbook-dsssl Finishing support for covers in epub files destined for .mobi and the Kindle --- diff --git a/xsl/epub/bin/spec/epub_realbook_spec.rb b/xsl/epub/bin/spec/epub_realbook_spec.rb index aca579739..a59a8116b 100755 --- a/xsl/epub/bin/spec/epub_realbook_spec.rb +++ b/xsl/epub/bin/spec/epub_realbook_spec.rb @@ -34,6 +34,7 @@ describe DocBook::Epub do @html_files = Dir.glob(File.join(@tmpdir2, "**", "*.html")) @opf_file = Dir.glob(File.join(@tmpdir2, "**", "*.opf")).first + @opf_lines = File.open(@opf_file).readlines end it "should be able to render a valid .epub for the 'Real Book' test document #{@xml_file}" do @@ -45,8 +46,28 @@ describe DocBook::Epub do @cover_links.length.should == 1 end + it "should mark the HTML cover as not linear for the 'Real Book' test document #{@xml_file}" do + @opf_lines.each {|l| + if l =~ /itemref[^>]+idref=['"]cover['"]/ + l.should =~ /item[^>]+linear=['"]no['"]/ + end + } + end + + it "should use the cover image @id for the opf/meta[@name='cover'] for the 'Real Book' test document #{@xml_file}" do + @opf_lines.each {|l| + if l =~ /meta[^>]+name=['"]cover['"]/ + l.should =~ /meta[^>]+cover-image/ + end + } + end + + it "should reference the cover in the OPF guide for the 'Real Book' test document #{@xml_file}" do + @opf_lines.to_s.should =~ /reference[^>]+type=['"]cover['"]/ + end + it "should use the as dc:identifier for the 'Real Book' test document #{@xml_file}" do - File.open(@opf_file).readlines.to_s.should =~ /identifier[^>]+>urn:isbn:[0-9]/ + @opf_lines.to_s.should =~ /identifier[^>]+>urn:isbn:[0-9]/ end after(:all) do diff --git a/xsl/epub/docbook.xsl b/xsl/epub/docbook.xsl index 4e9b5ff4d..8570c87e4 100644 --- a/xsl/epub/docbook.xsl +++ b/xsl/epub/docbook.xsl @@ -263,7 +263,7 @@ cover - +