]> granicus.if.org Git - docbook-dsssl/commitdiff
Fixing CSS mimetype bug reported by Liza Daly
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Wed, 9 Jul 2008 19:20:54 +0000 (19:20 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Wed, 9 Jul 2008 19:20:54 +0000 (19:20 +0000)
xsl/epub/bin/spec/epub_regressions_spec.rb
xsl/epub/docbook.xsl

index 262516d4dd0baa3ace8f5465c4c96e0f4de155ce..37a6f1f73b04825fa1525d19ad2f2cd61f3436ac 100755 (executable)
@@ -62,6 +62,29 @@ describe DocBook::Epub do
     end  
   end
 
+  it "should use the correct mimetype for CSS files" do
+    begin
+      css_file_base = "test.css"
+      css_file = File.join(@filedir, css_file_base)
+      css_epub = DocBook::Epub.new(File.join(@testdocsdir, "book.002.xml"), @tmpdir, css_file)
+      css_epubfile = File.join(@tmpdir, "css.epub")
+      css_epub.render_to_file(css_epubfile, $DEBUG)
+
+      tmpdir = File.join(Dir::tmpdir(), "epubcssreg"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
+
+      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{css_epubfile}")
+      raise "Could not unzip #{css_epubfile}" unless success
+      opf_files = Dir.glob(File.join(tmpdir, "**", "*.opf"))
+      opf_files.find_all {|opf_file| 
+        File.open(opf_file).readlines.to_s.should_not =~ /media-type=.test\/css/
+      }  
+    rescue => e
+      raise e
+    ensure
+      FileUtils.rm_r(tmpdir, :force => true)
+    end  
+  end  
+
   after(:all) do
     FileUtils.rm_r(@tmpdir, :force => true)
   end  
index b2d32496782d8b28377d430ae937e430f2387906..feb41f261974a02d7b1b2b968a47bbd3d338a8b7 100644 (file)
       <xsl:if test="$html.stylesheet != ''">
         <xsl:element name="item">
           <xsl:attribute name="xmlns">http://www.idpf.org/2007/opf</xsl:attribute>
-          <xsl:attribute name="media-type">test/css</xsl:attribute>
+          <xsl:attribute name="media-type">text/css</xsl:attribute>
           <xsl:attribute name="id">css</xsl:attribute>
           <xsl:attribute name="href"><xsl:value-of select="$html.stylesheet"/></xsl:attribute>
         </xsl:element>