texlive[56284] trunk: make4ht (7sep20)

commits+karl at tug.org commits+karl at tug.org
Mon Sep 7 23:20:51 CEST 2020


Revision: 56284
          http://tug.org/svn/texlive?view=revision&revision=56284
Author:   karl
Date:     2020-09-07 23:20:51 +0200 (Mon, 07 Sep 2020)
Log Message:
-----------
make4ht (7sep20)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/make4ht/make4ht
    trunk/Master/texmf-dist/doc/support/make4ht/README
    trunk/Master/texmf-dist/doc/support/make4ht/changelog.tex
    trunk/Master/texmf-dist/doc/support/make4ht/make4ht-doc.pdf
    trunk/Master/texmf-dist/doc/support/make4ht/readme.tex
    trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-fixinlines.lua
    trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-mathmlfixes.lua
    trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua
    trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_filters.lua
    trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-dvisvgm_hashes.lua
    trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-join_colors.lua
    trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mathjaxnode.lua
    trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-tidy.lua
    trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-tei.lua
    trunk/Master/texmf-dist/scripts/make4ht/make4ht
    trunk/Master/texmf-dist/scripts/make4ht/make4ht-errorlogparser.lua
    trunk/Master/texmf-dist/scripts/make4ht/make4ht-indexing.lua
    trunk/Master/texmf-dist/scripts/make4ht/mkutils.lua

Added Paths:
-----------
    trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-jats.lua

Removed Paths:
-------------
    trunk/Master/texmf-dist/scripts/make4ht/make4ht-odtfilter.lua

Modified: trunk/Build/source/texk/texlive/linked_scripts/make4ht/make4ht
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/make4ht/make4ht	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Build/source/texk/texlive/linked_scripts/make4ht/make4ht	2020-09-07 21:20:51 UTC (rev 56284)
@@ -29,7 +29,7 @@
 
 -- set version number. the template should be replaced by the
 -- actual version number by the build script
-local version = "v0.3e"
+local version = "v0.3f"
 mkparams.version_number = version
 
 local args = mkparams.get_args()
@@ -43,7 +43,7 @@
 local build_file = parameters.build_file 
 
 -- handle output formats
-local allowed_output_formats = {xhtml = true, html5=true, odt = true, docbook=true, tei=true}
+local allowed_output_formats = {xhtml = true, html5=true, odt = true, docbook=true, tei=true, jats=true}
 -- formatter is Lua library which must provide at least prepare_parameters
 -- and process_build_sequence functions
 local formatter

Modified: trunk/Master/texmf-dist/doc/support/make4ht/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/make4ht/README	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/doc/support/make4ht/README	2020-09-07 21:20:51 UTC (rev 56284)
@@ -888,7 +888,6 @@
 
 options
 
-
 :    additional command line options for the Makeindex command.
 
 ### The `xindex` command
@@ -895,7 +894,6 @@
 
 options
 
-
 :    additional command line options for the Xindex command.
 
 language

Modified: trunk/Master/texmf-dist/doc/support/make4ht/changelog.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/make4ht/changelog.tex	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/doc/support/make4ht/changelog.tex	2020-09-07 21:20:51 UTC (rev 56284)
@@ -3,12 +3,112 @@
 
 \begin{itemize}
 \item
+  2020/09/07
+
+  \begin{itemize}
+  \tightlist
+  \item
+    version \texttt{0.3f} released.
+  \end{itemize}
+\item
+  2020/08/26
+
+  \begin{itemize}
+  \tightlist
+  \item
+    \texttt{fixinlines} DOM filter: added
+    \texttt{\textless{}a\textgreater{}} element into list of inline
+    elements.
+  \end{itemize}
+\item
+  2020/08/24
+
+  \begin{itemize}
+  \tightlist
+  \item
+    initialize attributes in new element in \texttt{mathmlfixes} DOM
+    extension.
+  \end{itemize}
+\item
+  2020/07/18
+
+  \begin{itemize}
+  \tightlist
+  \item
+    changed CSS for the HTML documentation.
+  \end{itemize}
+\item
+  2020/07/17
+
+  \begin{itemize}
+  \tightlist
+  \item
+    fixed bug in index parsing.
+  \end{itemize}
+\item
+  2020/07/10
+
+  \begin{itemize}
+  \tightlist
+  \item
+    use the \texttt{joincharacters} DOM filter for TEI output.
+  \end{itemize}
+\item
+  2020/07/08
+
+  \begin{itemize}
+  \tightlist
+  \item
+    don't fail when filename cannot be detected in
+    \texttt{make4ht-errorlogparser.lua}.
+  \end{itemize}
+\item
+  2020/05/27
+
+  \begin{itemize}
+  \tightlist
+  \item
+    test if copied file exists in \texttt{mkutils.cp}.
+  \end{itemize}
+\item
+  2020/05/19
+
+  \begin{itemize}
+  \tightlist
+  \item
+    fixed image filename replace in \texttt{dvisvgm\_hashes} extension.
+  \end{itemize}
+\item
+  2020/05/16
+
+  \begin{itemize}
+  \tightlist
+  \item
+    fixed HTML filename matching in extensions.
+  \end{itemize}
+\item
+  2020/05/08
+
+  \begin{itemize}
+  \tightlist
+  \item
+    use global environment in the build files.
+  \end{itemize}
+\item
+  2020/03/03
+
+  \begin{itemize}
+  \tightlist
+  \item
+    added \texttt{jats} format.
+  \end{itemize}
+\item
   2020/02/28
 
   \begin{itemize}
   \tightlist
   \item
-    version \texttt{0.3e\ released}
+    version \texttt{0.3e\ released}.
   \end{itemize}
 \item
   2020/02/24

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

Modified: trunk/Master/texmf-dist/doc/support/make4ht/readme.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/make4ht/readme.tex	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/doc/support/make4ht/readme.tex	2020-09-07 21:20:51 UTC (rev 56284)
@@ -950,19 +950,18 @@
 \subsubsection{\texorpdfstring{The \texttt{makeindex}
 command}{The makeindex command}}\label{the-makeindex-command}}
 
-options
+\begin{description}
+\item[options]
+additional command line options for the Makeindex command.
+\end{description}
 
-: additional command line options for the Makeindex command.
-
 \hypertarget{the-xindex-command}{%
 \subsubsection{\texorpdfstring{The \texttt{xindex}
 command}{The xindex command}}\label{the-xindex-command}}
 
-options
-
-: additional command line options for the Xindex command.
-
 \begin{description}
+\item[options]
+additional command line options for the Xindex command.
 \item[language]
 document language
 \end{description}

Modified: trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-fixinlines.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-fixinlines.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-fixinlines.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -1,4 +1,5 @@
 local inline_elements = {
+  a=true,
   b=true,
   big=true,
   i=true,

Modified: trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-mathmlfixes.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-mathmlfixes.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-mathmlfixes.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -28,6 +28,7 @@
       -- if parent doesn't have the mathvariant attribute copy it from <mstyle>
       if not parent:get_attribute("mathvariant") then
         local mathvariant = el:get_attribute("mathvariant") 
+        parent._attr = parent._attr or {}
         parent:set_attribute("mathvariant", mathvariant)
       end
       -- copy the contents of <mstyle> to the parent element

Modified: trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -27,7 +27,7 @@
     count = 2
   else
     local process = filter {"fixinlines", "idcolons", "joincharacters", "mathmlfixes", "tablerows","booktabs"}
-    make:match("html$", process)
+    make:match("html?$", process)
     count = 1
   end
   return make

Modified: trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_filters.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_filters.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_filters.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -11,7 +11,7 @@
 end
 
 function M.modify_build(make)
-  make:match("html$", process)
+  make:match("html?$", process)
   local matches = make.matches
   -- the filters should be first match to be executed, especially if tidy
   -- should be executed as well

Modified: trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-dvisvgm_hashes.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-dvisvgm_hashes.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-dvisvgm_hashes.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -244,11 +244,11 @@
 
   -- fix src attributes
   local process = filter {
-    function(str)
-      return str:gsub('src="([^"]+)', function(filename)
+    function(str, filename)
+      return str:gsub('src=["\'](.-)(["\'])', function(filename, endquote)
         local newname = output_map[filename] or filename
         log:debug("newname", newname)
-        return 'src="'.. newname 
+        return 'src=' .. endquote .. newname  .. endquote
       end)
     end
   }

Modified: trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-join_colors.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-join_colors.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-join_colors.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -10,7 +10,7 @@
 
 function M.modify_build(make)
   local process = filter {"joincolors"}
-  make:match("html$", process)
+  make:match("html?$", process)
   return make
 end
 return M

Modified: trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mathjaxnode.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mathjaxnode.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mathjaxnode.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -9,7 +9,7 @@
 
 function M.modify_build(make)
   local mathjax = filter { "mathjaxnode"}
-  make:match("html$",mathjax)
+  make:match("html?$",mathjax)
   return make
 end
 

Modified: trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-tidy.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-tidy.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-tidy.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -38,7 +38,7 @@
 
 
 function M.modify_build(make)
-  make:match("html$", function(filename, par)
+  make:match("html?$", function(filename, par)
     local settings = get_filter_settings "tidy" or {}
     par.options = par.options or settings.options or "-utf8 -w 512 -ashtml -q"
     local command = "tidy ${options}  ${filename}" % par

Added: trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-jats.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-jats.lua	                        (rev 0)
+++ trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-jats.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -0,0 +1,14 @@
+local M = {}
+local xtpipeslib = require "make4ht-xtpipes"
+
+function M.prepare_parameters(settings, extensions)
+  settings.tex4ht_sty_par = settings.tex4ht_sty_par ..",jats"
+  settings = mkutils.extensions_prepare_parameters(extensions, settings)
+  return settings
+end
+
+function M.prepare_extensions(extensions)
+  return extensions
+end
+
+return M


Property changes on: trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-jats.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-tei.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-tei.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/formats/make4ht-tei.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -1,6 +1,8 @@
 local M = {}
 local xtpipeslib = require "make4ht-xtpipes"
 
+local domfilter = require "make4ht-domfilter"
+
 function M.prepare_parameters(settings, extensions)
   settings.tex4ht_sty_par = settings.tex4ht_sty_par ..",tei"
   settings = mkutils.extensions_prepare_parameters(extensions, settings)
@@ -11,4 +13,19 @@
   return extensions
 end
 
+function M.modify_build(make)
+  local process = domfilter {
+    "joincharacters"
+  }
+
+  -- we use <hi> elements for characters styled using HTF fonts in TEI
+  -- use the `joincharacters` DOM filter to join them
+  filter_settings "joincharacters" {
+    charclasses = { hi=true, mn = true}
+  }
+
+  make:match("xml$", process)
+  return make
+end
+
 return M

Modified: trunk/Master/texmf-dist/scripts/make4ht/make4ht
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/make4ht	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/make4ht	2020-09-07 21:20:51 UTC (rev 56284)
@@ -29,7 +29,7 @@
 
 -- set version number. the template should be replaced by the
 -- actual version number by the build script
-local version = "v0.3e"
+local version = "v0.3f"
 mkparams.version_number = version
 
 local args = mkparams.get_args()
@@ -43,7 +43,7 @@
 local build_file = parameters.build_file 
 
 -- handle output formats
-local allowed_output_formats = {xhtml = true, html5=true, odt = true, docbook=true, tei=true}
+local allowed_output_formats = {xhtml = true, html5=true, odt = true, docbook=true, tei=true, jats=true}
 -- formatter is Lua library which must provide at least prepare_parameters
 -- and process_build_sequence functions
 local formatter

Modified: trunk/Master/texmf-dist/scripts/make4ht/make4ht-errorlogparser.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/make4ht-errorlogparser.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/make4ht-errorlogparser.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -1,7 +1,10 @@
 local m = {}
 
 local function get_filename(chunk)
-  local filename = chunk:match("([^\n^%(]+)")
+  local filename = chunk:match("([^\n^%(]+)") 
+  if not filename then 
+    return false, "No filename detected"
+  end
   local first = filename:match("^[%./\\]+")
   if first then return filename end
   return false

Modified: trunk/Master/texmf-dist/scripts/make4ht/make4ht-indexing.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/make4ht-indexing.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/make4ht-indexing.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -75,7 +75,7 @@
     if line:match("^\\beforeentry") then
       -- increment index entry number
       current_entry = current_entry + 1
-      local file, dest = line:match("\\beforeentry{(.-)}{(.-)}")
+      local file, dest = line:match("\\beforeentry%s*{(.-)}{(.-)}")
       map[current_entry] = {file = file, dest = dest}
     elseif line:match("^\\indexentry") then
       -- replace the page number with the current

Deleted: trunk/Master/texmf-dist/scripts/make4ht/make4ht-odtfilter.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/make4ht-odtfilter.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/make4ht-odtfilter.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -1,33 +0,0 @@
-local mkutils = require "mkutils"
-local zip = require "zip"
-
-
--- use function to change contents of the ODT file
-local function update_odt(odtfilename, file_path, fn)
-  -- get name of the odt file
-  local odtname = mkutils.remove_extension(odtfilename) .. ".odt"
-  -- open and read contents of the requested file inside ODT file
-  local odtfile = zip.open(odtname)
-  local local_file = odtfile:open(file_path)
-  local content = local_file:read("*all")
-  local_file:close()
-  odtfile:close()
-  -- update the content using user function
-  content = fn(content)
-  -- write the updated file
-  local local_file_file  = io.open(file_path,"w")
-  local_file_file:write(content)
-  local_file_file:close()
-  os.execute("zip " .. odtname .. " " .. file_path)
-  os.remove(file_path)
-end
-
-Make:match("tmp$", function(name, par)
-  update_odt(name, "content.xml", function(content)
-    return content:gsub("%&%#x([A-Fa-f0-9]+);", function(entity)
-      -- convert hexadecimal entity to Unicode
-      print(entity,utfchar(tonumber(entity, 16)))
-      return utfchar(tonumber(entity, 16))
-    end)
-  end)
-end)

Modified: trunk/Master/texmf-dist/scripts/make4ht/mkutils.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/make4ht/mkutils.lua	2020-09-07 21:20:24 UTC (rev 56283)
+++ trunk/Master/texmf-dist/scripts/make4ht/mkutils.lua	2020-09-07 21:20:51 UTC (rev 56284)
@@ -118,6 +118,9 @@
 	local command = string.format('%s "%s" "%s"', cp_func, src, dest)
 	if cp_func == "copy" then command = command:gsub("/",'\\') end
 	log:info("Copy: "..command)
+  if not file_exists(src) then
+    log:error("File " .. src .. " doesn't exist")
+  end
 	os.execute(command)
 end
 
@@ -264,9 +267,11 @@
 
 local main_settings = {}
 main_settings.fonts = {}
-local env = {}
+-- use global environment in the build file
+-- it used to be sandboxed, but it proved not to be useful at all
+local env = _G ---{}
 
--- We make sandbox for make script, all functions must be explicitely declared
+-- explicitly enale some functions and modules in the sandbox
 -- Function declarations:
 env.pairs  = pairs
 env.ipairs = ipairs



More information about the tex-live-commits mailing list.