From 8605f4008dcc0bf49665426f8c3758ce145e71d8 Mon Sep 17 00:00:00 2001 From: Keith Fahlgren Date: Tue, 19 May 2009 03:01:14 +0000 Subject: [PATCH] Added regression and fix to correct "bug" with namespace-prefixed container elements in META-INF/container.xml ; resolves Issue #2790017 --- xsl/epub/bin/spec/epub_regressions_spec.rb | 16 ++++++++++++++++ xsl/epub/docbook.xsl | 9 ++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/xsl/epub/bin/spec/epub_regressions_spec.rb b/xsl/epub/bin/spec/epub_regressions_spec.rb index e7ebbb3eb..d12d128cf 100755 --- a/xsl/epub/bin/spec/epub_regressions_spec.rb +++ b/xsl/epub/bin/spec/epub_regressions_spec.rb @@ -151,6 +151,22 @@ describe DocBook::Epub do ents_epubfile.should be_valid_epub end + # https://sourceforge.net/tracker/index.php?func=detail&aid=2790017&group_id=21935&atid=373747 + it "should not use a namespace prefix for the container element to help some broken reading systems" do + filename = "isbn.xml" + shortname = filename.gsub(/\W/, '') + tmpdir = File.join(Dir::tmpdir(), shortname); Dir.mkdir(tmpdir) rescue Errno::EEXIST + epub = DocBook::Epub.new(File.join(@filedir, filename), tmpdir) + epubfile = File.join(tmpdir, shortname + ".epub") + epub.render_to_file(epubfile, $DEBUG) + FileUtils.copy(epubfile, "." + shortname + ".epub") if $DEBUG + success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{File.expand_path(epubfile)}") + raise "Could not unzip #{epubfile}" unless success + container_file = File.join(tmpdir, 'META-INF', 'container.xml') + container_lines = File.open(container_file).readlines + container_lines.to_s.should =~ / true) end diff --git a/xsl/epub/docbook.xsl b/xsl/epub/docbook.xsl index a2076cf7d..a1e5ba6ab 100644 --- a/xsl/epub/docbook.xsl +++ b/xsl/epub/docbook.xsl @@ -6,14 +6,13 @@ xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" xmlns:ng="http://docbook.org/docbook-ng" - xmlns:odfc="urn:oasis:names:tc:opendocument:xmlns:container" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtext="xalan://com.nwalsh.xalan.Text" extension-element-prefixes="stext xtext" - exclude-result-prefixes="exsl db dc h ncx ng opf odfc stext xtext" + exclude-result-prefixes="exsl db dc h ncx ng opf stext xtext" version="1.0"> @@ -359,10 +358,10 @@ - + 1.0 - - + + -- 2.40.0