I use make4ht to produce html; part of the process is a custom build file that parses the HTML and does some checking/operations:
mwe.tex
\documentclass{article}
\begin{document}
test: $2^3$
unbalanced: ($6)$
\section{test section}
more text
\end{document}
mwe.cfg
\Preamble{xhtml,mathml,next,5,-css,NoFonts}
\begin{document}
\EndPreamble
mwe.mk4
local domfilter = require "make4ht-domfilter"
local filter = require "make4ht-filter"
local dom = require "luaxml-domobject"
local function mwe_parsing(s)
local obj = dom.parse(s)
obj:traverse_elements(function(el)
end)
-- serialize the DOM object back to HTML
return obj:serialize()
end
local process = filter {mwe_parsing}
Make:match("html$", process)
Make:match("html$", "tidy -m -xml -utf8 -q -i ${filename}")
Call to make4ht
The call to make4ht is
make4ht -u -c mwe.cfg mwe.tex
which results in HTML files, but the parsing error on the first file (mwe.html) has stopped parsing and subsequent build operations (in the above, tidy) of other files (mwese1.html)
parse_lg process file: mwe.html
...ive/2019/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:174: Unbalanced Tag (/mrow) [char=848]
Note
I know what the problem is with mwe.tex and that it needs changing to $(6)$, but I am not in control of the source files I'm given, and part of the process is finding such errors. This question is something of a follow-up to htlatex: tweaking the MathML output for numbers with more than one digit
The question
How can I customise mwe.mk4 so that it gets through the parsing error in html files and continues with the build processes? Perhaps a check could be done to see if dom.parse(s) is successful?
v0.2g). I'll update and report back. thanks so much – cmhughes May 08 '20 at 11:32pcalldidn't work in build files until today, so the update is necessary in this case. Version0.2gis really old, you may experience some substantial changes. Most important is that the CLI ouput is hidden by default, use-a debugoption to see TeX output and other compilation messages. – michal.h21 May 08 '20 at 11:55V0.3eof make4ht. Is there a way that I can access the develop version ofmake4ht? – cmhughes May 12 '20 at 16:06