115 Commits
Author SHA1 Message Date
John MacFarlane b419770850 Bump pandoc, pandoc-cli to 3.2, update changelog.
Also bump pandoc-lua-engine to 0.2.1.5 and allow pandoc 3.2.
2024-05-11 12:01:16 -07:00
Albert Krewinkel e5c135e68e Lua: add a pandoc.log module. 2024-05-10 19:03:29 -07:00
Albert Krewinkel ddc66cad0b Lua: update to pandoc-lua-marshal version 0.2.7.
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
2024-05-06 17:06:43 +02:00
Albert Krewinkel 0f29d8195e Lua: use hslua-module-zip-1.1.3 to fix the windows build 2024-05-05 21:16:31 +02:00
Albert Krewinkel 018922d10f Lua: use newest zip module.
This adds a `symlink` function to Entry objects, allowing to check if an
entry represents a symbolic link.
2024-05-05 17:54:33 +02:00
Albert Krewinkel 32f0ed9ea3 Lua: improve pandoc.json.decode docs. 2024-05-05 00:25:29 +02:00
Albert Krewinkel c45f163b4d Lua: fix generated docs.
Update and fix docs for `pandoc.types.Version` and `pandoc.utils.type`.
2024-05-04 22:17:01 +02:00
John MacFarlane 03630a2c6e Update copyright dates to 2024. 2024-04-25 18:16:49 -07:00
Albert Krewinkel 5f937eae61 Lua: add new module pandoc.image
The module provides basic querying functions for image properties.
2024-04-16 10:23:08 -07:00
John MacFarlane cb281aed0e Bump pandoc-lua-engine to 0.2.1.4. 2024-04-07 08:40:45 -07:00
Albert Krewinkel 2792d218b1 Require pandoc-lua-marshal 0.2.6
Fixes an issue arising when the value of `content` properties
on *BlockQuote*, *Figure*, and *Div* elements was an empty list.

Fixes: #9613
2024-03-29 19:03:05 +01:00
Albert Krewinkel 5c6a8eb607 Lua: avoid crashing when an error message is not valid UTF-8
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.
2024-02-20 21:10:15 +01:00
John MacFarlane e9425aaed7 Allow containers 0.7.
- Bump pandoc-lua-engine to 0.2.1.3.
- Bump pandoc-server to 0.1.0.5.
2024-02-14 23:03:56 -08:00
John MacFarlane f2e3e9891a Bump pandoc-server to 0.1.0.5 and allow containsers 0.7 2024-02-14 22:59:09 -08:00
John MacFarlane 03bb426a4a Shared: makeSections behavior changes.
+ 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.
2024-02-03 22:19:29 -08:00
John MacFarlane 32b6db15dc Update lua tests for change to toTOCTree. 2024-01-30 08:05:25 -08:00
Albert Krewinkel d90444d4c8 Lua: catch encoding error in pandoc.read
Fixed a bug that could lead to an un-catchable error and program
termination when `pandoc.read` was called with invalid UTF-8 input.

Fixes: #9385
2024-01-29 17:41:44 +01:00
Albert Krewinkel c2f7f5c63f Custom writers: fix handling of common state
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
2024-01-20 10:14:48 -08:00
Albert Krewinkel 2c6f22d2b4 Lua: Use the newest LPeg version (lpeg-1.1.*)
Closes: #9107
2023-09-27 21:04:49 +02:00
John MacFarlane fc0beae420 pandoc-lua-engine: bump lower bound for pandoc.
See #9046.
2023-09-01 12:13:16 -07:00
John MacFarlane 9599fa748d pandoc-lua-engine: bump to 0.2.1.2 2023-08-31 09:32:10 -07:00
John MacFarlane 099b00d406 pandoc-lua-engine; allow text 2.1. 2023-08-31 09:29:49 -07:00
John MacFarlane fb47bde3a3 Bump pandoc-lua-engine version to 0.2.1.1 2023-08-06 19:09:24 -07:00
John MacFarlane 14b5298052 Bump dates, update dependencies. 2023-08-06 11:44:41 -07:00
John MacFarlane 14f86c3481 Bump pandoc-lua-engine to 0.2.1. 2023-06-24 14:27:31 -07:00
Albert Krewinkel 5beb7a1b64 Lua: report warnings from Lua scripts
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.
2023-06-22 10:48:33 -07:00
John MacFarlane b1a78b0dda Bump pandoc-lua-engine to 0.2.0.1. 2023-06-09 10:02:31 -07:00
Felix Yan ede51f6a5a Include lua/module/sample.svg in hackage tarball
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'
```
2023-06-09 09:56:18 -07:00
Albert Krewinkel a249f75a30 Lua: fix value of PANDOC_SCRIPT_FILE for custom readers & writers
The value did not hold the actual file path for scripts in the *custom*
folder of the datadir.

Fixes: #8781
2023-04-16 13:53:54 +02:00
John MacFarlane 509adf7cbf Bump pandoc-lua-engine to 0.2, depend on latest pandoc 2023-03-27 16:55:18 -07:00
Albert Krewinkel 0883efd145 Lua: Fix typo in pandoc.cli doc string. 2023-03-21 07:57:24 +01:00
Albert Krewinkel f1b55be65f T.P.Format: add new function formatFromFilePaths [API Change] (#8710)
* 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.
2023-03-20 21:19:16 -07:00
Albert Krewinkel 70511692a8 Lua: add Windows-specific note to pandoc.cli.repl docs 2023-03-20 16:06:19 +01:00
Albert Krewinkel 8346cfad4c lua-filters: auto-generate docs for pandoc.system module. 2023-03-20 16:06:19 +01:00
Albert Krewinkel 0e4b397e70 Lua: fix json.encode for nested AST elements.
Ensures that objects with nested AST elements can be encoded as JSON.
2023-03-20 16:06:19 +01:00
Albert Krewinkel ed5197f525 Lua: load text module as pandoc.text.
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.
2023-03-20 16:06:18 +01:00
Albert Krewinkel a53a6edfa5 lua-filters.md: Generate docs for pandoc.utils
The documentation in the Haskell sources has been updated.
2023-03-20 08:30:04 +01:00
Albert Krewinkel a37eda9713 lua-filters.md: auto-generate docs for more modules 2023-03-19 22:39:15 +01:00
Albert Krewinkel afee37abc7 Lua tests: add more tests for pandoc.mediabag. 2023-03-19 22:38:08 +01:00
Albert Krewinkel 7743c5287a Lua: add info on when functions became available in pandoc 2023-03-19 15:09:23 +01:00
Albert Krewinkel 07c56322c2 lua-filters.md: generate docs from Haskell for pandoc.structure 2023-03-19 13:35:02 +01:00
Albert Krewinkel ec1a06f5ef lua-filters.md: autogenerate parts of the Lua API docs 2023-03-19 12:33:04 +01:00
Albert Krewinkel 203a652e43 Lua: add pandoc.cli.repl function 2023-03-18 15:00:45 -07:00
Albert Krewinkel a23d14079c pandoc-cli: add a Lua REPL 2023-03-17 09:18:41 -07:00
Albert Krewinkel b5b9edf564 Lua: keep the Lua stack clean
A metatable used during initialization was not properly removed from the
stack. Likewise, accessing the CommonState from Lua previously led to
the pollution of the Lua stack with a left-over value.
2023-03-15 20:57:45 +01:00
Albert Krewinkel 0f7653cd10 Switch to hslua-2.3 2023-03-13 13:23:43 +01:00
Albert Krewinkel be6ec92608 Lua: allow to get the JSON encoding of log messages 2023-03-12 18:23:40 +01:00
Albert Krewinkel 45367cdd37 Lua: add new function pandoc.system.cputime.
The function returns the CPU time consumed by pandoc and can be used to
benchmark Lua computations.
2023-02-14 09:44:20 -08:00
Albert Krewinkel 75b5851d21 Lua: add module pandoc.json to handle JSON encoding
Closes: #8605
2023-02-11 14:53:53 -08:00
Albert Krewinkel c2827e7765 Use latest pandoc-lua-marshal release, version 0.2.1.
All major AST elements now have `__tojson` metamethods that return the
JSON representation of an element. This allows to JSON-encode these
elements with libraries that respect the `__tojson` metamethod,
including dkjson.
2023-02-11 14:53:53 -08:00