Commit Graph
17488 Commits
Author SHA1 Message Date
Albert Krewinkel 2cc9defda4 Lua: split Init module into more modules.
The module has grown unwieldy and is therefore split into three internal
Haskell modules, `Init`, `Module`, and `Run`.
2024-06-09 16:10:38 +02:00
John MacFarlane 684668db1e Fix --toc-depth with beamer output.
Previously only top-level sections were ever included in the TOC,
regardless of the setting of `--toc-depth`.

Closes #9861.
2024-06-08 17:35:00 -07:00
Albert KrewinkelandCarsten Gips 9af5b1ca8b Lua: add function pandoc.template.get.
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>
2024-06-08 08:42:47 -07:00
Albert Krewinkel 11a2f78cda PandocMonad: convert IOErrors to warnings when fetching absolute paths (#9859) 2024-06-08 08:40:42 -07:00
Albert Krewinkel 7db19d8cd4 Update more copyright dates to 2024. 2024-06-08 16:46:42 +02:00
Albert Krewinkel c290ffbaff Fix misplaced span. 2024-06-08 14:48:15 +02:00
Albert Krewinkel 6a88abae3d Lua: keep CommonState object in the registry
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.
2024-06-08 14:39:58 +02:00
Albert Krewinkel d50bd30324 Lua: add tests for PANDOC_STATE global 2024-06-08 14:39:58 +02:00
Albert Krewinkel 6f98149516 Fix "unused variable" warning. 2024-06-08 14:39:57 +02:00
John MacFarlane a6427fc95d MANUAL: fixed links to option--reference-doc. 2024-06-07 16:13:02 -07:00
John MacFarlane a0ba712b70 Textile writer: get rid of header, odd, even classes on tr.
This follows #9376.
2024-06-07 14:22:50 -07:00
John MacFarlane b4b0a6d61b Fixes to #9376. 2024-06-07 14:16:38 -07:00
ThomasSoeiro cd15313216 Don't emit unnecessary classes in HTML tables (#9376)
Pandoc used to emit a `header` class on the `tr` element that forms the table header. This is no longer needed, because `head > tr` will do the same thing.

Similarly, pandoc used to emit `even` and `odd` classes on `tr`s, allowing striped styling.  This is no longer needed, because one can use e.g. `tbody tr:nth-child(2n)`.

We now omit these classes, which have a good chance of conflicting with classes used for other things.

Closes #9325.
2024-06-07 12:15:40 -07:00
Albert Krewinkel bfb0475d67 doc/lua-filters: autogenerate docs for module pandoc.template 2024-06-07 20:36:29 +02:00
Albert Krewinkel 430d525378 Lua: allow passing an environment to run_lua_filter.
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.
2024-06-07 08:36:24 +02:00
John MacFarlane 3d6a4d870a Fix warning. 2024-06-04 17:16:38 -07:00
John MacFarlane 0698eb4a8b LaTeX writer: task lists must be unordered.
Closes #9185.
2024-06-04 17:11:03 -07:00
John MacFarlane 3952d4d1a2 Docx reader: support task lists.
This also fixes a small bug in parsing delimiters in numbered lists,
which led to the default delimiter being used wrongly in some cases.

Closes #8211.
2024-06-04 15:17:43 -07:00
John MacFarlane e71f171fe2 T.P.Writers.Shared: export toTaskListItem instead of isTaskList.
This is more useful.  Use this in OpenXML and HTML writers.
2024-06-04 11:45:04 -07:00
John MacFarlane 75afa7829b T.P.Readers.Docx.Lists: replace a generic traversal...
using `bottomUp` with a faster one using `walk`.
2024-06-04 10:22:38 -07:00
John MacFarlane f5531f18a5 Docx writer: better formatting for task lists.
Task lists are now properly formatted, with no bullet.

In addition, we have removed an expensive generic traverse to
remove Space elements, and replaced it with code in
`inlinesToOpenXML`.  This should give better performance; it
also reduces XML size in the metadata, which wasn't previously
affected by the de-Spacing.

TODO: parse this in the reader so that we can have task lists round-trip.

Closes #5198.
2024-06-04 10:03:26 -07:00
John MacFarlane c4f530fac8 T.P.Writers.Shared: export isTaskList.
[API change]

This function used to be in T.P.Writers.HTML.
2024-06-04 09:12:36 -07:00
John MacFarlane d43a92ebdc Use latest dev citeproc. 2024-06-03 11:02:16 -07:00
Carlos Scheidegger 347985fb83 typst,table - support '.typst:no-figure' and 'typst:figure:kind=kind' (#9778)
This extends support for fine-grained properties in Typst.

If the `typst:no-figure` class is present on a Table, the table will not be placed in a figure.

If the `typst:figure:kind` attribute is present, its value will be used for the figure's `kind`.

These features are documented in `doc/typst-property-output.md`.

Closes #9777.
2024-06-03 09:52:53 -07:00
John MacFarlane b9491ccbbc Support supplementary-material in metadata for jats_articlepublishing.
See #9818.
2024-06-03 09:37:35 -07:00
John MacFarlane 39c549caad Docx writer: omit jc attribute on table cells with AlignDefault.
Closes #5662.
2024-06-01 22:31:03 -07:00
John MacFarlane 1992913ba5 Docx reader: react to "left" value on jc attribute.
Also fix tests.
2024-06-01 21:02:11 -07:00
John MacFarlane 3dfac974d0 Docx reader: handle column and cell alignments.
OpenXML doesn't have a way of indicating column alignments, but
we guess them by looking at the justification property on the
first paragraph of a cell, if there is one.

We take the column alignments from the first body row.

Closes #8551.
2024-06-01 20:01:48 -07:00
John MacFarlane 9a7fd6e7bf Docx reader: allow insertion/deletion to contain arbitrary ParParts...
...and not just Runs.  This fixes a problem wherein comments
inside insertions or deletions would be ignored. Closes #9833.
2024-06-01 17:34:36 -07:00
John MacFarlane aeb84b5d13 Fix command test #6285 for Windows. 2024-06-01 16:21:39 -07:00
Albert Krewinkel 83de55bb35 Lua: Set pandoc.List as default metatable for JSON lists
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
2024-06-01 21:10:29 +02:00
John MacFarlane 075ed1052f Support HorizontalRule in docx reader.
We support both pandoc-style and the style described at
https://support.microsoft.com/en-us/office/insert-a-horizontal-line-9bf172f6-5908-4791-9bb9-2c952197b1a9

Closes #6285.
2024-06-01 11:00:37 -07:00
John MacFarlane f7fcb5c470 T.P.Readers.Docx.Parse: add HRule constructor to BodyPart.
This paves the way to supporting horizontal rules in the reader.
We still need to adjust the parser to create HRule appropriately;
so far, this change has no effect, but it's a step on the way
to #6285.
2024-06-01 10:14:46 -07:00
John MacFarlane 7e7735bb6b Use \linewidth instead of \columnwidth or \textwidth...
for resizing figures, table cells, etc. in LaTeX.  `\linewidth`,
unlike the others, is sensitive to indented environments like
lists.

Closes #9775.
2024-05-31 15:03:06 -06:00
John MacFarlane f98f3b141d Use latest dev version of citeproc. 2024-05-31 13:03:55 -06:00
John MacFarlane a057d409c4 Update stack.yaml to use dev dependencies for typst, djot. 2024-05-31 10:49:42 -06:00
John MacFarlane 872d7bcd28 Fix metadata in docx writer.
The new OpenXML template had spaces for metadata that need
to be filled with OpenXML fragments with the proper shape.
This patch ensures that everything is the right shape.

Closes #9828.
2024-05-31 10:43:24 -06:00
John MacFarlane 439e586bc7 Use dev version of djoths. 2024-05-31 09:38:34 -06:00
John MacFarlane 7abfec3d2c Fix typo in fix to template.typst. 2024-05-30 18:24:52 -06:00
John MacFarlane 0e92d9483c Typst template: use content rather than string...
...for title, author, date, email.

Fixes #9823 (escaped `\@` in rendered email).
Allows formatting in title, author, date, and email fields.
Since the PDF metadata requires a string, and typst only
converts the title to a string (not the authors), we use
a small function content-to-string to do this conversion.
Background: https://github.com/typst/typst/issues/2196
2024-05-30 12:00:48 -06:00
John MacFarlane 441ef31b9e Update context writer tests for template change. 2024-05-30 11:35:47 -06:00
John MacFarlane 61bc9a0c47 ConTeXt template: remove \setupbackend[export=yes].
This doesn't seem necessary for what we're doing, and it causes a
crash due to a bug in ConTeXt.  Closes #9820.
2024-05-30 09:38:35 -06:00
Ian Max Andolina 874ae2e5b1 Update MANUAL.txt to fix alerts example (#9826)
There is no [!INFO] alert and Pandoc does not trigger the alerts syntax if you try to use it, replace it with [!TIP] which does exist and does work.
2024-05-30 08:59:38 -06:00
John MacFarlane c19b44b071 Docx writer: wrap figures with id in a bookmark.
Closes #8862.
2024-05-29 16:08:24 -06:00
John MacFarlane a6c3945000 Docx writer: add eastAsia font hints to w:r.
We do this when the text in the run contains any CJK characters.
This ensures that ambiguous code points (e.g. quotation marks)
will be represented as "wide" characters when together with CJK
characters.

Closes #9817.
2024-05-29 15:38:34 -06:00
John MacFarlane 2f1f066759 Add unexported module Text.Pandoc.Char.
This exports `isCJK`.  Use this instead of locally defined
`isCJK` in T.P.Readers.MediaWiki.
2024-05-29 15:03:16 -06:00
John MacFarlane 29fa97ab96 HTML reader: better handle non-li elements in ul and ol.
For example, a `p` after a closed `li` will be incorporated into
the previous `li`. This mirrors what browsers do with this
invalid HTML.

Closes #9809.
2024-05-28 08:44:46 -07:00
Albert Krewinkel 04dba0d771 Lua: fix typo in run_lua_filter
Fixes previous commit ad68ff34ae.
2024-05-28 13:46:18 +02:00
John MacFarlane 372cd1d3b1 Typst reader: handle inline bodies ending in a parbreak.
E.g. `#strong[
test
]`.  Here we simply skip the final parbreak.

Treat this as a soft break, which will give results similar
to the typst app.
2024-05-27 19:46:08 -07:00
John MacFarlane 2e1f17a09f Typst reader: fix an incomplete pattern match.
See #9807.
2024-05-27 14:53:22 -07:00