[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 4 Sep 2024 10:43:52 -0400 (EDT) |
branch: master
commit 0eb8b605504b1f18fbc4414a5052698b1390248f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Sep 4 15:29:52 2024 +0200
* tp/Texinfo/options_data.txt (EPUB_STRICT): add.
* tp/ext/epub3.pm (epub_finish): if EPUB_STRICT is set, use the EPUB
generation time for dcterms:modified. Based on patch from Daniel
Cerqueira <dan.git@lispclub.com>.
* tp/maintain/check_epubcheck_texi_t.sh: set LC_ALL and LANGUAGE for
reproducible errors. Use EPUB_STRICT in call. Keep the epub_package
directory.
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/options_data.txt | 2 ++
tp/ext/epub3.pm | 21 ++++++++++++++++++---
tp/maintain/check_epubcheck_texi_t.sh | 12 ++++++++----
4 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 65d4a3426a..ffa006b0f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-09-04 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/options_data.txt (EPUB_STRICT): add.
+
+ * tp/ext/epub3.pm (epub_finish): if EPUB_STRICT is set, use the EPUB
+ generation time for dcterms:modified. Based on patch from Daniel
+ Cerqueira <dan.git@lispclub.com>.
+
+ * tp/maintain/check_epubcheck_texi_t.sh: set LC_ALL and LANGUAGE for
+ reproducible errors. Use EPUB_STRICT in call. Keep the epub_package
+ directory.
+
2024-09-04 Patrice Dumas <pertusus@free.fr>
* tp/maintain/check_epubcheck_texi_t.sh: check systematically EPUB
diff --git a/tp/Texinfo/options_data.txt b/tp/Texinfo/options_data.txt
index 18fca01a14..8e054bf558 100644
--- a/tp/Texinfo/options_data.txt
+++ b/tp/Texinfo/options_data.txt
@@ -232,6 +232,8 @@ END_USEPACKAGE converter_customization
undef char
EPUB_CREATE_CONTAINER_FILE converter_customization undef integer
# for ext/epub3.pm
EPUB_KEEP_CONTAINER_FOLDER converter_customization undef integer
+# could be temporary
+EPUB_STRICT converter_customization undef integer
EXTENSION converter_customization undef char
EXTERNAL_CROSSREF_EXTENSION converter_customization undef char
# This is used like a boolean, but it is set to a char to match SPLIT, such
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index 40e2b99bae..2c9a1ff3b1 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -88,6 +88,9 @@ use File::Path;
use File::Spec;
use File::Copy;
+# for strftime
+use POSIX();
+
# for fileparse
use File::Basename;
@@ -783,16 +786,24 @@ EOT
my $unique_uid = 'texi-uid';
# TODO to discuss on bug-texinfo
my $identifier = 'texinfo:'.$document_name;
- # FIXME the dcterms:modified is mandatory, and it is also mandatory that it
is a date:
+ # the dcterms:modified is mandatory, and it is also mandatory that it is a
date:
# each Rendition MUST include exactly one [DCTERMS] modified property
containing its last modification date. The value of this property MUST be an
[XMLSCHEMA-2] dateTime conformant date of the form:
# CCYY-MM-DDThh:mm:ssZ
#
# The last modification date MUST be expressed in Coordinated Universal Time
(UTC) and MUST be terminated by the "Z" (Zulu) time zone indicator.
- #
- # <meta property="dcterms:modified">2012-03-05T12:47:00Z</meta>
+ # FIXME add a way for the user to set $dcterms_modified_str
+ my $dcterms_modified_str;
+ if ($self->get_conf('EPUB_STRICT')) {
+ # dcterms:modified is a publication date. If the user did not specify
+ # one, we use the EPUB generation time.
+ my $datetime_zulu = POSIX::strftime("%Y-%m-%dT%TZ", gmtime());
+ $dcterms_modified_str = $datetime_zulu;
+ }
+
# to discuss
# <dc:rights>
+
my $opf_file_path_name = File::Spec->catfile($epub_destination_directory,
$epub_document_dir_name,
$opf_filename);
my ($encoded_opf_file_path_name, $opf_path_encoding)
@@ -814,6 +825,10 @@ EOT
<dc:identifier id="$unique_uid">$identifier</dc:identifier>
<dc:title>$title</dc:title>
EOT
+ if (defined($dcterms_modified_str)) {
+ print $opf_fh " <meta property=\"dcterms:modified\">"
+ .$dcterms_modified_str."</meta>\n";
+ }
my @relevant_commands = ('author', 'documentlanguage');
my $collected_commands = Texinfo::Common::collect_commands_list_in_tree(
$document_root, \@relevant_commands);
diff --git a/tp/maintain/check_epubcheck_texi_t.sh
b/tp/maintain/check_epubcheck_texi_t.sh
index 7ca2e372dc..cdaf289c0f 100755
--- a/tp/maintain/check_epubcheck_texi_t.sh
+++ b/tp/maintain/check_epubcheck_texi_t.sh
@@ -21,6 +21,9 @@ if [ z"$srcdir" = 'z' ]; then
srcdir='.'
fi
+LC_ALL=C; export LC_ALL
+LANGUAGE=en; export LANGUAGE
+
mdir=check_epubcheck
mkdir -p $mdir
@@ -43,7 +46,7 @@ if test -n "$1"; then
perl -w ${srcdir}/t/???$the_directory.t -c $the_test
fi
else
- rm -rf $mdir/epubcheck_EPUB/$the_directory
$mdir/epubcheck_check/$the_directory $mdir/epubcheck_logs/$the_directory.log
+ rm -rf $mdir/epubcheck_EPUB/$the_directory
$mdir/epubcheck_package/$the_directory $mdir/epubcheck_check/$the_directory
$mdir/epubcheck_logs/$the_directory.log
if test -f ${srcdir}/t/$the_directory.t ; then
perl -w ${srcdir}/t/$the_directory.t -c
elif test -f ${srcdir}/t/??$the_directory.t ; then
@@ -53,7 +56,7 @@ if test -n "$1"; then
fi
fi
else
- rm -rf $mdir/epubcheck_EPUB $mdir/epubcheck_check $mdir/epubcheck_logs
+ rm -rf $mdir/epubcheck_EPUB $mdir/epubcheck_package $mdir/epubcheck_check
$mdir/epubcheck_logs
${srcdir}/maintain/all_tests.sh texis > $mdir/all_tests_texis.log
fi
@@ -68,7 +71,7 @@ for dir in `find t_texis/ -type d` ; do
continue
fi
echo "doing $bdir"
- mkdir -p $mdir/epubcheck_EPUB/$bdir $mdir/epubcheck_check/$bdir
+ mkdir -p $mdir/epubcheck_EPUB/$bdir $mdir/epubcheck_package/$bdir
$mdir/epubcheck_check/$bdir
if test $one_test = 'yes' ; then
mkdir -p $mdir/onetest_logs
logfile=$mdir/onetest_logs/$the_test.log
@@ -82,10 +85,11 @@ for dir in `find t_texis/ -type d` ; do
continue
fi
echo " -> $file: EPUB"
- ${srcdir}/texi2any.pl --epub --force --error=100000 -o
$mdir/epubcheck_EPUB/$bdir/$bfile.epub $file
+ ${srcdir}/texi2any.pl --epub --force --error=100000 -o
$mdir/epubcheck_EPUB/$bdir/$bfile.epub -c
SUBDIR=$mdir/epubcheck_package/$bdir/${bfile}_epub_package -c EPUB_STRICT=1 -c
EPUB_KEEP_CONTAINER_FOLDER=1 $file
echo " epubcheck"
epubcheck $mdir/epubcheck_EPUB/$bdir/$bfile.epub
2>$mdir/epubcheck_check/$bdir/$bfile.out
done
) > $logfile 2>&1
done
+head -1000 $mdir/epubcheck_check/*/*.out > $mdir/epubcheck_all.log