summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-28 21:21:37 +0000
committerKarl Berry <karl@freefriends.org>2017-04-28 21:21:37 +0000
commit37dfda47fe844c888a24fb8cc380d34139dca9f4 (patch)
treea1a1d9dc047773102a07f939e2ada149f00fb179 /Master/texmf-dist
parenteda997681c2c45b147792fe2f546e45150447197 (diff)
tex4ebook (28apr17)
git-svn-id: svn://tug.org/texlive/trunk@44103 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/README59
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/changelog.tex98
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/readme.tex26
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdfbin67170 -> 69209 bytes
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex3
-rw-r--r--Master/texmf-dist/doc/support/tex4ebook/tidyconf.conf4
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_epub.lua52
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_epub3.lua1
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/tex4ebook5
-rw-r--r--Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht2
-rw-r--r--Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht83
11 files changed, 246 insertions, 87 deletions
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 `<guide>` section in the `OPF` file. See *Where do you start an ePUB and what is the `<guide>` 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 `<guide>` 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
@@ -2,6 +2,104 @@
\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
\begin{itemize}
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}
@@ -165,6 +165,14 @@ 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
--- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
+++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
Binary files 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 "<item id='"..id .. "' href='"..item.."' media-type='"..mimetype.."' />",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{<!DOCTYPE html>\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<navMap>}{%
- \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{<navPoint id="mainentry" playOrder="1">
<navLabel><text>Document</text></navLabel>
<content src="\jobname.\:html" />
</navPoint>}}%
\Tg</navMap>}{}{}{}
-% 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<navPoint id="navPoint-}%
\stepnavpoint\HCode{" playOrder="}%
\the\navpoint\HCode{">\Hnewline<navLabel>\Hnewline<text>}%
@@ -359,7 +380,7 @@ href="#1" media-type="\a:CoverMimeType" />}}
{\HCode{<dc:language>}\GetLanguage\HCode{</dc:language>\Hnewline}}
%Add interface for such things
{\HCode{<dc:identifier id="dcidid" \print:opf:scheme\a:OpfScheme>\a:UniqueIdentifier}\HCode{</dc:identifier>\Hnewline}}
-\def\and{<\HCode{/dc:creator>\Hnewline<dc:creator>}}
+\def\and{\HCode{</dc:creator>\Hnewline<dc:creator>}}
{\HCode{<dc:creator>}\Author\HCode{</dc:creator>\Hnewline}}
%{\HCode{<dc:contributor>\HP:file</dc:contributor>\Hnewline}}
{\HCode{<dc:date>}\:iso:date\HCode{</dc:date>}}