texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/init/epub3.pm (epub_finish): put jslabels fi


From: Patrice Dumas
Subject: branch master updated: * tp/init/epub3.pm (epub_finish): put jslabels file id in <spine>.
Date: Thu, 30 Dec 2021 11:19:09 -0500

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 d7dcde310d * tp/init/epub3.pm (epub_finish): put jslabels file id in 
<spine>.
d7dcde310d is described below

commit d7dcde310dee86c04ffa39ccab0d88c360cda6d4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Dec 30 17:18:58 2021 +0100

    * tp/init/epub3.pm (epub_finish): put jslabels file id in <spine>.
---
 ChangeLog                                                |  4 ++++
 tp/init/epub3.pm                                         | 16 +++++++++++++++-
 .../formatting_epub_package/EPUB/formatting.opf          |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index bc55cb0e06..f72c85bdd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-12-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/init/epub3.pm (epub_finish): put jslabels file id in <spine>.
+
 2021-12-30  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm: prefix context strings by ct_
diff --git a/tp/init/epub3.pm b/tp/init/epub3.pm
index 7694ae9863..a40aeb09e9 100644
--- a/tp/init/epub3.pm
+++ b/tp/init/epub3.pm
@@ -32,6 +32,8 @@
 # indices?
 # cross manual references?
 # list of tables/list of floats
+# add landmarks?  Examples: epub:type="toc", epub:type="loi" (list of 
illustrations)
+#                           epub:type="bodymatter" (Start of Content)
 
 use strict;
 
@@ -569,12 +571,13 @@ EOT
     print $opf_fh "      <item id=\"${spine_uid_str}${id_count}\" "
      . "media-type=\"application/xhtml+xml\" 
href=\"${epub_xhtml_dir}/${output_filename}\"${properties_str}/>\n";
   }
+  my $js_weblabels_id;
   if ($self->get_conf('JS_WEBLABELS_FILE')) {
     my $js_weblabels_file_name = $self->get_conf('JS_WEBLABELS_FILE');
     my $js_licenses_file_path = 
File::Spec->catfile($epub_document_destination_directory,
                                                     $js_weblabels_file_name);
     if (-e $js_licenses_file_path) {
-      my $js_weblabels_id = 'jsweblabels';
+      $js_weblabels_id = 'jsweblabels';
       print $opf_fh "      <item id=\"${js_weblabels_id}\" "
      . "media-type=\"application/xhtml+xml\" 
href=\"${epub_xhtml_dir}/${js_weblabels_file_name}\"/>\n";
     }
@@ -632,6 +635,17 @@ EOT
     $id_count++;
     print $opf_fh "      <itemref idref=\"${spine_uid_str}${id_count}\"/>\n";
   }
+  # Depending on the reader, the js_labels file should better be in the 
<spine> or
+  # not.  The standard allows both showing the linear="no" elements as part
+  # of the default reading order or not.  It is probably better for the
+  # js_labels to be in the spine if they can be viewed in any way.
+  # Foliate does not show the js_labels file upon clicking if not in
+  # the <spine>.
+  # Calibre shows the js_labels file upon clicking if not in the <spine>, and
+  # steps in the js_labels file if in the spine.
+  if (defined($js_weblabels_id)) {
+    print $opf_fh "      <itemref idref=\"${js_weblabels_id}\" 
linear=\"no\"/>\n";
+  }
 
   print $opf_fh <<EOT;
    </spine>
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 85b043b14e..379f87437f 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
@@ -31,5 +31,6 @@
       <itemref idref="unit5"/>
       <itemref idref="unit6"/>
       <itemref idref="unit7"/>
+      <itemref idref="jsweblabels" linear="no"/>
    </spine>
 </package>



reply via email to

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