diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/changelog.tex | 37 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf | bin | 85304 -> 85759 bytes | |||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook | 2 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua | 58 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht | 2 |
6 files changed, 81 insertions, 29 deletions
diff --git a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex index 607249691eb..7eaa4c85ec6 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex @@ -3,6 +3,43 @@ \begin{itemize} \item + 2022/02/18 + + \begin{itemize} + \tightlist + \item + released version \texttt{0.3h}. + \end{itemize} +\item + 2022/01/13 + + \begin{itemize} + \tightlist + \item + fixed issue where child TOC elements were inserted into + \texttt{\textless{}a\textgreater{}} element. + \end{itemize} +\item + 2021/12/07 + + \begin{itemize} + \tightlist + \item + print space after section number in Epub 3 TOC. + \item + keep original elements in Epub 3 TOC. + \end{itemize} +\item + 2021/12/04 + + \begin{itemize} + \tightlist + \item + fixed support for + \href{https://github.com/michal-h21/tex4ebook/issues/85}{appendix + chapters in Epub 3}. + \end{itemize} +\item 2021/11/08 \begin{itemize} diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf Binary files differindex 0e061061602..7e8386af7a7 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf +++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook index b170da2ceeb..8f6c8aa3f73 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook @@ -67,7 +67,7 @@ else end if args.version then - print "tex4ebook v0.3g" + print "tex4ebook v0.3h" return end diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua index fc200bd8661..328acaae375 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua @@ -113,6 +113,12 @@ local function add_media_overlays(content) end +-- elements that shouldn't be put inside <a> in TOC +local stop_toc_processing_elements = { + ol = true, + ul = true +} + local function remove_spurious_TOC_elements(tocdom) local function count_child_elements(el) -- count children elements of the current element @@ -127,36 +133,44 @@ local function remove_spurious_TOC_elements(tocdom) for _, el in ipairs(tocdom:query_selector("ol")) do if count_child_elements(el) == 0 then el:remove_node() - -- local newli = el:create_element("li") - -- local newspan = newli:create_element("span") - -- newli:add_child_node(newspan) - -- el:add_child_node(newli) end end -- place child elements of the <li> elements to an <a> element, epubcheck reports -- error for text nodes that are direct child of <li> for _, el in ipairs(tocdom:query_selector("li")) do - local text = {} - local link -- save the <a> element + + local newa = el:create_element("a") + local newchildren = {newa} + -- we want to stop putting content as child of <a> when it + -- finds child TOC entries + local keep_processing = true for i, child in ipairs(el._children) do - if child:is_text() then - -- trim spurious spaces - local childtext = child._text:gsub("^%s*",""):gsub("%s*$","") - -- save the text for the later use - table.insert(text, childtext) - child:remove_node() - elseif child:is_element() and child:get_element_name() == "a" then - link = child - table.insert(text, child:get_text()) + child_name = child:get_element_name() + -- put contents of <li> to a new <a> element + if child:is_element() and child_name == "a" then + -- set id and href of the new <a> element, if it isn't set already + if not newa:get_attribute("href") then + local id = child:get_attribute("id") + local href = child:get_attribute("href") + newa:set_attribute("id", id) + newa:set_attribute("href", href) + end + -- copy <a> contents to the new <a> element + for _, x in ipairs(child._children or {}) do newa:add_child_node(x:copy_node()) end + + elseif stop_toc_processing_elements[child_name] then + -- don't put child toc entries to the new <a> + keep_processing = false + newchildren[#newchildren+1] = child + elseif keep_processing == true then + -- put every node before <ol> or <ul> into the new <a> + newa:add_child_node(child:copy_node()) + else + newchildren[#newchildren+1] = child end end - if link then - local content = table.concat(text, " ") - -- remove the original text - link._children = {} - local text = link:create_text_node(content) - link:add_child_node(text) - end + -- set contents of <li> to be the new <a> + el._children = newchildren end return tocdom diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht index b30e1c3ef15..9d49b624e67 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook-epub3.4ht @@ -13,9 +13,10 @@ %%%%%%%%%%%%%%%%%%%%%%% \Configure{tableofcontents}{ \a:NavMap - \resettoclevels{part,chapter,section,subsection,subsubsection} - \navsection{part}{part,chapter,section,subsection,subsubsection} - \navsection{chapter}{chapter,section,subsection,subsubsection} + \resettoclevels{part,appendix,chapter,section,subsection,subsubsection} + \navsection{part}{part,appendix,chapter,section,subsection,subsubsection} + \navsection{appendix}{appendix,chapter,section,subsection,subsubsection} + \navsection{chapter}{appendix,chapter,section,subsection,subsubsection} \navsection{section}{section,subsection,subsubsection} \navsection{subsection}{subsection,subsubsection} \navsection{subsubsection}{subsubsection} @@ -26,13 +27,13 @@ \Configure{NavMap}{\ifvmode\IgnorePar\fi\EndP\boolfalse{tocnoempty}\HCode{<nav id="toc" epub:type="toc">\Hnewline<ol>}% \opf:registerfilename{\FileName} \opf:add:property{nav} -}{\usetoclevels{part,chapter,section,subsection,subsubsection}% +}{\usetoclevels{part,appendix,chapter,section,subsection,subsubsection}% \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>} + \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 diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht index c078eee57e2..8686c2932f5 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht @@ -342,7 +342,7 @@ href="#1" media-type="\a:CoverMimeType" />}} % define toc levels which should be included in the NCX file \NewConfigure{resettoclevels}{1} -\Configure{resettoclevels}{part,chapter,section,subsection,subsubsection,paragraph} +\Configure{resettoclevels}{part,appendix,chapter,section,subsection,subsubsection,paragraph} \def\:tempa{% \EndP% |