another edit:
of you don't want to postprocess html, you may use different mean to achieve verbatim environment. For example with fancyvrb
package:
\usepackage{fancyvrb}
\Preamble{xhtml}
\def\StartSuppressPage{\nobreak\vfil\penalty0\vfilneg\vtop\bgroup}
\def\EndSuppressPage{\egroup}
\renewenvironment{tawny}
{\IgnorePar\EndP\StartSuppressPage\HCode{<pre><code class="clojure">}\HtmlParOff\NoFonts\Verbatim}
{\endVerbatim\EndSuppressPage\HCode{</code></pre>}\EndNoFonts\HtmlParOn\par}
\Configure{fancyvrb}{}{}{}{}{}{}
\begin{document}
\EndPreamble
and sample of resulting html:
tudin, felis odio placerat quam, ac pulvinar elit purus eget enim. Nunc vitae
tortor. Proin tempus nibh sit amet nisl. Vivamus quis tortor vitae risus porta
vehicula.
</p>
<pre><code class="clojure">
<a
id="x1-3r1"></a>(defclass Pizza
<a
id="x1-5r2"></a>  :super Thing)
<a
id="x1-7r3"></a>tady je radek
<a
id="x1-9r4"></a>a > b & c
</code></pre>
<!--l. 15--><p class="indent" > Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor
lorem non justo. Nam lacus libero, pretium at, lobortis v
Edit:
it seems that in this case lua filter for make4ht
must be used. Use this .mk4
file:
local filter= require "make4ht-filter"
local entities = function(s)
return '<code class="clojure">' .. s:gsub('<code class="clojure">(.-)</code>', function(a)
local escapes = {["<"]="lt",[">"]="gt",["&"]="amp"}
return a:gsub("([%<%>%&])", function(x)
return "&"..(escapes[x] or x) .. ";"
end)
end) .. '</code>'
end
local process = filter(entities, uj)
if mode == "draft" then
Make:htlatex{}
Make:match("html$", process)
else
Make:htlatex{}
Make:htlatex{}
Make:htlatex{}
Make:match("html$", process)
end
filter entities
is defined, which process content of <code class="clojure">
element and convert all <
,>
and &
to html entities:
<pre><code class="clojure">
(defclass Pizza
:super Thing)
(isubclasses OntologyBook)
;;=> #{#<OWLClassImpl <bc33d2c3-7ecb413c-bb04-83af2295c465#walk_through#TakeWing>>}
</code></pre>
Old version:
Content of \ScriptEnv
is exported verbatim, without any processing, so it seems that this can't be solved at the LaTeX side. But you can post-process html
with some tool to replace these prohibited characters with html entities. Some Lua
script could be used for that, but easiest way is to use tidy
command:
tidy -m -utf8 -q -i filename.html
before:
<pre><code class="clojure">
a > b & c
</code></pre>
after
<pre>
<code class="clojure">
a > b & c
</code>
</pre>
with make4ht you can automatize this. make build file filename.mk4
:
if mode == "draft" then
Make:htlatex{}
else
Make:htlatex{}
Make:htlatex{}
Make:htlatex{}
Make:match("html$", "tidy -m -utf8 -q -i ${filename}")
end
with this build file, you will be able to quickly view your file with
make4ht -m draft -c yourconfigfile.cfg filename
and tidy
will be used only for final build. Other feature is that all output html
files will be processed (this is useful if you split sections or chapters to standalone html files)