This thread is excellent! I'm trying to get this working... Must be having some sort of basic setup issue or something. 

I'm just trying to use the basic "PAGEBREAK" replace option. 

import Text.Pandoc.JSON

pgBrkXml :: String
pgBrkXml = "<w:p><w:r><w:br w:type=\"page\"/></w:r></w:p>"

pgBrkBlock :: Block
pgBrkBlock = RawBlock (Format "openxml")
pgBrkXml

insertPgBrks :: Block -> Block
insertPgBrks (Para [Str "PAGEBREAK"])  = pgBrkBlock
insertPgBrks blk = blk

main = toJSONFilter insertPgBrks

Getting all kinds of funky responses:

As-MacBook-Air:poetry macair$ pandoc --filter /Users/macair/.pandoc/filter-pagebreak.hs test_ms.md -f markdown -t docx -s -o test_ms.docx

/Users/macair/.pandoc/filter-pagebreak.hs: line 1: import: command not found

/Users/macair/.pandoc/filter-pagebreak.hs: line 3: pgBrkXml: command not found

/Users/macair/.pandoc/filter-pagebreak.hs: line 4: pgBrkXml: command not found

/Users/macair/.pandoc/filter-pagebreak.hs: line 6: pgBrkBlock: command not found

/Users/macair/.pandoc/filter-pagebreak.hs: line 7: syntax error near unexpected token `('

/Users/macair/.pandoc/filter-pagebreak.hs: line 7: `pgBrkBlock = RawBlock (Format "openxml")'

pandoc: Error running filter /Users/macair/.pandoc/filter-pagebreak.hs


Compiling the filter also seems to go wonky:

As-MacBook-Air:.pandoc macair$ ghc --make filter-pagebreak.hs

[1 of 1] Compiling Main             ( filter-pagebreak.hs, filter-pagebreak.o )


filter-pagebreak.hs:8:1:

    Parse error: naked expression at top level

    Perhaps you intended to use TemplateHaskell


I'm new to Haskell and pandoc. Assuming there's some simple, basic, no-brainer thing that I'm not doing?

All best!

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9c2658ec-c79f-4dd7-b403-21c88dc93bc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.