Skip to content

Lua filters don't receive pandoc's AST, and don't output anything #38

@josineto

Description

@josineto

Starting with panzer 1.4, lua filters are supported (many thanks to @msprev !!). So I tried some lua filters that I wrote myself, and none of them got expected behaviour. In fact, it seems lua filters are receiving JSON, when should receive AST instead (according to pandoc's doc on lua filters).

For instance, I have this lua filter (very first example on lua filters in pandoc's doc). It should turn Strong elements into SmallCaps elements:

function Strong(elem)
  return pandoc.SmallCaps(elem.c)
end

Running directly with pandoc, it works. Using panzer, nothing happens. Below is my styles.yaml (excerpt), which only puts that lua filter to run:

Base:
  all:
    metadata:
      numbersections: true
      lang: "pt-BR"
    commandline:
      standalone: true
    lua-filter:
      - run: myfilter.lua

The filter is correctly found by panzer, and apparently runs, but no errors on lua-filter are shown when running panzer. Even print('some debug') doesn't output anything to console. I tried to use JSON on the lua filter, but I couldn't realize how to do that. My first try was like code below, withou any results:

function test(key, value, format, meta)
  return pandoc.Str(value)
end

toJSONFilter(test)

Am I missing something?

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