texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: EPUB conformance: version and mimetype file


From: Patrice Dumas
Subject: branch master updated: EPUB conformance: version and mimetype file
Date: Tue, 02 Aug 2022 13:57:34 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 823ae8c35c EPUB conformance: version and mimetype file
823ae8c35c is described below

commit 823ae8c35c86af6baf5a466e45ce72c683897d40
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Aug 2 19:57:19 2022 +0200

    EPUB conformance: version and mimetype file
    
    * tp/ext/epub3.pm: use 3.0 as version, as said in the
    standard.  Report from Kurt Hornik.
    No end line in mimetype file.  Report from Kurt Hornik.
    mimetype file should not be compressed.
---
 ChangeLog                                                  |  9 +++++++++
 tp/ext/epub3.pm                                            | 14 +++++++++++---
 .../os\303\251_utf8_epub_package/EPUB/os\303\251_utf8.opf" |  2 +-
 .../os\303\251_utf8_epub_package/mimetype"                 |  2 +-
 .../formatting_epub_package/EPUB/formatting.opf            |  2 +-
 .../formatting_epub/formatting_epub_package/mimetype       |  2 +-
 .../formatting_epub_package/EPUB/formatting.opf            |  2 +-
 .../formatting_epub_nodes/formatting_epub_package/mimetype |  2 +-
 8 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2debc10dde..efa78d1e76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-08-01  Patrice Dumas  <pertusus@free.fr>
+
+       EPUB conformance: version and mimetype file
+
+       * tp/ext/epub3.pm: use 3.0 as version, as said in the
+       standard.  Report from Kurt Hornik.
+       No end line in mimetype file.  Report from Kurt Hornik.
+       mimetype file should not be compressed.
+
 2022-08-01  Patrice Dumas  <pertusus@free.fr>
 
        HTML @def* argument in <var>, not like @r{@slanted{
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index 066d1f449f..c87325ba00 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -58,7 +58,10 @@ use Texinfo::Common;
 use Texinfo::Convert::Utils;
 use Texinfo::Convert::Text;
 
-my $epub_format_version = '3.2';
+# the 3.2 spec was used for the implementation.  However, it seems to be
+# designed to be backward compatible with 3.0 and mandates to use 3.0 as
+# version.
+my $epub_format_version = '3.0';
 
 # used in tests to avoid creating the .epub file.
 texinfo_set_from_init_file('EPUB_CREATE_CONTAINER_FILE', 1);
@@ -432,7 +435,9 @@ EOT
                   $mimetype_file_path_name, $!));
     return 0;
   }
-  print $mimetype_fh 'application/epub+zip'."\n";
+  # There is no end of line.  It is not very clear in the standard, but
+  # example files demonstrate clearly that there should not be end of lines.
+  print $mimetype_fh 'application/epub+zip';
 
   Texinfo::Common::output_files_register_closed(
     $self->output_files_information(), $encoded_mimetype_file_path_name);
@@ -720,8 +725,11 @@ EOT
     # needed on other plaforms.
     local $Archive::Zip::UNICODE = 1;
     my $zip = Archive::Zip->new();
+    # the standard says that the mimetype file should not be compressed
+    # The mimetype file MUST NOT be compressed or encrypted
     my $mimetype_added
-      = $zip->addFile($encoded_mimetype_file_path_name, $mimetype_filename);
+      = $zip->addFile($encoded_mimetype_file_path_name, $mimetype_filename,
+                      Archive::Zip->COMPRESSION_LEVEL_NONE);
     if (not(defined($mimetype_added))) {
       $self->document_error($self,
         sprintf(__("epub3.pm: error adding %s to archive"),
diff --git 
"a/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/os\303\251_utf8.opf"
 
"b/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/os\303\251_utf8.opf"
index 6ac8460e68..09ab9fda02 100644
--- 
"a/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/os\303\251_utf8.opf"
+++ 
"b/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/os\303\251_utf8.opf"
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<package xmlns="http://www.idpf.org/2007/opf"; version="3.2" 
unique-identifier="texi-uid">
+<package xmlns="http://www.idpf.org/2007/opf"; version="3.0" 
unique-identifier="texi-uid">
    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/";>
       <dc:identifier id="texi-uid">texinfo:osé_utf8</dc:identifier>
       <dc:title>Tôp</dc:title>
diff --git 
"a/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/mimetype"
 
"b/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/mimetype"
index 403c4f02df..57ef03f24a 100644
--- 
"a/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/mimetype"
+++ 
"b/tp/tests/formatting/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/mimetype"
@@ -1 +1 @@
-application/epub+zip
+application/epub+zip
\ No newline at end of file
diff --git 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/formatting.opf
 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/formatting.opf
index 5a39b704de..7de81a39ba 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/formatting.opf
+++ 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/EPUB/formatting.opf
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<package xmlns="http://www.idpf.org/2007/opf"; version="3.2" 
unique-identifier="texi-uid">
+<package xmlns="http://www.idpf.org/2007/opf"; version="3.0" 
unique-identifier="texi-uid">
    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/";>
       <dc:identifier id="texi-uid">texinfo:formatting</dc:identifier>
       <dc:title>title -a</dc:title>
diff --git 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/mimetype 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/mimetype
index 403c4f02df..57ef03f24a 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/mimetype
+++ 
b/tp/tests/layout/res_parser/formatting_epub/formatting_epub_package/mimetype
@@ -1 +1 @@
-application/epub+zip
+application/epub+zip
\ No newline at end of file
diff --git 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/formatting.opf
 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/formatting.opf
index 379f87437f..8a5874d78e 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/formatting.opf
+++ 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/formatting.opf
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<package xmlns="http://www.idpf.org/2007/opf"; version="3.2" 
unique-identifier="texi-uid">
+<package xmlns="http://www.idpf.org/2007/opf"; version="3.0" 
unique-identifier="texi-uid">
    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/";>
       <dc:identifier id="texi-uid">texinfo:formatting</dc:identifier>
       <dc:title>title -a</dc:title>
diff --git 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/mimetype
 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/mimetype
index 403c4f02df..57ef03f24a 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/mimetype
+++ 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/mimetype
@@ -1 +1 @@
-application/epub+zip
+application/epub+zip
\ No newline at end of file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]