From 37dfda47fe844c888a24fb8cc380d34139dca9f4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 28 Apr 2017 21:21:37 +0000 Subject: tex4ebook (28apr17) git-svn-id: svn://tug.org/texlive/trunk@44103 c570f23f-e606-0410-a88d-b1316a301751 --- .../texlive/linked_scripts/tex4ebook/tex4ebook | 5 +- .../texk/texlive/linked_scripts/texlive/tlmgr.pl | 149 +++++++++++++++++---- Master/bin/armhf-linux/eptex | Bin 536980 -> 539936 bytes Master/bin/armhf-linux/euptex | Bin 545168 -> 545244 bytes Master/bin/armhf-linux/gregorio | Bin 637244 -> 637244 bytes Master/bin/armhf-linux/luajittex | Bin 7535484 -> 7538436 bytes Master/bin/armhf-linux/luatex | Bin 7344396 -> 7347332 bytes Master/bin/armhf-linux/mf | Bin 305956 -> 305956 bytes Master/bin/armhf-linux/mf-nowin | Bin 302628 -> 302628 bytes Master/bin/armhf-linux/mflua | Bin 499316 -> 494636 bytes Master/bin/armhf-linux/mfluajit | Bin 752768 -> 748672 bytes Master/bin/armhf-linux/pdftex | Bin 1705616 -> 1709124 bytes Master/bin/armhf-linux/pmpost | Bin 1965536 -> 1965536 bytes Master/bin/armhf-linux/ptex | Bin 470196 -> 471036 bytes Master/bin/armhf-linux/tex | Bin 342884 -> 342884 bytes Master/bin/armhf-linux/upmpost | Bin 1965536 -> 1965536 bytes Master/bin/armhf-linux/uptex | Bin 473244 -> 475604 bytes Master/bin/armhf-linux/xdvipdfmx | Bin 815032 -> 813328 bytes Master/bin/armhf-linux/xetex | Bin 22764064 -> 22766872 bytes Master/bin/armhf-linux/xindy.mem | Bin 1095083 -> 1093730 bytes Master/bin/armhf-linux/xindy.run | Bin 2217048 -> 3102216 bytes Master/texmf-dist/doc/support/tex4ebook/README | 59 ++++---- .../texmf-dist/doc/support/tex4ebook/changelog.tex | 98 ++++++++++++++ Master/texmf-dist/doc/support/tex4ebook/readme.tex | 26 ++-- .../doc/support/tex4ebook/tex4ebook-doc.pdf | Bin 67170 -> 69209 bytes .../doc/support/tex4ebook/tex4ebook-doc.tex | 3 +- .../texmf-dist/doc/support/tex4ebook/tidyconf.conf | 4 + Master/texmf-dist/scripts/tex4ebook/exec_epub.lua | 52 ++++--- Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua | 1 + Master/texmf-dist/scripts/tex4ebook/tex4ebook | 5 +- .../tex/latex/tex4ebook/tex4ebook-epub3.4ht | 2 +- .../texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht | 83 +++++++----- 32 files changed, 369 insertions(+), 118 deletions(-) create mode 100644 Master/texmf-dist/doc/support/tex4ebook/tidyconf.conf diff --git a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook index b305c806c57..5c9f65573f7 100755 --- a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook +++ b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook @@ -52,12 +52,11 @@ else end if args.version then - print "tex4ebook version 0.1d" + print "tex4ebook v0.1e" return end if args.lua then - print("Mame lua") latex_cmd="dvilualatex" end @@ -167,7 +166,7 @@ if args["build-file"] and args["build-file"] ~= "nil" then build_file = args["build-file"] end -local config_file = ebookutils.load_config(nil, build_file) +local config_file = ebookutils.load_config(params, build_file) params["config_file"] = config_file --config_file.Make:run() diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl index d365acb2dd0..f8f3e55ba42 100755 --- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl +++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl @@ -1,13 +1,13 @@ #!/usr/bin/env perl -# $Id: tlmgr.pl 43990 2017-04-23 13:21:28Z preining $ +# $Id: tlmgr.pl 44076 2017-04-27 08:51:00Z preining $ # # Copyright 2008-2017 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. # -my $svnrev = '$Revision: 43990 $'; -my $datrev = '$Date: 2017-04-23 15:21:28 +0200 (Sun, 23 Apr 2017) $'; +my $svnrev = '$Revision: 44076 $'; +my $datrev = '$Date: 2017-04-27 10:51:00 +0200 (Thu, 27 Apr 2017) $'; my $tlmgrrevision; my $prg; if ($svnrev =~ m/: ([0-9]+) /) { @@ -4349,7 +4349,7 @@ sub action_platform { } } print "Already installed platforms are marked with (i)\n"; - print "You can add new platforms with: tlmgr platform add ARCH1 ARCH2...\n"; + print "You can add new platforms with: tlmgr platform add PLAT1 PLAT2...\n"; return ($F_OK | $F_NOPOSTACTION); } elsif ($what =~ m/^add$/i) { return ($F_ERROR) if !check_on_writable(); @@ -5513,7 +5513,7 @@ sub action_conf { } elsif ($arg !~ /^(tlmgr|texmf|updmap)$/) { warn "$prg: unknown conf arg: $arg (try tlmgr or texmf or updmap)\n"; - $ret = $F_ERROR; + return($F_ERROR); } else { my ($fn,$cf); @@ -5533,7 +5533,7 @@ sub action_conf { } else { die "Should not happen, conf arg=$arg"; } - my ($key,$val) = @ARGV; + my ($key,$val,$str) = @ARGV; if (!defined($key)) { # show all settings if ($cf) { @@ -5543,13 +5543,101 @@ sub action_conf { } } else { info("$arg config file $fn not present\n"); - $ret = $F_WARNING; + return($F_WARNING); } } else { - if (!defined($val)) { + if ($key eq "auxtrees") { + if ($arg eq "texmf") { + my $tmfa = 'TEXMFAUXTREES'; + my $tv = $cf->value($tmfa); + if ($val eq "show") { + if (defined($tv)) { + $tv =~ s/^\s*{//; + $tv =~ s/}\s*$//; + $tv =~ s/,$//; + my @foo = split(',', $tv); + print "List of auxiliary texmf trees:\n" if (@foo); + for my $f (@foo) { + print " $f\n"; + } + return($F_OK); + } else { + print "No auxiliary texmf trees defined.\n"; + return($F_OK); + } + } elsif ($val eq "add") { + if (defined($str)) { + if (defined($tv)) { + $tv =~ s/^\s*{//; + $tv =~ s/}\s*$//; + $tv =~ s/,$//; + my @foo = split(',', $tv); + my @new; + my $already = 0; + for my $f (@foo) { + if ($f eq $str) { + print "Already registered auxtree: $str\n"; + return ($F_WARNING); + } else { + push @new, $f; + } + } + push @new, $str; + $cf->value($tmfa, '{' . join(',', @new) . ',}'); + } else { + $cf->value($tmfa, '{' . $str . ',}'); + } + } else { + warning("argument missing for auxtrees add\n"); + return($F_ERROR); + } + } elsif ($val eq "remove") { + if (defined($str)) { + if (defined($tv)) { + $tv =~ s/^\s*{//; + $tv =~ s/}\s*$//; + $tv =~ s/,$//; + my @foo = split(',', $tv); + my @new; + my $removed = 0; + for my $f (@foo) { + if ($f ne $str) { + push @new, $f; + } else { + $removed = 1; + } + } + if ($removed) { + if ($#new >= 0) { + $cf->value($tmfa, '{' . join(',', @new) . ',}'); + } else { + $cf->delete_key($tmfa); + } + } else { + print ("Not defined as auxiliary texmf tree: $str\n"); + return($F_WARNING); + } + } else { + print "No auxiliary texmf trees defined, nothing removed\n"; + return($F_WARNING); + } + } else { + warning("argument missing for auxtrees remove\n"); + return($F_ERROR); + } + } else { + warning("unknown operation on auxtrees: $val\n"); + return($F_ERROR); + } + } else { + warning("auxtrees not suitable for $arg\n"); + return($F_ERROR); + } + } elsif (!defined($val)) { if (defined($opts{'delete'})) { if (defined($cf->value($key))) { - info("removing setting $arg $key value: " . $cf->value($key) . "from $fn\n"); + info("removing setting $arg $key value: " . $cf->value($key) + . "from $fn\n"); $cf->delete_key($key); } else { info("$arg $key not defined, cannot remove ($fn)\n"); @@ -5586,6 +5674,7 @@ sub action_conf { $cf->save; } } + return($ret); } # output various values in same form as texconfig conf. @@ -7026,16 +7115,16 @@ checking the TL development repository. =back =head2 conf [texmf|tlmgr|updmap [--conffile I] [--delete] [I [I]]] +=head2 conf texmf [--conffile I] auxtrees [show|add|delete] [I] With only C, show general configuration information for TeX Live, including active configuration files, path settings, and more. This is -like the C call, but works on all supported platforms. +like running C, but works on all supported platforms. -With either C, C, or C given in -addition, shows all key/value pairs (i.e., all settings) as saved in -C, the user-specific C configuration file (see -below), or the first found (via C) C file, -respectively. +With one of C, C, or C, shows all +key/value pairs (i.e., all settings) as saved in C, the +user-specific C configuration file (see below), or the first +found (via C) C file, respectively. If I is given in addition, shows the value of only that I in the respective file. If option I<--delete> is also given, the value in @@ -7045,29 +7134,33 @@ out). If I is given in addition, I is set to I in the respective file. I +For C, an additional subcommand C allows adding and +removing arbitrary additional texmf trees, completely under user +control. C shows the list of additional trees, +C I adds a tree to the list, and C I removes a tree from the list (if present). This +works by manipulating the Kpathsea variable C, in +C. Example: + + tlmgr conf texmf auxtrees add /my/quick/test/tree + tlmgr conf texmf auxtrees remove /my/quick/test/tree + In all cases the file used can be explicitly specified via the option C<--conffile I>, in case one wants to operate on a different file. -The PATH value shown is that used by C. The directory in which -the C executable is found is automatically prepended to the PATH -value inherited from the environment. +The C value shown is that used by C. The directory in +which the C executable is found is automatically prepended to the +PATH value inherited from the environment. -Practical example of changing configuration values: if the execution of +A practical example of changing configuration values: if the execution of (some or all) system commands via C<\write18> was left enabled during installation, you can disable it afterwards: tlmgr conf texmf shell_escape 0 -A more complicated example: the C tree (see the main TeX Live -guide, L) can be set to multiple -directories, but they must be enclosed in braces and separated by -commas, so quoting the value to the shell is a good idea. Thus: - - tlmgr conf texmf TEXMFHOME "{~/texmf,~/texmfbis}" - Warning: The general facility is here, but tinkering with settings in -this way is very strongly discouraged. Again, no error checking on -either keys or values is done, so any sort of breakage is possible. +this way is strongly discouraged. Again, no error checking on either +keys or values is done, so any sort of breakage is possible. =head2 dump-tlpdb [--local|--remote] diff --git a/Master/bin/armhf-linux/eptex b/Master/bin/armhf-linux/eptex index 4eeb3ae7d62..6c71c655d15 100755 Binary files a/Master/bin/armhf-linux/eptex and b/Master/bin/armhf-linux/eptex differ diff --git a/Master/bin/armhf-linux/euptex b/Master/bin/armhf-linux/euptex index c03d58cc536..a3305200f1f 100755 Binary files a/Master/bin/armhf-linux/euptex and b/Master/bin/armhf-linux/euptex differ diff --git a/Master/bin/armhf-linux/gregorio b/Master/bin/armhf-linux/gregorio index b10f6ac841b..99e96ece24c 100755 Binary files a/Master/bin/armhf-linux/gregorio and b/Master/bin/armhf-linux/gregorio differ diff --git a/Master/bin/armhf-linux/luajittex b/Master/bin/armhf-linux/luajittex index 35147f42da7..729805f99c6 100755 Binary files a/Master/bin/armhf-linux/luajittex and b/Master/bin/armhf-linux/luajittex differ diff --git a/Master/bin/armhf-linux/luatex b/Master/bin/armhf-linux/luatex index fce11b5d350..6c3d9075467 100755 Binary files a/Master/bin/armhf-linux/luatex and b/Master/bin/armhf-linux/luatex differ diff --git a/Master/bin/armhf-linux/mf b/Master/bin/armhf-linux/mf index 0d500dda23b..3b2ad30a71e 100755 Binary files a/Master/bin/armhf-linux/mf and b/Master/bin/armhf-linux/mf differ diff --git a/Master/bin/armhf-linux/mf-nowin b/Master/bin/armhf-linux/mf-nowin index 11d7d6a72ac..086e19b108a 100755 Binary files a/Master/bin/armhf-linux/mf-nowin and b/Master/bin/armhf-linux/mf-nowin differ diff --git a/Master/bin/armhf-linux/mflua b/Master/bin/armhf-linux/mflua index f059350fcfb..c4df3f03fdb 100755 Binary files a/Master/bin/armhf-linux/mflua and b/Master/bin/armhf-linux/mflua differ diff --git a/Master/bin/armhf-linux/mfluajit b/Master/bin/armhf-linux/mfluajit index 3e69a26a7b3..61c1e44ed1c 100755 Binary files a/Master/bin/armhf-linux/mfluajit and b/Master/bin/armhf-linux/mfluajit differ diff --git a/Master/bin/armhf-linux/pdftex b/Master/bin/armhf-linux/pdftex index 901390f3a96..c6dbcc706cf 100755 Binary files a/Master/bin/armhf-linux/pdftex and b/Master/bin/armhf-linux/pdftex differ diff --git a/Master/bin/armhf-linux/pmpost b/Master/bin/armhf-linux/pmpost index f6741e5b1ff..f58063c4c6f 100755 Binary files a/Master/bin/armhf-linux/pmpost and b/Master/bin/armhf-linux/pmpost differ diff --git a/Master/bin/armhf-linux/ptex b/Master/bin/armhf-linux/ptex index fbcbbb8e195..0f62b78176b 100755 Binary files a/Master/bin/armhf-linux/ptex and b/Master/bin/armhf-linux/ptex differ diff --git a/Master/bin/armhf-linux/tex b/Master/bin/armhf-linux/tex index fb4f5225494..df6abb82bc0 100755 Binary files a/Master/bin/armhf-linux/tex and b/Master/bin/armhf-linux/tex differ diff --git a/Master/bin/armhf-linux/upmpost b/Master/bin/armhf-linux/upmpost index 6cde8de3825..43326222461 100755 Binary files a/Master/bin/armhf-linux/upmpost and b/Master/bin/armhf-linux/upmpost differ diff --git a/Master/bin/armhf-linux/uptex b/Master/bin/armhf-linux/uptex index c6614c8d5b0..8e2db9d7758 100755 Binary files a/Master/bin/armhf-linux/uptex and b/Master/bin/armhf-linux/uptex differ diff --git a/Master/bin/armhf-linux/xdvipdfmx b/Master/bin/armhf-linux/xdvipdfmx index b2417af096b..f86da564dbe 100755 Binary files a/Master/bin/armhf-linux/xdvipdfmx and b/Master/bin/armhf-linux/xdvipdfmx differ diff --git a/Master/bin/armhf-linux/xetex b/Master/bin/armhf-linux/xetex index a1bc94041a7..1b4a86c0f06 100755 Binary files a/Master/bin/armhf-linux/xetex and b/Master/bin/armhf-linux/xetex differ diff --git a/Master/bin/armhf-linux/xindy.mem b/Master/bin/armhf-linux/xindy.mem index 19f9ad3d151..8551dedece6 100644 Binary files a/Master/bin/armhf-linux/xindy.mem and b/Master/bin/armhf-linux/xindy.mem differ diff --git a/Master/bin/armhf-linux/xindy.run b/Master/bin/armhf-linux/xindy.run index af507c3467e..1e838069cf0 100755 Binary files a/Master/bin/armhf-linux/xindy.run and b/Master/bin/armhf-linux/xindy.run differ diff --git a/Master/texmf-dist/doc/support/tex4ebook/README b/Master/texmf-dist/doc/support/tex4ebook/README index 2514a630aca..2314aa3478b 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/README +++ b/Master/texmf-dist/doc/support/tex4ebook/README @@ -50,7 +50,7 @@ but it is optional. You shouldn't need to modify your \TeX\ files # Command line options --c,--config +`-c,--config` : specify custom config file for `tex4ht` @@ -69,48 +69,48 @@ but it is optional. You shouldn't need to modify your \TeX\ files This config file will create `xhtml` file for every section. Note that this behaviour is default. --e,--build-file (default nil) +`-e,--build-file (default nil)` -: Specify make4ht build file^[\url{https://github.com/michal-h21/make4ht\#build-file}]. +: Specify make4ht build file^[https://github.com/michal-h21/make4ht#build-file]. Defaulf build file filename is `filename.mk4`, use this option if you use different filename. --f,--format (default epub) +`-f,--format (default epub)` : Output format. epub, epub3 and mobi are supported. --l,--lua +`-l,--lua` : Runs htlualatex instead of htlatex. --m,--mode (default default) +`-m,--mode (default default)` : This set `mode` variable, accessible in the build file. Default supported values are `default` and `draft`. In `draft` mode, document is compiled only once, instead of three times. --r,--resolution +`-r,--resolution` : Resolution of generated images, for example math. It should meet resolution of target devices, which is usually about 167 ppi. --s,--shell-escape +`-s,--shell-escape` : Enable shell escape in htlatex run. This may be needed if you run external commands from your source files. --t,--tidy +`-t,--tidy` : process output html files with `HTML tidy` command^[It needs to be installed separately]. --v,--version +`-v,--version` : print version number # Configuration -`tex4ebook` uses `tex4ht`^[\url{http://www.tug.org/tex4ht/}] for conversion from LaTeX +`tex4ebook` uses `tex4ht`^[http://www.tug.org/tex4ht/] for conversion from LaTeX to html. `tex4ht` is highly configurable using config files. Basic config file structure is @@ -121,20 +121,20 @@ structure is \EndPreamble Basic info about command configurations can be found in a work-in-progres - *tex4ht tutorial*^[\url{https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial}] -, *tex4ht documentation*^[\url{http://www.tug.org/applications/tex4ht/mn11.html}], + *tex4ht tutorial*^[https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial] +, *tex4ht documentation*^[http://www.tug.org/applications/tex4ht/mn11.html], and in series of blogposts on CV Radhakrishnan's blog: -*Configure part 1*^[\url{http://www.cvr.cc/?p=323}], -*Configure part 2*^[\url{http://www.cvr.cc/?p=362}], -*Low level commands*^[\url{http://www.cvr.cc/?p=482}]. +*Configure part 1*^[http://www.cvr.cc/?p=323], +*Configure part 2*^[http://www.cvr.cc/?p=362], +*Low level commands*^[http://www.cvr.cc/?p=482]. Available options for `\Preamble` command are listed in the article -*TeX4ht: options*^[\url{http://www.cvr.cc/?p=504}]. +*TeX4ht: options*^[http://www.cvr.cc/?p=504]. -Great source of tips for `tex4ht` configuring is *tex4ht tag on TeX.sx*^[\url{http://tex.stackexchange.com/questions/tagged/tex4ht}], there is also a *tag for tex4ebook*^[\url{http://tex.stackexchange.com/questions/tagged/tex4ebook}]. +Great source of tips for `tex4ht` configuring is *tex4ht tag on TeX.sx*^[http://tex.stackexchange.com/questions/tagged/tex4ht], there is also a *tag for tex4ebook*^[http://tex.stackexchange.com/questions/tagged/tex4ebook]. Examples of interesting questions are -*including images and fonts in ebooks*^[\url{http://tex.stackexchange.com/a/213165/2891}] -or *setting image size in em units instead of pt*^[\url{http://tex.stackexchange.com/a/195718/2891}]. +*including images and fonts in ebooks*^[http://tex.stackexchange.com/a/213165/2891] +or *setting image size in em units instead of pt*^[http://tex.stackexchange.com/a/195718/2891]. ## Provided configurations @@ -151,6 +151,11 @@ Default identifier is URI, with value `http://example.com/\jobname`. Type of unique identifier, default type is URI. It is used only in epub, it is deprecated for `epub3` + \Configure{resettoclevels}{list of section types in descending order} + +Configure section types which should be included in the `NCX` file. Default +value is the whole document hiearchy, from `\part` to `\paragraph`. + \Configure{DocumentLanguage}{language code} Each epub must declare the document language. It is inferred from `babel` main @@ -198,17 +203,17 @@ Add xml name space to `xhtml` files. Useful in `EPUB 3` `\OpfAddProperty{property type}` -: add `EPUB3` property for the current file. See *EPUB3 spec*^[\url{http://www.idpf.org/epub/301/spec/epub-publications.html\#sec-item-property-values}] +: add `EPUB3` property for the current file. See *EPUB3 spec*^[http://www.idpf.org/epub/301/spec/epub-publications.html#sec-item-property-values] `\OpfGuide[filename]{title}{type}` : Add file to the `` section in the `OPF` file. See *Where do you start an ePUB and what is the `` section of the .OPF - file?*^[\url{http://epubsecrets.com/where-do-you-start-an-epub-and-what-is-the-guide-section-of-the-opf-file.php}] + file?*^[http://epubsecrets.com/where-do-you-start-an-epub-and-what-is-the-guide-section-of-the-opf-file.php] for some details. Note that `` is deprecated in `EPUB 3`. ## Build files -`tex4ebook` uses `make4ht`^[\url{https://github.com/michal-h21/make4ht}] as a build +`tex4ebook` uses `make4ht`^[https://github.com/michal-h21/make4ht] as a build system. See `make4ht` documentation for details on build files. # Troubleshooting @@ -222,8 +227,8 @@ be caused by some problem in `tex4ht` configuration. Comment out line if same error as in `tex4ebook` run arises, the problem is in some `tex4ht` configuration. Try to identify the source of problem and if you cannot find the solution, make minimal example showing the error and ask for help either on -*tex4ht mailing list*^[\url{http://tug.org/mailman/listinfo/tex4ht}] or on -*TeX-sx*^[\url{http://tex.stackexchange.com/}]. +*tex4ht mailing list*^[http://tug.org/mailman/listinfo/tex4ht] or on +*TeX-sx*^[http://tex.stackexchange.com/]. ## Fontspec @@ -251,7 +256,7 @@ Sample: The drawback is that not all characters of the Unicode range are supported with `inputenc`. For some solutions of this limitation, see a thread on *tex4ht -mailing list*^[\url{http://tug.org/pipermail/tex4ht/2013q1/000719.html}] +mailing list*^[http://tug.org/pipermail/tex4ht/2013q1/000719.html] Other approach is to use `alternative4ht` package from [helpers4ht](https://github.com/michal-h21/helpers4ht) bundle. It works only with Lua backend, but it supports full unicode and you @@ -261,7 +266,7 @@ an [example](http://michal-h21.github.io/samples/helpers4ht/fontspec.html). ## Validation In case of successful compilation, use command line tool `epubcheck`^[you need -to install it separately, see \url{https://github.com/IDPF/epubcheck}] to check +to install it separately, see https://github.com/IDPF/epubcheck] to check whether your document doesn't contain any errors. diff --git a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex index e280b766cac..1b59f20d4ad 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex @@ -1,6 +1,104 @@ \section{Changes}\label{changes} \begin{itemize} +\item + 27/04/2017 Version 0.1e + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + pack the accumulated changes for distribution + \item + set version number from git tag + \end{itemize} +\item + 17/01/2017 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + process duplicate images only once + \item + check the OPF table for duplicated id attributes + \end{itemize} +\item + 11/01/2017 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + pass \texttt{settings} table to the build file. + \end{itemize} +\item + 19/12/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + new configuration: + \texttt{\textbackslash{}Configure\{resettoclevels\}\{list of sectioning levels to be included in the NCX\}} + \end{itemize} +\item + 31/10/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + added tidyconf.conf to the Makefile + \end{itemize} +\item + 22/10/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + added support for new Make4ht command \texttt{Make:add\_file} + \end{itemize} +\item + 22/08/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + fixed incorrect \texttt{\textless{}dc:creator\textgreater{}} + generated by \texttt{\textbackslash{}author} + \item + clean ids in the OPF file if they contain invalid characters at the + beginning + \end{itemize} +\item + 31/07/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + use monospace font for command line options in order to prevent + double hyphens to become dashes by ligaturing + \end{itemize} +\item + 22/07/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + removed debugging message when \texttt{-{}-lua} option is used + \end{itemize} +\item + 07/04/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + Cut \texttt{\textbackslash{}part} commands to standalone pages + \end{itemize} +\item + 05/04/2016 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + bug fix: pages which contained math were arranged before other pages + \end{itemize} \item 31/03/2016 Version 0.1d diff --git a/Master/texmf-dist/doc/support/tex4ebook/readme.tex b/Master/texmf-dist/doc/support/tex4ebook/readme.tex index 01ea98348c3..e5078cfe866 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/readme.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/readme.tex @@ -64,7 +64,7 @@ but it is optional. You shouldn't need to modify your \TeX~files \begin{description} \itemsep1pt\parskip0pt\parsep0pt -\item[-c,--config] +\item[\texttt{-c,-{}-config}] specify custom config file for \texttt{tex4ht} \end{description} @@ -87,29 +87,29 @@ This config file will create \texttt{xhtml} file for every section. Note that this behaviour is default. \begin{description} -\item[-e,--build-file (default nil)] +\item[\texttt{-e,-{}-build-file (default nil)}] Specify make4ht build file\footnote{\url{https://github.com/michal-h21/make4ht\#build-file}}. Defaulf build file filename is \texttt{filename.mk4}, use this option if you use different filename. -\item[-f,--format (default epub)] +\item[\texttt{-f,-{}-format (default epub)}] Output format. epub, epub3 and mobi are supported. -\item[-l,--lua] +\item[\texttt{-l,-{}-lua}] Runs htlualatex instead of htlatex. -\item[-m,--mode (default default)] +\item[\texttt{-m,-{}-mode (default default)}] This set \texttt{mode} variable, accessible in the build file. Default supported values are \texttt{default} and \texttt{draft}. In \texttt{draft} mode, document is compiled only once, instead of three times. -\item[-r,--resolution] +\item[\texttt{-r,-{}-resolution}] Resolution of generated images, for example math. It should meet resolution of target devices, which is usually about 167 ppi. -\item[-s,--shell-escape] +\item[\texttt{-s,-{}-shell-escape}] Enable shell escape in htlatex run. This may be needed if you run external commands from your source files. -\item[-t,--tidy] +\item[\texttt{-t,-{}-tidy}] process output html files with \texttt{HTML tidy} command\footnote{It needs to be installed separately}. -\item[-v,--version] +\item[\texttt{-v,-{}-version}] print version number \end{description} @@ -164,6 +164,14 @@ Default identifier is URI, with value Type of unique identifier, default type is URI. It is used only in epub, it is deprecated for \texttt{epub3} +\begin{verbatim} +\Configure{resettoclevels}{list of section types in descending order} +\end{verbatim} + +Configure section types which should be included in the \texttt{NCX} +file. Default value is the whole document hiearchy, from +\texttt{\textbackslash{}part} to \texttt{\textbackslash{}paragraph}. + \begin{verbatim} \Configure{DocumentLanguage}{language code} \end{verbatim} diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf index 0bb5a6e8aba..55ff450ede8 100644 Binary files a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf and b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf differ diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex index b354d948167..073d81d7ac2 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex @@ -11,10 +11,11 @@ \setmainfont{TeX Gyre Schola} \fi \usepackage{microtype} +\providecommand\tightlist{\relax} \title{The \texttt{tex4ebook} package} \author{Michal Hoftich\footnote{\url{michal.h21@gmail.com}}} -\date{Version 0.1d\\2016/03/31} +\date{Version \version\\\gitdate} \begin{document} \maketitle \tableofcontents diff --git a/Master/texmf-dist/doc/support/tex4ebook/tidyconf.conf b/Master/texmf-dist/doc/support/tex4ebook/tidyconf.conf new file mode 100644 index 00000000000..abac96362bd --- /dev/null +++ b/Master/texmf-dist/doc/support/tex4ebook/tidyconf.conf @@ -0,0 +1,4 @@ +show-warnings: no +numeric-entities:yes +new-inline-tags:span,a,math,mi, mo, mn ,abs ,and ,annotation ,annotation-xml ,apply ,approx ,arccos ,arccosh ,arccot ,arccoth ,arccsc ,arccsch ,arcsec ,arcsech ,arcsin ,arcsinh ,arctan ,arctanh ,arg ,bind ,bvar ,card ,cartesianproduct ,cbytes ,ceiling ,cerror ,ci ,cn ,codomain ,complexes ,compose ,condition ,conjugate ,cos ,cosh ,cot ,coth ,cs ,csc ,csch ,csymbol ,curl ,declare ,degree ,determinant ,diff ,divergence ,divide ,domain ,domainofapplication ,el ,emptyset ,eq ,equivalent ,eulergamma ,exists ,exp ,exponentiale ,factorial ,factorof ,false ,floor ,fn ,forall ,gcd ,geq ,grad ,gt ,ident ,image ,imaginary ,imaginaryi ,implies ,in ,infinity ,int ,integers ,intersect ,interval ,inverse ,lambda ,laplacian ,lcm ,leq ,limit ,list ,ln ,log ,logbase ,lowlimit ,lt ,maction ,malign ,maligngroup ,malignmark ,malignscope ,math ,matrix ,matrixrow ,max ,mean ,median ,menclose ,merror ,mfenced ,mfrac ,mfraction ,mglyph ,mi ,min ,minus ,mlabeledtr ,mlongdiv ,mmultiscripts ,mn ,mo ,mode ,moment ,momentabout ,mover ,mpadded ,mphantom ,mprescripts ,mroot ,mrow ,ms ,mscarries ,mscarry ,msgroup ,msline ,mspace ,msqrt ,msrow ,mstack ,mstyle ,msub ,msubsup ,msup ,mtable ,mtd ,mtext ,mtr ,munder ,munderover ,naturalnumbers ,neq ,none ,not ,notanumber ,note ,notin ,notprsubset ,notsubset ,or ,otherwise ,outerproduct ,partialdiff ,pi ,piece ,piecewise ,plus ,power ,primes ,product ,prsubset ,quotient ,rationals ,real ,reals ,reln ,rem ,root ,scalarproduct ,sdev ,sec ,sech ,selector ,semantics ,sep ,set ,setdiff ,share ,sin ,sinh ,subset ,sum ,tan ,tanh ,tendsto ,times ,transpose ,true ,union ,uplimit ,variance ,vector ,vectorproduct ,xor ,bdi ,command ,details ,dialog ,summary ,figure ,figcaption ,footer ,header ,mark ,meter ,progress ,ruby ,rt ,rp ,time ,wbr ,altGlyph ,altGlyphDef ,altGlyphItem ,animate ,animateColor ,animateMotion ,animateTransform ,circle ,clipPath ,color-profile ,cursor ,defs ,desc ,ellipse ,feBlend ,feColorMatrix ,feComponentTransfer ,feComposite ,feConvolveMatrix ,feDiffuseLighting ,feDisplacementMap ,feDistantLight ,feFlood ,feFuncA ,feFuncB ,feFuncG ,feFuncR ,feGaussianBlur ,feImage ,feMerge ,feMergeNode ,feMorphology ,feOffset ,fePointLight ,feSpecularLighting ,feSpotLight ,feTile ,feTurbulence ,filter ,font ,font-face ,font-face-format ,font-face-name ,font-face-src ,font-face-uri ,foreignObject ,g ,glyph ,glyphRef ,hkern ,image ,line ,linearGradient ,marker ,mask ,metadata ,missing-glyph ,mpath ,path ,pattern ,polygon ,polyline ,radialGradient ,rect ,script ,set ,stop ,style ,svg ,switch ,symbol ,text ,textPath ,title ,tref ,tspan ,use +new-blocklevel-tags: aside,section,article,nav diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua index ff5784bcdb3..1311516bfb6 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua +++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua @@ -133,6 +133,8 @@ function make_opf() local dir_part = item:split("/") table.remove(dir_part,#dir_part) local id=table.concat(dir_part,"-")..fname.."_"..ext + -- remove invalid characters from id start + id = id:gsub("^[%.%-]*","") return "",id end local find_all_files= function(s,r) @@ -161,13 +163,22 @@ function make_opf() local opf_complete = {} table.insert(opf_complete,h_first:read("*all")) local used_html = find_all_files(opf_complete[1]) - local lg_file = ebookutils.parse_lg(outputfilename..".lg") - local used_files = lg_file["files"] + -- local lg_file = ebookutils.parse_lg(outputfilename..".lg") + -- The lg_file has been already loaded by make4ht, it doesn't make sense to load it again + -- Furthermore, it is now possible to add new files from Lua build files + local lg_file = Make.lgfile or ebookutils.parse_lg(outputfilename..".lg") + local used_files = {} + for _,filename in ipairs(lg_file["files"]) do + -- we need to test the filenames in order to prevent duplicates + -- filenames are tested without paths, so there may be issues if + -- the same filename is used in different directories. Is that a problem? + used_files[filename] = true + end --[[for f in lfs.dir("./OEBPS") do --table.insert(used_files,f) --used_files[f] = true end--]] - local all_html = find_all_files(table.concat(used_files,"\n")) + -- local all_html = find_all_files(table.concat(used_files,"\n")) local outside_spine = {} -- This was duplicated code --[[for i, ext in pairs(all_html) do @@ -180,6 +191,7 @@ function make_opf() end--]] local all_used_files = find_all_files(opf_complete[1],"([%a%d%-%_]+%.[%a%d]+)") local used_paths = {} + local used_ids = {} for _,k in ipairs(lg_file["files"]) do local ext = k:match("%.([%a%d]*)$") local parts = k:split "/" @@ -188,11 +200,11 @@ function make_opf() table.remove(parts,#parts) --table.insert(parts,1,"OEBPS") table.insert(parts,1,outputdir) - --print("SSSSS "..fn.." ext .." .. ext) + -- print("SSSSS "..fn.." ext .." .. ext) --if string.find("jpg gif png", ext) and not all_used_files[k] then local item,id = lg_item(k) if item then - local path = table.concat(parts) + local path = table.concat(parts) if not used_paths[path] then ebookutils.mkdirectories(parts) used_paths[path]=true @@ -206,20 +218,28 @@ function make_opf() print "Tidy: Cannot load tidyconf.conf" end end - ebookutils.copy(k, outputdir .. "/"..k) - if not all_used_files[fn] then - table.insert(opf_complete,item) - if allow_in_spine[ext] then - table.insert(outside_spine,id) - end + if not used_ids[id] then + ebookutils.copy(k, outputdir .. "/"..k) + if not all_used_files[fn] then + table.insert(opf_complete,item) + if allow_in_spine[ext] then + table.insert(outside_spine,id) + end + end end + used_ids[id] = true end end for _,f in ipairs(lg_file["images"]) do local f = f.output - local p = lg_item(f) - ebookutils.copy(f, outputdir .. "/"..f) - table.insert(opf_complete,p) + local p, id = lg_item(f) + -- process the images only if they weren't registered in lg_file["files"] + -- they would be processed twice otherwise + if not used_files[f] and not used_ids[id] then + ebookutils.copy(f, outputdir .. "/"..f) + table.insert(opf_complete,p) + end + used_ids[id] = true end local end_opf = h_second:read("*all") local spine_items = {} @@ -283,6 +303,8 @@ function make_opf() end print(mimetype) local zip = find_zip() + -- we need to remove the epub file if it exists already, because it may contain files which aren't used anymore + if ebookutils.file_exists(outputfile) then os.remove(outputfile) end print("Pack mimetype " .. os.execute("cd "..basedir.." && "..zip.." -q0X "..outputfile .." ".. mimetype_name)) print("Pack metadir " .. os.execute("cd "..basedir.." && "..zip.." -qXr9D " .. outputfile.." "..metadir_name)) print("Pack outputdir " .. os.execute("cd "..basedir.." && "..zip.." -qXr9D " .. outputfile.." "..outputdir_name)) @@ -309,4 +331,4 @@ end --deldir(outputdir) --deldir(metadir) --os.remove(mimetype) - end +end diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua index e51746e7773..eb829284b59 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua +++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua @@ -10,6 +10,7 @@ function prepare(params) outputdir= basedir.."/"..outputdir_name input = params.input params.ext = ext + params.tex4ht_sty_par = params.tex4ht_sty_par .. ",html5" params.packages = params.packages .. string.format("\\Configure{ext}{%s}",ext) return eb.prepare(params) end diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook index b305c806c57..5c9f65573f7 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook @@ -52,12 +52,11 @@ else end if args.version then - print "tex4ebook version 0.1d" + print "tex4ebook v0.1e" return end if args.lua then - print("Mame lua") latex_cmd="dvilualatex" end @@ -167,7 +166,7 @@ if args["build-file"] and args["build-file"] ~= "nil" then build_file = args["build-file"] end -local config_file = ebookutils.load_config(nil, build_file) +local config_file = ebookutils.load_config(params, build_file) params["config_file"] = config_file --config_file.Make:run() diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht index e7d75821123..d7f470552cb 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht @@ -52,7 +52,7 @@ %} %\:CheckOption{mathml} %\if:Option -\apptocmd{\a:DviMath}{\opf:registerfilename{\FileName}\opf:add:property{mathml}}{}{} +\apptocmd{\a:DviMath}{\opf:add:property{mathml}}{}{}% %\fi \Configure{DOCTYPE}{\HCode{\Hnewline}} \Configure{xmlns}{}{http://www.w3.org/1999/xhtml} diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht index 8c7c51903b4..6cea65ee653 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht @@ -161,15 +161,8 @@ href="#1" media-type="\a:CoverMimeType" />}} % add main html as first file in the OPF \opf:registerfilename{\jobname.\:html} % -\:CheckOption{epub} -\if:Option -%\Configure{crosslinks+}{}{}{}{} - -% add explicit table of contents to OPF -\let\old:toc\a:tableofcontents -\def\a:tableofcontents{\old:toc\OpfRegisterFile} - +% register all sectioning commands in the OPF \def\patch:sec:register#1{% \csgappto{c:#1}{\OpfRegisterFile}% } @@ -183,6 +176,13 @@ href="#1" media-type="\a:CoverMimeType" />}} \patch:sec:register{likesubsection} \patch:sec:register{likesubsubsection} +\:CheckOption{epub} +\if:Option +%\Configure{crosslinks+}{}{}{}{} + +% add explicit table of contents to OPF +\let\old:toc\a:tableofcontents +\def\a:tableofcontents{\old:toc\OpfRegisterFile} % Support for SVG isn't ready %\Configure{Picture}{.svg} \Configure{Picture}{.png} @@ -212,6 +212,7 @@ href="#1" media-type="\a:CoverMimeType" />}} \ifdef\chapter{% %\CutAt{chapter}\CutAt{likechapter} % copied from tex4ht-html4.tex + \CutAt{part,appendix} \CutAt{chapter,likechapter,appendix,part} \CutAt{likechapter,appendix,part} \CutAt{appendix,chapter,likechapter,part} @@ -237,23 +238,47 @@ href="#1" media-type="\a:CoverMimeType" />}} \def\finishtoclevel#1{% \csgdef{nav#1finish}{\d:NavSection} } + \def\closelevels#1{ - \usetoclevels{#1} - \resettoclevels{#1} + \expandafter\usetoclevels\expandafter{#1} + \expandafter\resettoclevels\expandafter{#1} } % 1 - section type 2 - closed sections \def\navsection#1#2{ \ConfigureToc{#1}% - {\closelevels{#2}% + {\expandafter\closelevels\expandafter{#2} \a:NavSection\Ncx:Mark} {\c:NavSection} {} {\b:NavSection% - \finishtoclevel{#1}% + \expandafter\finishtoclevel\expandafter{#1}% + } +} + +% define closing groups for all levels defined in \Configure{resettoclevels} + +\def\tmp:processlevel#1{ + \bgroup + \csxdef{tmp:resettoclevels#1}{} + \def\do##1{\csxdef{tmp:resettoclevels#1}{\csname tmp:resettoclevels#1\endcsname ##1,like##1,}} + \def\tmp:parse##1#1##2\nil{ + \docsvlist{#1##2} } + \expandafter\tmp:parse\a:resettoclevels\nil + \egroup + \navsection{#1}{\csname tmp:resettoclevels#1\endcsname} + % define hierarchy also for starred sections + \navsection{like#1}{\csname tmp:resettoclevels#1\endcsname} } +% define children levels for each sectioning level +\def\confnavsections{% + \def\do##1{% + \tmp:processlevel{##1}% + } + \expandafter\docsvlist\expandafter{\a:resettoclevels} +} % As reported by Nat Kuhn on http://tex.stackexchange.com/q/209312/2891 % zeroes were printed as section numbers when secnumdepth counter was set to negative value % so just strip then out @@ -282,6 +307,10 @@ href="#1" media-type="\a:CoverMimeType" />}} % Get filename from tableofcontents anchor \def\ncx:hfile#1{\Ref{)F\Ref{)Q#1}F-}} +% define toc levels which should be included in the NCX file +\NewConfigure{resettoclevels}{1} +\Configure{resettoclevels}{part,chapter,section,subsection,subsubsection,paragraph} + \def\:tempa{% \EndP \HtmlParOff @@ -297,30 +326,22 @@ href="#1" media-type="\a:CoverMimeType" />}} % so: \let\contentsname=\empty \Configure{tableofcontents}{\boolfalse{tocnoempty}\Tg}{% - \usetoclevels{part,chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection}% + \usetoclevels{part,chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection,subsubsubsection,paragraph}% \ifbool{tocnoempty}{}% {\HCode{ Document }}% \Tg}{}{}{} -% We need to configure TocLink -% in navmapsrc is link to the file and anchor, where chapter or section is located -\def\navmapsrc{} -\Configure{TocLink}{\def\navmapsrc{\ncx:hfile{##2}\:sharp ##2}\opf:registerfilename{\ncx:hfile{##2}}##4} -% Configuraion of entries -\resettoclevels{part,chapter,section,subsection,subsubsection} -\navsection{part}{part,chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection} -\navsection{chapter}{chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection} -\navsection{likechapter}{chapter,likechapter,section,likesection,subsection,likesubsection,subsubsection,likesubsubsection} -\navsection{section}{section,likesection,subsection,likesubsection,subsubsection,likesubsubsection} -\navsection{likesection}{section,likesection,subsection,likesubsection,subsubsection,likesubsubsection} -\navsection{subsection}{subsection,likesubsection,subsubsection,likesubsubsection} -\navsection{likesubsection}{subsection,likesubsection,subsubsection,likesubsubsection} -\navsection{subsubsection}{subsubsection,likesubsubsection} -\navsection{likesubsubsection}{subsubsection,likesubsubsection} - \HtmlParOff - \Configure{toTocLink}{}{} + % We need to configure TocLink + % in navmapsrc is link to the file and anchor, where chapter or section is located + \def\navmapsrc{} + \Configure{TocLink}{\def\navmapsrc{\ncx:hfile{##2}\:sharp ##2}\opf:registerfilename{\ncx:hfile{##2}}##4} + % Configuraion of entries + \expandafter\resettoclevels\expandafter{\a:resettoclevels}% + \confnavsections% + \HtmlParOff% + \Configure{toTocLink}{}{}% \Configure{NavSection}{\booltrue{tocnoempty}\HCode{\Hnewline\Hnewline\Hnewline}% @@ -359,7 +380,7 @@ href="#1" media-type="\a:CoverMimeType" />}} {\HCode{}\GetLanguage\HCode{\Hnewline}} %Add interface for such things {\HCode{\a:UniqueIdentifier}\HCode{\Hnewline}} -\def\and{<\HCode{/dc:creator>\Hnewline}} +\def\and{\HCode{\Hnewline}} {\HCode{}\Author\HCode{\Hnewline}} %{\HCode{\HP:file\Hnewline}} {\HCode{}\:iso:date\HCode{}} -- cgit v1.2.3