Skip to content

pandoc filters in decker.yaml #132

@kno10

Description

@kno10

I use the following (suboptimal, only works on slide level!) pandoc filter to mask contents from the student version:

function Pandoc(doc)
  local ret = {}
  local skip = false
  for _, block in ipairs(doc.blocks) do
    if block.t == "Header" then
      skip = false
    end
    if block.classes then
      for _, class in ipairs(block.classes) do
        if class == 'class-only' then
          skip = true
        end
      end
    end
    if not skip then
      ret[#ret + 1] = block
    end
  end
  return pandoc.Pandoc(ret, doc.meta)
end

If I add this to my -deck.md, it works:

pandoc:
  filters:
    before:
    - pandoc-data/student-version.lua

However, if I add this to the decker.yaml to enable it for all decks at once, I get (TMP is a temporary build folder):

PandocFilterError "/tmp/TMP/pandoc-data/student-version.lua" "cannot open /tmp/TMP/pandoc-data/student-version.lua: No such file or directory"

It would be convenient if the filter could be added globally for the project.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions