From 4d154d861c317ebb1d3663d0e8aa4d27d4a8b816 Mon Sep 17 00:00:00 2001 From: Keith Fahlgren Date: Thu, 26 Jun 2008 01:07:55 +0000 Subject: [PATCH] Adding regression for dropped text in dedications and bookinfos --- xsl/epub/bin/spec/epub_regressions_spec.rb | 21 ++++++++++++++++ xsl/epub/bin/spec/epub_spec.rb | 2 +- xsl/epub/docbook.xsl | 28 +++++++++++++--------- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/xsl/epub/bin/spec/epub_regressions_spec.rb b/xsl/epub/bin/spec/epub_regressions_spec.rb index ac6a9cedb..262516d4d 100755 --- a/xsl/epub/bin/spec/epub_regressions_spec.rb +++ b/xsl/epub/bin/spec/epub_regressions_spec.rb @@ -41,6 +41,27 @@ describe DocBook::Epub do itemrefs.should == itemrefs.uniq end + it "should preserve content from elements" do + begin + tmpdir = File.join(Dir::tmpdir(), "epubdedtest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST + + epub = DocBook::Epub.new(File.join(@testdocsdir, "xref.001.xml"), @tmpdir) + epubfile = File.join(tmpdir, "regress.ded.epub") + epub.render_to_file(epubfile, $DEBUG) + FileUtils.copy(epubfile, ".re.ded.epub") if $DEBUG + + success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}") + raise "Could not unzip #{epubfile}" unless success + glob = Dir.glob(File.join(tmpdir, "**", "*.opf")) + index_html_links = glob.find_all {|opf_file| File.open(opf_file).readlines.to_s =~ /href=["']index.html["']/} + index_html_links.should_not be_empty + rescue => e + raise e + ensure + FileUtils.rm_r(tmpdir, :force => true) + end + end + after(:all) do FileUtils.rm_r(@tmpdir, :force => true) end diff --git a/xsl/epub/bin/spec/epub_spec.rb b/xsl/epub/bin/spec/epub_spec.rb index 54cdf3977..4c734f49a 100755 --- a/xsl/epub/bin/spec/epub_spec.rb +++ b/xsl/epub/bin/spec/epub_spec.rb @@ -88,7 +88,6 @@ describe DocBook::Epub do FileUtils.copy(article_nosects_epubfile, ".as.epub") if $DEBUG article_nosects_epubfile.should be_valid_epub - end @@ -204,6 +203,7 @@ describe DocBook::Epub do epub = DocBook::Epub.new(File.join(@testdocsdir, "book.002.xml"), @tmpdir) epubfile = File.join(tmpdir, "toclink.epub") epub.render_to_file(epubfile, $DEBUG) + FileUtils.copy(epubfile, ".tcl.epub") if $DEBUG success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}") raise "Could not unzip #{epubfile}" unless success diff --git a/xsl/epub/docbook.xsl b/xsl/epub/docbook.xsl index 6a4b8ad3e..ab850115a 100644 --- a/xsl/epub/docbook.xsl +++ b/xsl/epub/docbook.xsl @@ -19,7 +19,6 @@ 1 2 - article toc,title book toc,title @@ -56,12 +55,18 @@ + + + + + + 1 - + 1 @@ -428,7 +433,6 @@ - - + http://www.idpf.org/2007/opf @@ -581,8 +586,7 @@ - - + @@ -616,8 +620,7 @@ - - + yes @@ -665,8 +668,7 @@ - - + application/xhtml+xml @@ -702,6 +704,7 @@