texlive[74151] branches/branch2024.final: tex4ebook (branch)
commits+karl at tug.org
commits+karl at tug.org
Wed Feb 19 21:44:26 CET 2025
Revision: 74151
https://tug.org/svn/texlive?view=revision&revision=74151
Author: karl
Date: 2025-02-19 21:44:26 +0100 (Wed, 19 Feb 2025)
Log Message:
-----------
tex4ebook (branch) (19feb25)
Modified Paths:
--------------
branches/branch2024.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook
branches/branch2024.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
branches/branch2024.final/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook
branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht
branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
Modified: branches/branch2024.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook
===================================================================
--- branches/branch2024.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook 2025-02-19 20:44:15 UTC (rev 74150)
+++ branches/branch2024.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook 2025-02-19 20:44:26 UTC (rev 74151)
@@ -68,7 +68,7 @@
end
if args.version then
- print "tex4ebook v0.4"
+ print "tex4ebook 0.4a"
return
end
Modified: branches/branch2024.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
===================================================================
--- branches/branch2024.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex 2025-02-19 20:44:15 UTC (rev 74150)
+++ branches/branch2024.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex 2025-02-19 20:44:26 UTC (rev 74151)
@@ -1,8 +1,48 @@
-\hypertarget{changes}{%
-\section{Changes}\label{changes}}
+\section{Changes}\label{changes}
\begin{itemize}
\item
+ 2025/02/19
+
+ \begin{itemize}
+ \tightlist
+ \item
+ version \texttt{0.4a} released.
+ \end{itemize}
+\item
+ 2025/01/10
+
+ \begin{itemize}
+ \tightlist
+ \item
+ fixed adding of files for sections to the OPF file.
+ \end{itemize}
+\item
+ 2024/12/03
+
+ \begin{itemize}
+ \tightlist
+ \item
+ fixed Epub 3 footnotes. https://tex.stackexchange.com/a/732071/2891
+ \end{itemize}
+\item
+ 2024/06/16
+
+ \begin{itemize}
+ \tightlist
+ \item
+ fixed support for \texttt{-\/-build-dir} that contains dashes.
+ Thanks to Danie-1. https://github.com/michal-h21/tex4ebook/pull/132
+ \end{itemize}
+\item
+ 2024/04/21
+
+ \begin{itemize}
+ \tightlist
+ \item
+ better detection of \texttt{zip} and \texttt{miktex-zip} commands.
+ \end{itemize}
+\item
2024/02/23
\begin{itemize}
Modified: branches/branch2024.final/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
===================================================================
(Binary files differ)
Modified: branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook
===================================================================
--- branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook 2025-02-19 20:44:15 UTC (rev 74150)
+++ branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook 2025-02-19 20:44:26 UTC (rev 74151)
@@ -68,7 +68,7 @@
end
if args.version then
- print "tex4ebook v0.4"
+ print "tex4ebook 0.4a"
return
end
Modified: branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
===================================================================
--- branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua 2025-02-19 20:44:15 UTC (rev 74150)
+++ branches/branch2024.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua 2025-02-19 20:44:26 UTC (rev 74151)
@@ -150,11 +150,18 @@
return content:gsub("<guide>%s*</guide>","")
end
+local function startswith(str, prefix)
+ return str:sub(1, prefix:len()) == prefix
+end
+
local function remove_builddir(filename)
-- make4ht adds the build dir to all output files,
-- but we don't want them there, because it is appended to the outdir
local builddir = Make.params.builddir
- return filename:gsub("^" .. builddir .. "/", "")
+ if startswith(filename, builddir .. "/") then
+ return filename:sub((builddir .. "/"):len() + 1)
+ end
+ return filename
end
@@ -300,11 +307,15 @@
end
end
local function find_zip()
- local zip_handle = assert(io.popen("zip -v","r"))
- if zip_handle then
- zip_handle:close()
+ local zip_handle = assert(io.popen("zip -v 2>&1","r"))
+ local miktex_zip = assert(io.popen("miktex-zip -v 2>&1","r"))
+ local zip_result = zip_handle:read("*all")
+ local miktex_result = miktex_zip:read("*all")
+ zip_handle:close()
+ miktex_zip:close()
+ if zip_result and zip_result:match("Zip") then
return "zip"
- elseif assert(io.popen("miktex-zip -v","r"):close()) then
+ elseif miktex_result and miktex_result:match("Zip") then
return "miktex-zip"
end
log:warning "It appears you don't have zip command installed. I can't pack the ebook"
Modified: branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht
===================================================================
--- branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht 2025-02-19 20:44:15 UTC (rev 74150)
+++ branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht 2025-02-19 20:44:26 UTC (rev 74151)
@@ -29,12 +29,12 @@
\opf:registerfilename{\FileName}
\ifnum\:toccount<2 \opf:add:property{nav}\fi
}{\usetoclevels{part,appendix,chapter,section,subsection,subsubsection}%
- \ifbool{tocnoempty}{}{\HCode{<li><a href="\jobname.\:html">Document</a></li>}}
- \HCode{</ol></nav>}}
+ \ifbool{tocnoempty}{}{\HCode{<li><a href="\jobname.\:html">Document</a></li>}}
+ \HCode{</ol></nav>}}
%%%%%%%%%%%
\Configure{NavSection}{%
- \booltrue{tocnoempty}
- \HCode{<li>}}{\HCode{<ol>\Hnewline}}{\ }{\Tg</ol>\Tg</li>}
+ \booltrue{tocnoempty}
+ \HCode{<li>}}{\HCode{<ol>\Hnewline}}{\ }{\Tg</ol>\Tg</li>}
% Disable numbering of the TOC by the reading system, numbers are added by tex4ht
\Css{nav.toc ol{list-style: none;}}
%%%% End toc nav configuration
@@ -68,7 +68,7 @@
\Configure{@HEAD}{}
\Configure{@HEAD}{\HCode{<meta charset="UTF-8" />\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="generator" content="TeX4ht
- (http://www.cse.ohio-state.edu/\string~gurari/TeX4ht/)" />\Hnewline}}
+ (http://www.cse.ohio-state.edu/\string~gurari/TeX4ht/)" />\Hnewline}}
\Configure{@HEAD}{\HCode{<link
rel="stylesheet" type="text/css"
href="\expandafter\csname aa:CssFile\endcsname" />\Hnewline}}
@@ -85,37 +85,38 @@
% footnotebox - configure box in which footnotes are printed
% default configuration doesn't work in ibooks, don't know why
\NewConfigure{footnotebox}{2}
-\Configure{footnotebox}{\HCode{<section epub:type="footnotes" class="footnotes">\Hnewline}}
-{\HCode{\Hnewline</section>\Hnewline}}
-\newbox\footnotebox
+\Configure{footnotebox}{\ifvmode\IgnorePar\fi\HCode{<section epub:type="footnotes" class="footnotes">\Hnewline}}%
+{\ifvmode\IgnorePar\fi\HCode{\Hnewline</section>\Hnewline}}%
+\newbox\footnotebox%
% We must create new link command, so footnote mark can link to footnote text
\LinkCommand\fnlink{aside,href,id,class="footnote" epub:type="footnote"}
-\Configure{footnotemark}{\NoFonts\Link[ epub:type="noteref"]{fn\FNnum x\minipageNum}{}}{\EndLink\EndNoFonts}
-\Configure{footnotetext}{\global\setbox\footnotebox=\vtop\bgroup\NoFonts%
- \ifvoid\footnotebox\else\unvbox\footnotebox\fi%
- \IgnorePar%
- \bgroup%
- \fnlink{}{fn\FNnum x\minipageNum}\Tg<p>\AnchorLabel%
+\Configure{footnotemark}{\NoFonts\Link[ epub:type="noteref"]{fn\FNnum x\minipageNum}{}}{\EndLink\EndNoFonts}%
+\Configure{footnotetext}{\SaveEndP\global\setbox\footnotebox=\vtop\bgroup\NoFonts%
+ \ifvoid\footnotebox\else\unvbox\footnotebox\fi%
+ \bgroup%
+ \IgnorePar%
+ \fnlink{}{fn\FNnum x\minipageNum}\par\AnchorLabel%
}{\EndNoFonts}
{%
- \HCode{</p>\Hnewline}
- \Endfnlink\egroup\egroup}%
+ \ifvmode\IgnorePar\fi\EndP\HCode{\Hnewline}%
+ \Endfnlink\egroup\egroup\RecallEndP}%
\def\printfn{%
- \ifvoid\footnotebox\else%
- \a:footnotebox%
- \box\footnotebox%
- \b:footnotebox%
- \fi%
+ \ifvoid\footnotebox\else%
+ \a:footnotebox%
+ \box\footnotebox%
+ \b:footnotebox%
+ \fi%
}
% configure HtmlPar to print footnotebox.
\Configure{HtmlPar}
-{\EndP\HCode{<p class="noindent">}}
-{\EndP\HCode{<p class="indent">}}
-{\HCode{</p>\Hnewline}\printfn}
-{\HCode{</p>\Hnewline}\printfn}
+{\EndP\printfn\HCode{<p class="noindent">}}
+{\EndP\printfn\HCode{<p class="indent">}}
+{\HCode{</p>\Hnewline}}
+{\HCode{</p>\Hnewline}}
\Css{.footnote{font-size:small;}}
\Css{.footnotes hr{width:30\%;margin:0 auto 0 0;}}
+\Css{p + section.footnotes{margin-bottom: 1rem;}}
\fi
Modified: branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
===================================================================
--- branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht 2025-02-19 20:44:15 UTC (rev 74150)
+++ branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht 2025-02-19 20:44:26 UTC (rev 74151)
@@ -172,24 +172,28 @@
% add main html as first file in the OPF
\opf:registerfilename{\jobname.\:html} %
-% register all sectioning commands in the OPF
+% the following code should register files for all sectioning commands.
+% unfortunately, it doesn't work correctly. A better solution is below.
\def\patch:sec:register#1{%
\csgappto{c:#1}{\OpfRegisterFile}%
}
-\patch:sec:register{part}
-\patch:sec:register{chapter}
-\patch:sec:register{section}
-\patch:sec:register{subsection}
-\patch:sec:register{subsubsection}
-\patch:sec:register{likechapter}
-\patch:sec:register{likesection}
-\patch:sec:register{likesubsection}
-\patch:sec:register{likesubsubsection}
-\patch:sec:register{appendix}
-\patch:sec:register{appendixsec}
-\patch:sec:register{appendixsubsec}
-\patch:sec:register{appendixsubsubsec}
+% \patch:sec:register{part}
+% \patch:sec:register{chapter}
+% \patch:sec:register{section}
+% \patch:sec:register{subsection}
+% \patch:sec:register{subsubsection}
+% \patch:sec:register{likechapter}
+% \patch:sec:register{likesection}
+% \patch:sec:register{likesubsection}
+% \patch:sec:register{likesubsubsection}
+% \patch:sec:register{appendix}
+% \patch:sec:register{appendixsec}
+% \patch:sec:register{appendixsubsec}
+% \patch:sec:register{appendixsubsubsec}
+% \Ttle is internal TeX4ht command used in sectioning commands
+\append:defIII\:Ttle{\OpfRegisterFile}
+
\:CheckOption{epub}
\if:Option
%\Configure{crosslinks+}{}{}{}{}
Modified: branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
===================================================================
--- branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty 2025-02-19 20:44:15 UTC (rev 74150)
+++ branches/branch2024.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty 2025-02-19 20:44:26 UTC (rev 74151)
@@ -1,6 +1,6 @@
% Package tex4ebook. Author Michal Hoftich <michal.h21 at gmail.com>
% This package is subject of LPPL license, version 1.3
-\ProvidesPackage{tex4ebook}[2024-02-23 version v0.4]
+\ProvidesPackage{tex4ebook}[2025-02-19 version 0.4a]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
More information about the tex-live-commits
mailing list.