texlive[70103] branches/branch2023.final: tex4ebook (branch)
commits+karl at tug.org
commits+karl at tug.org
Fri Feb 23 23:08:39 CET 2024
Revision: 70103
https://tug.org/svn/texlive?view=revision&revision=70103
Author: karl
Date: 2024-02-23 23:08:39 +0100 (Fri, 23 Feb 2024)
Log Message:
-----------
tex4ebook (branch) (23feb24)
Modified Paths:
--------------
branches/branch2023.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook
branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/README
branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/readme.tex
branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook
branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht
branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
Modified: branches/branch2023.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook
===================================================================
--- branches/branch2023.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook 2024-02-23 22:08:39 UTC (rev 70103)
@@ -37,6 +37,7 @@
possible values: debug, info, status, warning, error, fatal
-c,--config (default xhtml) Custom config file
-d,--output-dir (default nil) Output directory
+ -B,--build-dir (default nil) Build directory
-e,--build-file (default nil) If build file is different than `filename`.mk4
-f,--format (default epub) Output format. Supported values: epub, epub3, mobi
-h,--help Display help message
@@ -67,7 +68,7 @@
end
if args.version then
- print "tex4ebook v0.3j"
+ print "tex4ebook v0.4"
return
end
@@ -125,7 +126,12 @@
log:status("Conversion started")
log:status("Input file: ".. params.tex_file)
+if params.builddir ~= "" then
+ mkutils.make_path(params.builddir)
+end
+
+
local output_format = params.output_format
-- use epub as default output_format
output_format = output_format or "epub"
Modified: branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/README
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/README 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/README 2024-02-23 22:08:39 UTC (rev 70103)
@@ -46,7 +46,7 @@
## Available commands
-- `\coverimage[<graphicx options>]{coverimage.name}` - include cover image to
+- `\coverimage[<graphicx options>]{coverimage.name}` -- include cover image to
the document. You can pass the same options as to `\includegraphics` command
in the optional argument.
@@ -58,6 +58,8 @@
...
\pagestyle{headings}
+- `\epubpage` -- add page break to the document.
+
# Command line options
`-a,--loglevel`
Modified: branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/changelog.tex 2024-02-23 22:08:39 UTC (rev 70103)
@@ -3,6 +3,63 @@
\begin{itemize}
\item
+ 2024/02/23
+
+ \begin{itemize}
+ \tightlist
+ \item
+ version \texttt{0.4} released.
+ \end{itemize}
+\item
+ 2023/10/30
+
+ \begin{itemize}
+ \tightlist
+ \item
+ added the \texttt{\textbackslash{}epubpage} command
+ \end{itemize}
+\item
+ 2023/10/17
+
+ \begin{itemize}
+ \tightlist
+ \item
+ added the \texttt{-\/-build-dir} command line option.
+ \end{itemize}
+\item
+ 2023/10/15
+
+ \begin{itemize}
+ \tightlist
+ \item
+ don't set PNG as image format explicitly.
+ \end{itemize}
+\item
+ 2023/06/02
+
+ \begin{itemize}
+ \tightlist
+ \item
+ prevent fatal errors in the \texttt{zip} command executable
+ detection.
+ \end{itemize}
+\item
+ 2023/05/29
+
+ \begin{itemize}
+ \tightlist
+ \item
+ save author and date globally.
+ \end{itemize}
+\item
+ 2023/05/23
+
+ \begin{itemize}
+ \tightlist
+ \item
+ removed spurious numbers from TOC in Epub 3.
+ \end{itemize}
+\item
2023/03/17
\begin{itemize}
Modified: branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/readme.tex
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/readme.tex 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/readme.tex 2024-02-23 22:08:39 UTC (rev 70103)
@@ -54,7 +54,7 @@
\tightlist
\item
\texttt{\textbackslash{}coverimage{[}\textless{}graphicx\ options\textgreater{}{]}\{coverimage.name\}}
- - include cover image to the document. You can pass the same options
+ -- include cover image to the document. You can pass the same options
as to \texttt{\textbackslash{}includegraphics} command in the optional
argument.
\end{itemize}
@@ -69,6 +69,12 @@
\pagestyle{headings}
\end{verbatim}
+\begin{itemize}
+\tightlist
+\item
+ \texttt{\textbackslash{}epubpage} -- add page break to the document.
+\end{itemize}
+
\hypertarget{command-line-options}{%
\section{Command line options}\label{command-line-options}}
Modified: branches/branch2023.final/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
===================================================================
(Binary files differ)
Modified: branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook 2024-02-23 22:08:39 UTC (rev 70103)
@@ -37,6 +37,7 @@
possible values: debug, info, status, warning, error, fatal
-c,--config (default xhtml) Custom config file
-d,--output-dir (default nil) Output directory
+ -B,--build-dir (default nil) Build directory
-e,--build-file (default nil) If build file is different than `filename`.mk4
-f,--format (default epub) Output format. Supported values: epub, epub3, mobi
-h,--help Display help message
@@ -67,7 +68,7 @@
end
if args.version then
- print "tex4ebook v0.3j"
+ print "tex4ebook v0.4"
return
end
@@ -125,7 +126,12 @@
log:status("Conversion started")
log:status("Input file: ".. params.tex_file)
+if params.builddir ~= "" then
+ mkutils.make_path(params.builddir)
+end
+
+
local output_format = params.output_format
-- use epub as default output_format
output_format = output_format or "epub"
Modified: branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua 2024-02-23 22:08:39 UTC (rev 70103)
@@ -52,7 +52,7 @@
end
lfs.chdir(current)
end
- basedir = params.input.."-".. params.format
+ basedir = ebookutils.file_in_builddir(params.input.."-".. params.format, params)
outputdir= basedir.."/"..outputdir_name
deletedir(basedir)
makedir(outputdir)
@@ -150,12 +150,20 @@
return content:gsub("<guide>%s*</guide>","")
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 .. "/", "")
+end
+
function make_opf()
-- Join files content.opf and content-part2.opf
-- make item record for every converted image
local lg_item = function(item)
+ local item = remove_builddir(item)
-- Find mimetype and make item tag for each converted file in the lg file
local fname,ext = item:match("([^%/^%.]*)%.([%a%d]*)$")
if not ext then return nil end
@@ -192,8 +200,8 @@
tidyconf = kpse.find_file("tex4ebook-tidyconf.conf")
end
--local opf_first_part = outputdir .. "/content.opf"
- local opf_first_part = "content.opf"
- local opf_second_part = "content-part2.opf"
+ local opf_first_part = ebookutils.file_in_builddir("content.opf", Make.params)
+ local opf_second_part = ebookutils.file_in_builddir("content-part2.opf", Make.params)
--local opf_second_part = outputdir .. "/content-part2.opf"
if
ebookutils.file_exists(opf_first_part) and ebookutils.file_exists(opf_second_part)
@@ -242,8 +250,8 @@
end
end
if not used_ids[id] then
- ebookutils.copy(k, outputdir .. "/"..k)
- if not all_used_files[k] then
+ ebookutils.copy(k, outputdir .. "/".. remove_builddir(k))
+ if not all_used_files[remove_builddir(k)] then
table.insert(opf_complete,item)
if allow_in_spine[ext] then
table.insert(outside_spine,id)
@@ -259,7 +267,7 @@
-- 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)
+ ebookutils.copy(f, outputdir .. "/".. remove_builddir(f))
table.insert(opf_complete,p)
end
used_ids[id] = true
@@ -282,7 +290,7 @@
h_first:close()
os.remove(opf_second_part)
--ebookutils.copy(outputfilename ..".css",outputdir.."/")
- ebookutils.copy(opf_first_part,outputdir.."/"..opf_first_part)
+ ebookutils.copy(opf_first_part,outputdir.."/".. remove_builddir(opf_first_part))
--for c,v in pairs(lg_file["fonts"]) do
-- print(c, table.concat(v,", "))
--end
@@ -292,7 +300,9 @@
end
end
local function find_zip()
- if assert(io.popen("zip -v","r"):close()) then
+ local zip_handle = assert(io.popen("zip -v","r"))
+ if zip_handle then
+ zip_handle:close()
return "zip"
elseif assert(io.popen("miktex-zip -v","r"):close()) then
return "miktex-zip"
@@ -322,8 +332,7 @@
log:info("Tidy ncx "..
os.execute("tidy -xml -i -q -utf8 -m " .. ncxfilename))
log:info("Tidy opf "..
- os.execute("tidy -xml -i -q -utf8 -m " ..
- outputdir .. "/" .. "content.opf"))
+ os.execute("tidy -xml -i -q -utf8 -m " .. ebookutils.file_in_builddir("content.opf", Make.params)))
end
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
Modified: branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht 2024-02-23 22:08:39 UTC (rev 70103)
@@ -25,7 +25,7 @@
}{\b:NavMap}{}{}{}
%%%%%%%%%%%
\newcount\:toccount
-\Configure{NavMap}{\ifvmode\IgnorePar\fi\EndP\boolfalse{tocnoempty}\global\advance\:toccount by1\HCode{<nav id="toc\the\:toccount" \ifnum\:toccount<2 epub:type="toc"\fi>\Hnewline<ol>}%
+\Configure{NavMap}{\ifvmode\IgnorePar\fi\EndP\boolfalse{tocnoempty}\global\advance\:toccount by1\HCode{<nav id="toc\the\:toccount" class="toc" \ifnum\:toccount<2 epub:type="toc"\fi>\Hnewline<ol>}%
\opf:registerfilename{\FileName}
\ifnum\:toccount<2 \opf:add:property{nav}\fi
}{\usetoclevels{part,appendix,chapter,section,subsection,subsubsection}%
@@ -36,7 +36,7 @@
\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;}}
+\Css{nav.toc ol{list-style: none;}}
%%%% End toc nav configuration
\def\CoverMetadata#1{%
\special{t4ht+ at File: #1}%
Modified: branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht 2024-02-23 22:08:39 UTC (rev 70103)
@@ -146,6 +146,13 @@
\b:CoverImage%
}
+\renewcommand\epubpage{\a:epubpage}
+\NewConfigure{epubpage}{1}
+\Configure{epubpage}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="newpage"></div>}}
+\Css{.newpage{page-break-before:always;}}
+
+
+
\NewConfigure{CoverMimeType}{1}
\Configure{CoverMimeType}{image/png}
@@ -190,13 +197,9 @@
% 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}
\Configure{()}{$}{$}
\fi
\:CheckOption{kindle} \if:Option
-\Configure{Picture}{.png}
\fi
%%
Modified: branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty 2024-02-23 22:08:27 UTC (rev 70102)
+++ branches/branch2023.final/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty 2024-02-23 22:08:39 UTC (rev 70103)
@@ -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}[2016/03/31 version 0.1d]
+\ProvidesPackage{tex4ebook}[2024-02-23 version v0.4]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
@@ -144,12 +144,12 @@
\let\tf at orig@author\author
\newcommand\tf at author[1]{%
\tf at orig@author{#1}%
- \def\Author{#1}%
+ \gdef\Author{#1}%
}
\newcommand\tf at optauthor[2][]{%
\tf at orig@author[#1]{#2}%
- \def\Author{#2}%
+ \gdef\Author{#2}%
}
% support optiona argument for \author as well
@@ -162,7 +162,7 @@
\let\origdate\date
\renewcommand\date[1]{%
\origdate{#1}%
- \let\Date\@date%
+ \global\let\Date\@date%
}
%}
@@ -177,3 +177,7 @@
}
\newcommand\coverimage[2][]{\includegraphics[#1]{#2}}
+
+\newcommand\epubpage{\clearpage}
+
+\endinput
More information about the tex-live-commits
mailing list.