texlive[50512] trunk: tex4ebook (21mar19)

commits+karl at tug.org commits+karl at tug.org
Thu Mar 21 21:57:25 CET 2019


Revision: 50512
          http://tug.org/svn/texlive?view=revision&revision=50512
Author:   karl
Date:     2019-03-21 21:57:24 +0100 (Thu, 21 Mar 2019)
Log Message:
-----------
tex4ebook (21mar19)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook
    trunk/Master/texmf-dist/doc/support/tex4ebook/README
    trunk/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
    trunk/Master/texmf-dist/doc/support/tex4ebook/readme.tex
    trunk/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
    trunk/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex
    trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
    trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
    trunk/Master/texmf-dist/scripts/tex4ebook/tex4ebook
    trunk/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht

Modified: trunk/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook	2019-03-21 20:57:24 UTC (rev 50512)
@@ -66,7 +66,7 @@
 end
 
 if args.version then
-  print "tex4ebook v0.2b"
+  print "tex4ebook v0.2c"
   return 
 end
 

Modified: trunk/Master/texmf-dist/doc/support/tex4ebook/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/tex4ebook/README	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/doc/support/tex4ebook/README	2019-03-21 20:57:24 UTC (rev 50512)
@@ -152,19 +152,25 @@
 Every epub file should have unique identifier, like ISBN, DOI, URI etc. 
 Default identifier is URI, with value `http://example.com/\jobname`.
 
+    \Configure{@author}{\let\footnote\@gobble}
+
+Local definitions of commands used in the `\author` command. As contents of
+`\author` are used in XML files, it is necessary to strip away any information
+which don't belongs here, such as `\footnote`.
+
     \Configure{OpfScheme}{URI}
 
 Type of unique identifier, default type is URI. It is
-used only in epub, it is deprecated for `epub3`
+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`.
+value is the whole document hierarchy, from `\part` to `\paragraph`.
 
     \Configure{DocumentLanguage}{language code}
 
-Each epub must declare the document language. It is inferred from `babel` main
+Each ePub file must declare the document language. It is inferred from `babel` main
 language by default, but you can configure it when it doesn't work correctly.
 The `language code` should be in [ISO
 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) form.

Modified: trunk/Master/texmf-dist/doc/support/tex4ebook/changelog.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/tex4ebook/changelog.tex	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/doc/support/tex4ebook/changelog.tex	2019-03-21 20:57:24 UTC (rev 50512)
@@ -3,6 +3,40 @@
 
 \begin{itemize}
 \item
+  2019/03/21
+
+  \begin{itemize}
+  \tightlist
+  \item
+    released version \texttt{0.2c}
+  \end{itemize}
+\item
+  2019/03/07
+
+  \begin{itemize}
+  \tightlist
+  \item
+    use \texttt{Luatexbase} package in the documentation because of
+    \texttt{Microtype} error
+  \item
+    remove \texttt{\textless{}guide\textgreater{}} element even in ePub
+    2
+  \item
+    added \texttt{encoding} attribute to XML declaration in the NCX and
+    OPF files
+  \item
+    clean the temporary directory (\texttt{filename-format}) before file
+    packing
+  \end{itemize}
+\item
+  2019/01/21
+
+  \begin{itemize}
+  \tightlist
+  \item
+    added \texttt{\textbackslash{}Configure\{@author\}}
+  \end{itemize}
+\item
   2019/01/10
 
   \begin{itemize}
@@ -25,7 +59,7 @@
   \tightlist
   \item
     use the \texttt{uni-html4} option by default. It will convert some
-    math characters as Unicode chars.
+    math characters as Unicode chars
   \end{itemize}
 \item
   13/11/2018

Modified: trunk/Master/texmf-dist/doc/support/tex4ebook/readme.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/tex4ebook/readme.tex	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/doc/support/tex4ebook/readme.tex	2019-03-21 20:57:24 UTC (rev 50512)
@@ -166,11 +166,21 @@
 \texttt{http://example.com/\textbackslash{}jobname}.
 
 \begin{verbatim}
+\Configure{@author}{\let\footnote\@gobble}
+\end{verbatim}
+
+Local definitions of commands used in the
+\texttt{\textbackslash{}author} command. As contents of
+\texttt{\textbackslash{}author} are used in XML files, it is necessary
+to strip away any information which don't belongs here, such as
+\texttt{\textbackslash{}footnote}.
+
+\begin{verbatim}
 \Configure{OpfScheme}{URI}
 \end{verbatim}
 
-Type of unique identifier, default type is URI. It is used only in epub,
-it is deprecated for \texttt{epub3}
+Type of unique identifier, default type is URI. It is used only in
+\texttt{epub}, it is deprecated for \texttt{epub3}
 
 \begin{verbatim}
 \Configure{resettoclevels}{list of section types in descending order}
@@ -177,7 +187,7 @@
 \end{verbatim}
 
 Configure section types which should be included in the \texttt{NCX}
-file. Default value is the whole document hiearchy, from
+file. Default value is the whole document hierarchy, from
 \texttt{\textbackslash{}part} to \texttt{\textbackslash{}paragraph}.
 
 \begin{verbatim}
@@ -184,7 +194,7 @@
 \Configure{DocumentLanguage}{language code}
 \end{verbatim}
 
-Each epub must declare the document language. It is inferred from
+Each ePub file must declare the document language. It is inferred from
 \texttt{babel} main language by default, but you can configure it when
 it doesn't work correctly. The \texttt{language\ code} should be in
 \href{https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes}{ISO 639-1}

Modified: trunk/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex	2019-03-21 20:57:24 UTC (rev 50512)
@@ -8,6 +8,7 @@
 \usepackage[utf8]{inputenc}
 \author{\href{mailto:michal.h21 at gmail.com}{Michal Hoftich}}
 \else
+\usepackage{luatexbase}
 \usepackage{fontspec}
 \setmainfont{TeX Gyre Schola}
 \author{Michal Hoftich\footnote{\url{michal.h21 at gmail.com}}}

Modified: trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua	2019-03-21 20:57:24 UTC (rev 50512)
@@ -20,8 +20,27 @@
 local include_fonts = false
 local metadir=""
 
+-- from https://stackoverflow.com/a/43407750/2467963
+local function deletedir(dir)
+  local attr = lfs.attributes(dir)
+  if attr then
+    for file in lfs.dir(dir) do
+        local file_path = dir..'/'..file
+        if file ~= "." and file ~= ".." then
+            if lfs.attributes(file_path, 'mode') == 'file' then
+                os.remove(file_path)
+                print('remove file',file_path)
+            elseif lfs.attributes(file_path, 'mode') == 'directory' then
+                print('dir', file_path)
+                deletedir(file_path)
+            end
+        end
+    end
+    lfs.rmdir(dir)
+  end
+  print('remove dir',dir)
+end
 
-
 function prepare(params)
 	local randname=tostring(math.random(12000))
 	-- if not ebookutils.file_exists("tex4ht.env") then
@@ -42,6 +61,7 @@
 	end
 	basedir = params.input.."-".. params.format
 	outputdir= basedir.."/"..outputdir_name --"outdir-"..randname --os.tmpdir()
+  deletedir(basedir)
 	makedir(outputdir)
 	-- lfs.mkdir(outputdir)
 	--ebookutils.mkdirectories(ebookutils.prepare_path(outputdir.."/"))
@@ -131,6 +151,10 @@
   smil = "application/smil+xml"
 }
 
+function remove_empty_guide(content)
+  return content:gsub("<guide>%s*</guide>","")
+end
+
 function make_opf()
 	-- Join files content.opf and content-part2.opf
 	-- make item record for every converted image
@@ -183,21 +207,7 @@
         -- 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 outside_spine = {}
-			-- This was duplicated code
-			--[[for i, ext in pairs(all_html) do
-				if not used_html[i] then
-					print("Prvni insert: ".. i .."."..ext)
-					local item, id = lg_item(i.."."..ext) 
-					table.insert(opf_complete,item)
-					table.insert(outside_spine,id)
-				end
-			end--]]
 			local all_used_files = find_all_files(opf_complete[1],"([%a%d%-%_]+%.[%a%d]+)")
 			local used_paths = {}
       local used_ids   = {}
@@ -263,6 +273,7 @@
       local opf_completed = table.concat(opf_complete,"\n")
       -- poor man's tidy: remove trailing whitespace befora xml tags
       opf_completed = opf_completed:gsub("[ ]*<","<")
+      opf_completed = remove_empty_guide(opf_completed)
 			h_first:write(opf_completed)
 			h_first:close()
 			os.remove(opf_second_part)

Modified: trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua	2019-03-21 20:57:24 UTC (rev 50512)
@@ -138,7 +138,9 @@
     content = content:gsub("<spine([^>]*)>", "<spine%1>\n<itemref idref=\"htmltoc\" linear=\"no\"/>\n")
     -- remove empty guide element
   end
-  content = content:gsub("<guide>%s*</guide>","")
+  -- content = content:gsub("<guide>%s*</guide>","")
+  content = eb.remove_empty_guide(content)
+
   content = add_media_overlays(content)
   f = io.open(outputdir .. "/" ..opf,"w")
   f:write(content)

Modified: trunk/Master/texmf-dist/scripts/tex4ebook/tex4ebook
===================================================================
--- trunk/Master/texmf-dist/scripts/tex4ebook/tex4ebook	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/scripts/tex4ebook/tex4ebook	2019-03-21 20:57:24 UTC (rev 50512)
@@ -66,7 +66,7 @@
 end
 
 if args.version then
-  print "tex4ebook v0.2b"
+  print "tex4ebook v0.2c"
   return 
 end
 

Modified: trunk/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht	2019-03-21 20:55:01 UTC (rev 50511)
+++ trunk/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht	2019-03-21 20:57:24 UTC (rev 50512)
@@ -29,6 +29,9 @@
 % use this only if it doesn't work
 \NewConfigure{DocumentLanguage}[1]{\def\GetLanguage{#1}}
 
+% definitions of commands ignored in \author
+\def\a:@author{}
+\NewConfigure{@author}[1]{\concat:config\a:@author{#1}}
 
 \NewConfigure{OpfScheme}{1}
 \Configure{OpfScheme}{URI}
@@ -319,7 +322,7 @@
 % We don't want crosslinks in xml
 % Basic sctructure of the ncx file
 \NoFonts
-{\HCode{<?xml version="1.0"?>\Hnewline}}
+{\HCode{<?xml version="1.0" encoding="utf-8"?>\Hnewline}}
 {\a:NcxDoctype}
 {\Tg<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">}{}
 % To print document map, we customize the tableofcontents. We don't want TOC title,
@@ -372,7 +375,7 @@
 \special{t4ht>content.opf}
 \NoFonts
 \HtmlParOff
-{\HCode{<?xml version="1.0"?>\Hnewline}}
+{\HCode{<?xml version="1.0" encoding="utf-8"?>\Hnewline}}
 \HCode{<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="dcidid"
    version="\a:EpubVersion">\Hnewline}
 {\HCode{<metadata\Hnewline xmlns:dc="http://purl.org/dc/elements/1.1/"\Hnewline  xmlns:opf="http://www.idpf.org/2007/opf">\Hnewline}}
@@ -381,7 +384,7 @@
 %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>}}
-{\HCode{<dc:creator>}\Author\HCode{</dc:creator>\Hnewline}}
+{\HCode{<dc:creator>}{\a:@author\Author}\HCode{</dc:creator>\Hnewline}}
 %{\HCode{<dc:contributor>\HP:file</dc:contributor>\Hnewline}}
 {\HCode{<dc:date>}\:iso:date\HCode{</dc:date>}}
 \a:OpfMetadata



More information about the tex-live-commits mailing list