Skip to content

Make:match fails if there is a footnote #145

@u-fischer

Description

@u-fischer

I'm trying to extract all the mathml into an extra file. Based on https://chat.stackexchange.com/transcript/41?m=65070731#65070731 I tried with this
extract-math.mk4:

local domfilter = require "make4ht-domfilter"

local process = domfilter {"mathmlfixes", -- fix mathml first
   function(dom, par)
      local filename = par.input .. "-mathml.mml"
      local f = io.open(filename, "w")
    for count, math in ipairs(dom:query_selector "math") do
      f:write("\n"..count.."\n")
      f:write(math:serialize())
    end
    f:close()
    return dom
  end
}

Make:match("html", process)

I then call it for test-utf8.tex with make4ht -l -e extract-math.mk4 test-utf8 "mathml"

This works fine for

\documentclass{article}
\begin{document}
$a=b$ and $x=y$

%a\footnote{blub}

\end{document}

and the files contains

1
<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>a</mi> <mo class='MathClass-rel' stretchy='false'>=</mo> <mi>b</mi></mrow></math>
2
<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi> <mo class='MathClass-rel' stretchy='false'>=</mo> <mi>y</mi></mrow></math>

But as soon as I uncomment the footnote in the example above the file is empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions