diff options
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mjcli.lua')
-rw-r--r-- | Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mjcli.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mjcli.lua b/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mjcli.lua new file mode 100644 index 00000000000..e59b419cdf4 --- /dev/null +++ b/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-mjcli.lua @@ -0,0 +1,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 |