The function allows to specify a template with the same argument value
that would be used with the `--template` command line parameter.
Closes: #9854
Co-authored-by: Carsten Gips <cagix@hsbi.de>
The state is an internal value and should be treated as such. The
`PANDOC_STATE` global is merely a copy; unsetting the global no longer
breaks the Lua engine.
The default is now to use a *copy* of the global environment when running a
filter; this ensures better separation when `run_lua_filter` is used multiple
times. A custom environment can be specified via the optional third parameter.
Lists created by `pandoc.json.decode` now behave like lists generated
via `pandoc.List`. This also ensures that `pandoc.List` tables are
encoded as JSON arrays when passed to `pandoc.json.encode`.
Fixes: #9834
This fixes counterintuitive behavior of the `content` property on
BulletList and OrderedList items. Unmarshalling of that field now
matches the behavior of the constructor.
Fixes: #8916
Invalid input bytes in error messages caused pandoc to crash with an
encoding exception. Instead, the invalid bytes are now replaced with the
Unicode replacement character U+FFFD.
+ When the optional base level parameter is provided, we no
longer ensure that the sequence of heading levels is gapless
[behavior change]. Instead, we set the lowest heading level to
the specified base level, and adjust the others accordingly. If
an author wants to skip a level, e.g. from level 1 to level 3,
they can do that. In general, the heading levels specified
in the source document are preserved; `makeSections` only
puts them into a hierarchical structure. Closes#9398.
+ Section numbers are now assigned so that the top level
gets `1`, no matter what heading level is used. So, even
if the top heading level is 2, numbers will be `1`, `2`, etc.
rather than `0.1`, `0.2`, as in the past. Closes#5071.
+ We revert to the old behavior when the `--number-offset` option
is used. So, for example, if a document begins with a level-3
heading, and `--number-offset=1,2` is used, the top-level section
numbers will be `1.2.1`, `1.2.2`, etc. This is mainly for
backwards-compatibility.
The CommonState (`PANDOC_STATE` in Lua) may change between the time that
a custom writer script is first loaded and when the writer is run.
However, the writer was always using the initial state, which led to
problems, e.g. when the mediabag was updated in a filter, as those
updates where not visible to the writer.
The state is now updated right before the writer function runs.
Fixes: #9229
Lua's warning system is plugged into pandoc's reporting architecture.
Warnings that are raised with the Lua `warn` function are now reported
together with other messages.
Should fix the following error when running tests from Hackage tarball:
```
pandoc.mediabag: [WARNING] Could not fetch resource lua/module/sample.svg: replacing image with description
FAIL
fetch // populates media bag:
File lua/module/sample.svg not found in resource path
DEBUG:root:haskell-pandoc-lua-engine:
fill // populates media bag:
lua/module/pandoc-mediabag.lua:70:
expected values to be equal, got 'nil' and 'image/svg+xml'
```
* T.P.Format: export `formatFromFilePaths` [API change]
* Lua: add function `pandoc.format.from_path`
* Update lua-filters.md
* The old T.P.App.FormatHeuristics module has been removed.
This is an alternative to #8693.
This only affects the name in the Lua-internal documentation. It is
still possible to load the modules via `require 'text'`, although this
is deprecated.