Matthias Knauthe
Matthias Knauthe

Reputation: 1

pypandoc ignores lua filters

I'm using pypandoc to use pandoc in python to convert html to markdown I'm trying to make pypandoc apply lua filters. But non of the filters are applied. I put checkpoints at every function head and none of them are visited, so the filters aren't even called, even though pypandoc registers them. I know that pypandoc registers the filters, because when I put some syntax error into one of my lua scripts, it is specifically my pypandoc call that throws an error, specifically referencing that lua script.

Here is my pypandoc call:


filters = ["lua/" + f for f in os.listdir("lua")]
md = pypandoc.convert_file(source_file=sourcepath, format='html', to='gfm-raw_html', filters = filters)

Here are some of my filters:

lua/Nav.lua:


function Nav(el)
    return {}
end

lua/Img.lua:


function Img(el)
    if el.attributes.alt == "question_mark" then
        return ' "?" '
    else
        return {}
    end
end

What I tried: Using lua filters in pypandoc.

Expected behavior: The filters get applied.

Actual behavior: The filters are ignored. Pypandoc converts files without applying any filters. No errors are thrown.

Upvotes: 0

Views: 87

Answers (0)

Related Questions