Commit Graph
14899 Commits
Author SHA1 Message Date
John MacFarlane 213913f025 Pass ReaderOptions to custom readers as second parameter. 2021-11-06 16:47:13 -07:00
John MacFarlane 822f894984 Fuller sample custom reader. 2021-11-06 16:38:12 -07:00
Albert Krewinkel 4a3b3b1ac6 Lua: add Pushable instance for ReaderOptions 2021-11-06 17:58:44 +01:00
Albert Krewinkel 6b462e5933 Lua: allow to pass custom reader options to pandoc.read
Reader options can now be passed as an optional third argument to
`pandoc.read`. The object can either be a table or a ReaderOptions value
like `PANDOC_READER_OPTIONS`. Creating new ReaderOptions objects is
possible through the new constructor `pandoc.ReaderOptions`.

Closes: #7656
2021-11-06 09:04:29 -07:00
John MacFarlane ee2f0021f9 Add interface for custom readers written in Lua. (#7671)
New module Text.Pandoc.Readers.Custom, exporting
readCustom [API change].

Users can now do `-f myreader.lua` and pandoc will treat the
script myreader.lua as a custom reader, which parses an input
string to a pandoc AST, using the pandoc module defined for
Lua filters.

A sample custom reader can be found in data/reader.lua.

Closes #7669.
2021-11-05 22:10:29 -07:00
John MacFarlane bac6ae9607 CI: remove test on ghc 8.0.2. 2021-11-05 19:13:29 -07:00
Albert Krewinkel 1fa6e53425 doc/lua-filters.md: add section on global modules, including lpeg 2021-11-05 22:38:40 +01:00
Rowan Rodrik van der MolenandRowan Rodrik van der Molen 7a70a46c03 Support for <indexterm>s when reading DocBook (#7607)
* Support for <indexterm>s when reading DocBook
* Update implementation status of `<n-ary>` tags
* Remove non-idiomatic parentheses
* More complete `<indexterm>` support, with tests

Co-authored-by: Rowan Rodrik van der Molen <rowan@ytec.nl>
2021-11-05 10:22:38 -07:00
Albert Krewinkel 5750f60442 MANUAL.txt: update table of exit codes and corresponding errors 2021-11-05 13:21:24 +01:00
Albert Krewinkel f32fe9cbd5 T.P.Error: sort errors in handleError by exit code 2021-11-05 13:21:21 +01:00
Albert Krewinkel ebdb39b3b4 Lua: display Pandoc values using their native Haskell representation 2021-11-05 13:11:02 +01:00
Albert Krewinkel d089d799e7 Lua: always load lpeg as global module 2021-11-05 09:21:50 +01:00
Albert Krewinkel a1b6bf69f2 Lua: include lpeg module (#7649)
Compiles the 'lpeg' library (Parsing Expression Grammars For Lua) into
the program.

Package maintainers may choose to rely on package dependencies to make
lpeg available, in which case they can compile the with the constraint
`lpeg +rely-on-shared-lpeg-library`.
2021-11-04 19:25:29 -07:00
John MacFarlane 0b254ea4af Allow plain to be used in raw attribute syntax. 2021-11-04 10:11:57 -07:00
Albert Krewinkel 4ea2baf814 Require latest hslua (2.0.1).
This fixes issues with

  - misleading error messages when a required function parameter is
    omitted;
  - absent properties still being listed in the output of `pairs`; and
  - alias accessing leading to errors instead of returning `nil`, e.g.
    with `(pandoc.Str '').identifier`.

Fixes: #7661
See also: #7657
2021-11-04 12:34:07 +01:00
S.P.H ebe21f3f65 Update bash_completion.tpl
- Specify local scope for highlight_styles; prevents global namespace pollution when sourcing completion from a file rather than adding `eval "$(pandoc --bash-completion)"` to .bashrc
- Add argument completion for --print-highlight-style, --eol, and --markdown-headings
2021-11-03 14:58:30 -07:00
Albert Krewinkel c256ef34b3 Lua: add missing space in "package not found" message
Closes: #7658
2021-11-03 13:36:15 +01:00
John MacFarlane fa83246d7d Markdown reader: Improve inlinesInBalancedBrackets.
This is just a small improvement in terms of performance,
but it's simpler and more direct code.

Also, we avoid parsing interparagraph spaces in balanced
brackets, as the original did.
2021-11-02 23:25:27 -07:00
John MacFarlane 3e466b9346 Allow latest tasty-bench, update changelog. 2.16.1 2021-11-02 16:21:45 -07:00
John MacFarlane 6c1ef00de5 Allow tasty-bench 0.3.x. 2021-11-02 16:21:16 -07:00
John MacFarlane d1789dda75 Bump to 2.16.1, update changelog. 2021-11-02 16:16:21 -07:00
John MacFarlane 938d557844 Docx reader: don't let first line indents trigger block quotes.
This fixes a regression introduced in pandoc 2.15 by PR #7606.
Closes #7655.
2021-11-02 14:04:38 -07:00
Albert Krewinkel 45bcd7d3f1 Lua: fix typo in SoftBreak constructor 2021-11-02 21:53:08 +01:00
Albert Krewinkel dbc654e4a7 Lua tests: ensure Inline elements have all expected properties 2021-11-02 21:40:37 +01:00
Albert Krewinkel 421fd736d4 Lua: re-add content property to Strikeout elements
Fixes a regression introduced in 2.15.
2021-11-02 21:22:59 +01:00
Albert Krewinkel cce49c5d4b Lua: be more forgiving when retrieving the Image caption property
Fixes a regression introduced in 2.15.
2021-11-02 17:40:07 +01:00
John MacFarlane 70eeeca9c7 Docx writer: use getTimestamp for modification times in reference.docx.
This ensures that when `SOURCE_DATE_EPOCH` is set, the
modification times of files taken from the reference.docx will
be set deterministically, allowing for reproducible builds.

Closes #7654.
2021-11-02 09:29:34 -07:00
Albert Krewinkel b26f950cca Lua: display Attr values using their native Haskell representation 2021-11-02 17:25:47 +01:00
Albert Krewinkel c467f0fed1 Lua: allow omitting the 2nd parameter in pandoc.Code constructor
Fixes a regression introduced in 2.15 which required users to always
specify an Attr value when constructing a Code element.
2021-11-02 17:23:24 +01:00
Albert Krewinkel 210e4c98b0 Lua: allow to compare, show Citation values
Comparisons of Citation values are performed in Haskell; values are
equal if they represent the same Haskell value. Converting a Citation
value to a string now yields its native Haskell string representation.
2021-11-02 16:49:50 +01:00
Albert Krewinkel 3a0ac52f7b Lua tests: ensure Block elements have expected properties 2021-11-02 10:23:14 +01:00
Albert Krewinkel 759aa50951 Lua: restore content property on Header elements 2021-11-01 15:43:51 +01:00
Albert Krewinkel 1c02145d93 Lua: load module pandoc.path on startup
Previously the module always had to be loaded via
`require 'pandoc.path'`.

Closes: #7524
2021-11-01 13:48:36 +01:00
Albert Krewinkel 96e76d4cd4 Lua: restore List behavior of MetaList
Fixes a regression introduced in 2.16 which had MetaList elements loose
the `pandoc.List` properties.

Fixes #7650
2021-11-01 08:27:14 +01:00
John MacFarlane 171bfd3d65 Makefile: use --nonmoving-gc RTS option when running benchmarks.
As recommended by tasty maintainers.
2.16
2021-10-31 13:17:57 -07:00
John MacFarlane 64eb59a7a0 Makefile: remove man/pandoc.1 dependency for debpkg. 2021-10-31 11:12:48 -07:00
John MacFarlane a99269eef0 Update changelog. 2021-10-31 09:58:39 -07:00
John MacFarlane d405846873 Regenerate man page. 2021-10-31 09:39:56 -07:00
Albert Krewinkel 3de8f4fdc5 Lua: re-add content property to Link elements
This was a regression introduced in version 2.15.

Fixes: #7647
2021-10-31 11:15:50 +01:00
John MacFarlane 40655b54a2 Bump to 2.16, update changelog. 2021-10-31 00:01:03 -07:00
John MacFarlane 621397f42e Allow time 1.13 2021-10-30 23:48:06 -07:00
Joseph C. Sible b3d09ebe01 Fix build on GHC 9.2 2021-10-30 11:39:20 -07:00
John MacFarlane 2894c10b28 Fix trypandoc so it builds with aeson > 2. 2021-10-29 09:50:32 -07:00
Tristan Stenner 2444cbc668 Docx writer: add IDs to native_numbering test 2021-10-29 08:40:20 -07:00
Tristan Stenner 31d6a494de Update test golden master for docx native numbering 2021-10-29 08:40:20 -07:00
Tristan Stenner 6509ff6204 Docx writer: move ": " out of the caption bookmark.
This is needed so that native references to the figure are included as
"As seen in Figure X, it is..." instead of
"As seen in [Figure: , it is..."
2021-10-29 08:40:20 -07:00
Albert Krewinkel f4d9b443d8 Lua: use hslua module abstraction where possible
This will make it easier to generate module documentation in the future.
2021-10-29 17:08:30 +02:00
Albert Krewinkel e1cf0ad1be Lua: fix placement of tests for Block elements in pandoc module tests 2021-10-28 14:10:54 +02:00
Albert Krewinkel af97598954 Lua: increase strictness when getting attribute keys 2021-10-28 10:32:00 +02:00
John MacFarlane a1e422097a Require latest skylighting (0.12.1). 2021-10-27 21:13:29 -07:00