aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src/Text
AgeCommit message (Collapse)Author
2022-10-16Lua: fix rendering of Lua errors in LuaAlbert Krewinkel
Otherwise the `Error running Lua` message can be prepended multiple times.
2022-10-16Lua: fix peeker for PandocError.Albert Krewinkel
String error messages were incorrectly popped of the stack when retrieving a PandocError.
2022-10-14Lua: Support built-in default templates for custom writersAlbert Krewinkel
Custom writers can define a default template via a global `Template` function; the data directory is no longer searched for a default template. Writer authors can restore the old lookup behavior with ``` lua Template = function () local template return template.compile(template.default(PANDOC_SCRIPT_FILE)) end ```
2022-10-12Lua: add function `pandoc.template.meta_to_context`.Albert Krewinkel
The functions converts Meta values to template contexts; the intended use is in combination with `pandoc.template.apply`.
2022-10-12Lua: support extensions in custom readers.Albert Krewinkel
Like custom readers, like writers, can define the set of supported extensions by setting a global. E.g.: ``` lua reader_extensions = { smart = true, citations = false, } ```
2022-10-12Lua: allow Doc values in `WriterOptions.variables`.Albert Krewinkel
The specialized peeker and pusher function for `Context Text` values does not go via JSON, and thus keeps Doc values unchanged during round-tripping.
2022-10-11Lua: add function `pandoc.template.apply`Albert Krewinkel
The new function applies a context, containing variable assignments, to a template.
2022-10-10Lua: support extensions in custom writersAlbert Krewinkel
Custom writers can define the extensions that they support via the global `writer_extensions`. The variable's value must be a table with all supported extensions as keys, and their default status as values. E.g., the below specifies that the writer support the extensions `smart` and `sourcepos`, but only the `smart` extension is enabled by default: writer_extensions = { smart = true, sourcepos = false, }
2022-10-10Lua: support custom bytestring readers.Albert Krewinkel
2022-10-10Lua: use `Reader` type for custom readers.Albert Krewinkel
2022-10-08[API Change] Change argument type of `getReader`, `getWriter`.Albert Krewinkel
The functions now take a `FlavoredFormat` instead of a text argument.
2022-10-08[API Change] Add new module "Text.Pandoc.Format"Albert Krewinkel
The module provides functions and types for format spec parsing and processing. The function `parseFormatSpec` was moved from Text.Pandoc.Extensions to the new module and renamed to `parseFlavoredFormat`. It now operates in a PandocMonad and is based on the updated types.
2022-10-06Lua: cleanup module dependenciesAlbert Krewinkel
Ensures a cleaner module dependency graph.
2022-10-05Lua: produce more informative error messages for pandoc errorsAlbert Krewinkel
Errors are reported in Lua in the same words in which they would be reported in the terminal.
2022-10-04Lua: add new module `pandoc.format`.Albert Krewinkel
The module provides functions to query the set of extensions supported by formats, and the set of extension enabled per default.
2022-10-04Lua: ensure that extensions marshaling is consistent.Albert Krewinkel
2022-10-03Separate out T.P.Data, T.P.Translations from T.P.Class. (#8348)John MacFarlane
This makes T.P.Class more self-contained, and suitable for extraction into a separate package if desired. [API changes] - T.P.Data is now an exported module, providing `readDataFile`, `readDefaultDataFile` (both formerly provided by T.P.Class), and also `getDataFileNames` (formerly unexported in T.P.App.CommandLineOptions). - T.P.Translations is now an exported module (along with T.P.Translations.Types), providing `readTranslations`, `getTranslations`, `setTranslations`, `translateTerm`, `lookupTerm`, `readTranslations`, `Term(..)`, and `Translations`. - T.P.Class: `readDataFile`, `readDefaultDataFile`, `setTranslations`, and `translateTerm` are no longer exported. `checkUserDataDir` is now exported. - Text.Pandoc now exports Text.Pandoc.Data and `setTranslations` and `translateTerm`.
2022-10-03[API Change] Support bytestring custom writers.Albert Krewinkel
New-style custom Lua writers can now define an alternative entry function `BinaryWriter`. If a function with that name is defined, then pandoc will treat the returned string as binary output. This allows to generate formats like docx and odt with custom writers.
2022-10-03[API Change] Base custom writers on Writer type.Albert Krewinkel
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-03Lua: add function `pandoc.write_classic`.Albert Krewinkel
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-03Lua: Support running Lua with a GC-collected Lua state.Albert Krewinkel
2022-09-30[API Change] Extract Lua code into new package pandoc-lua-engineAlbert Krewinkel
The flag 'lua53` must now be used with that package if pandoc is to be compiled against Lua 5.3.