Commit graph

14927 commits

Author SHA1 Message Date
Albert Krewinkel
cd91f72843
Lua: set lpeg, re as globals; allow shared lib access via require
The `lpeg` and `re` modules are loaded into globals of the respective
name, but they are not necessarily registered as loaded packages. This
ensures that

- the built-in library versions are preferred when setting the globals,
- a shared library is used if pandoc has been compiled without `lpeg`,
  and
- the `require` mechanism can be used to load the shared library if
  available, falling back to the internal version if possible and
  necessary.
2021-11-17 10:03:04 +01:00
John MacFarlane
3ac7deadce Use latest dev texmath. 2021-11-16 21:47:27 -08:00
Albert Krewinkel
305a4f406d
Lua: make loading of global LPeg modules more robust
Ignore errors if the normal package mechanism failed; this not only
covers the case of modules being unavailable on the system, but also
works if the modules are present, but fail to load for some reason.

This makes the built-in package version a true fallback.
2021-11-16 12:06:22 +01:00
John MacFarlane
c19f063420 Markdown writer: don't create autolinks when this loses information.
Previously we sometimes lost attributes when rendering links as autolinks.

Closes #7692.
2021-11-15 11:06:50 -08:00
Albert Krewinkel
ea268fd8a7
LaTeX reader: add rudimentary support for \autoref (#7693) 2021-11-15 09:40:50 -08:00
John MacFarlane
946b959751 Fix misspelled extension name in manual.
`short_subsuperscript` -> `short_subsuperscripts`.
Closes #7690.
2021-11-14 20:55:39 -08:00
Albert Krewinkel
96a01451ef
JATS writer: ensure figures are wrapped with <p> in list items.
This prevents the generation of invalid output.
2021-11-12 13:29:08 +01:00
Albert Krewinkel
da96e1ff40
JATS writer: add URL to element citation entries
The URL of a reference, if present, is added in tag `<uri>` to
element-citation entries.
2021-11-12 11:56:58 +01:00
Christian Despres
abdfefebdf
Writers.Shared: Improve toLegacyTable.
Closes #7683.
(PR #7684)
2021-11-11 20:55:37 -08:00
Albert Krewinkel
ebf7f782d3 Lua: load re module available into global of the same name 2021-11-11 10:32:37 -08:00
Albert Krewinkel
fe113dd5fa
JATS template: fix incomplete previous commit 2021-11-11 09:44:49 +01:00
Albert Krewinkel
b116022de4
JATS template: fix equal-contrib attribute
The standard requires the value to be either `yes` or `no`, but is was
set to `true` for authors who contributed equally.
2021-11-11 09:38:07 +01:00
John MacFarlane
4e50706924 Remove unneeded package dependencies from benchmark target. 2021-11-10 09:46:47 -08:00
John MacFarlane
6fb2973a58 Fix parsing of % in bibtex fields.
Closes #7678 (a bug introduced by 0a45f26).
2021-11-10 08:52:04 -08:00
John MacFarlane
03f9a0c61e Require ghc >= 8.6, base >= 4.12.
This allows us to get rid of the old custom prelude and
some crufty cpp.  But the primary reason for this is that
conduit has bumped its base lower bound to 4.12, making it
impossible for us to support lower base versions.
2021-11-09 23:43:12 -08:00
John MacFarlane
6bec746074 cabal.project: Require transformers >= 0.5.6.
For some reason the CI build is trying to use an older version.
2021-11-09 23:09:43 -08:00
John MacFarlane
09748669b0 Require Cabal 2.4. Use wildcards...
...to ensure that all pptx tests are included.

Closes #7677.
2021-11-09 22:56:31 -08:00
John MacFarlane
5fb3b82bdf Accept empty --metadata-file.
Closes #7675. This is a regression from 2.15 behavior.
2021-11-09 12:59:26 -08:00
Albert Krewinkel
d4c73d5e65
Lua: fix argument order in constructor pandoc.Cite.
This restores the old behavior; argument order had been switched
accidentally in pandoc 2.15.
2021-11-09 14:45:36 +01:00
John MacFarlane
9c153e3d6e With -t latex-smart, don't generate \ldots from ellipsis.
Instead just use unicode ellipsis.
Closes #7674.
2021-11-08 11:59:13 -08:00
John MacFarlane
0a45f2600a Properly handle commented lines in BibTeX/BibLaTeX.
Closes #7668.
2021-11-08 10:15:53 -08:00
John MacFarlane
60233cf07e Remove some extra stuff from data/creole.lua. 2021-11-08 08:13:31 -08:00
Rowan Rodrik van der Molen
40aa74badc Add <titleabbr> support to DocBook reader 2021-11-08 07:30:20 -08:00
Christophe Dervieux
19eb5c6d6a Add disableLayout variable in revealjs template
This allows to modify it using Pandoc variable. Default value is correctly set to false by Pandoc.
2021-11-08 07:28:18 -08:00
Albert Krewinkel
327bdd66b6
stack.yaml: require latest lpeg 2021-11-08 16:04:10 +01:00
Albert Krewinkel
ab0fe676a8
Lua: ensure that 're' module is always available.
The module is shipped with LPeg.
2021-11-08 12:22:33 +01:00
John MacFarlane
cc46667953 LaTeX reader: add 'uri' class when parsing \url.
Closes #7672.
2021-11-07 21:08:20 -08:00
John MacFarlane
881b45209e Replace old sample custom reader with a full-featured reader for creole.
This is better as an example.  And it is faster than pandoc's
regular creole parser, which shows that high-performance readers
can be developed this way.
2021-11-07 14:34:56 -08:00
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 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. 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