blob: e59b419cdf4b50ad74d7bbb82e5b522493e96834 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
local M = {}
local filter = require "make4ht-filter"
function M.test(format)
-- this extension works only for formats based on HTML, as it produces
-- custom HTML tags that would be ilegal in XML
if not format:match("html5?$") then return false end
return true
end
--
local detected_latex = false
function M.prepare_parameters(params)
-- mjcli supports both MathML and LaTeX math input
-- LaTeX math is keep if user uses "mathjax" option for make4ht
-- "mathjax" option used in \Preamble in the .cfg file doesn't work
if params.tex4ht_sty_par:match("mathjax") then
detected_latex = true
else
params.tex4ht_sty_par = params.tex4ht_sty_par .. ",mathml"
end
return params
end
function M.modify_build(make)
local mathjax = filter { "mjcli"}
local params = {}
if detected_latex then
params.latex = true
end
make:match("html?$",mathjax, params)
return make
end
return M
|