205 Commits

Author SHA1 Message Date
Albert Krewinkel 309163f5bc [API Change] Base custom writers on Writer type.
The `T.P.Lua.writeCustom` function changed to allow either a TextWriter
or ByteStringWriter to be returned. The global variables
`PANDOC_DOCUMENT` and `PANDOC_WRITER_OPTIONS` are no longer set when the
writer script is loaded. Both variables are still set in classic writers
before the conversion is started, so they can be used when they are
wrapped in functions.
2022-10-03 08:47:32 -07:00
Albert Krewinkel 3b0e700720 Lua: add function pandoc.write_classic.
The function can be used to convert a classic writer into a new-style
writer by setting it as the value of `Writer`:

``` lua
Writer = pandoc.write_classic
```

or to fully restore the old behavior:

``` lua
function Writer (doc, opts)
  PANDOC_DOCUMENT = doc
  PANDOC_WRITER_OPTIONS = opts
  load(PANDOC_SCRIPT_FILE)()
  return pandoc.write_classic(doc, opts)
end
```
2022-10-03 08:47:32 -07:00
Albert Krewinkel 132931a491 Lua: Support running Lua with a GC-collected Lua state. 2022-10-03 08:47:32 -07:00
Albert Krewinkel c8d08b945c Remove support for Lua 5.3. 2022-10-03 08:47:32 -07:00
Albert Krewinkel 5be9052f5f [API Change] Extract Lua code into new package pandoc-lua-engine
The flag 'lua53` must now be used with that package if pandoc is to be
compiled against Lua 5.3.
2022-09-30 08:33:40 -07:00