Commit Graph
9378 Commits
Author SHA1 Message Date
TuongNM bdab9915ad OpenDocument writer: Add missing table elements (#11157)
Add missing header rows after the first one,
footer rows as well as TableBody header rows.

Also apply hlint suggestions to use Down and fuse mapM/map.

Closes #10002.
2025-09-20 21:05:29 +02:00
John MacFarlane 891e613e4a Docx writer: fix regression (3.8) in highlighted code.
We added DefaultHighlighting in commit 6475725 but didn't adjust the
pattern-match here.

Closes #11156.
2025-09-19 23:18:05 +02:00
John MacFarlane f64183fbbf Docx reader: handle figures in indented paragraphs.
Previously these were omitted.  Closes #11028.
2025-09-19 22:10:38 +02:00
John MacFarlane 643712ca70 LaTeX writer: avoid \_ in bibliography variable.
Since underscores are common in filenames, and pandoc will
render strings to variables using default LaTeX escaping, we
special-case `bibliography`, under the assumption that this variable
will be used in the context of the `\bibliography{..}` command,
which accepts unescaped underscores.

Closes #11152.
2025-09-19 10:16:25 +02:00
John MacFarlane 70393b4235 RST reader: fix regression in simple table parsing.
Closes #11150.
2025-09-18 11:52:22 +02:00
John MacFarlane 4f2a383f49 RST reader: SkippedContent warning if table directive...
containts non-tabular content.
2025-09-18 11:23:47 +02:00
John MacFarlane becb9a0a81 RST simple table fix.
Leading space in a cell should not cause the contents to
be parsed as a block quote.

Closes #11146.
2025-09-17 20:03:46 +02:00
John MacFarlane 2485c594d8 Docx reader: change default for textwidth.
This should only be used if sectPr is not found.
2025-09-17 15:45:42 +02:00
John MacFarlane d820620ccd Docx reader: properly calculate table column widths.
Previously we assumed that every table took up the full text
width. Now we read the text width from the document's
sectPr.

Closes #9837.
Closes #11147.
2025-09-17 14:24:33 +02:00
John MacFarlane e13aa5c015 LaTeX writer: ensure that unlabelled tables don't increment counter.
Closes #11141.
2025-09-16 18:01:07 +02:00
John MacFarlane cf760c7f66 Markdown reader: Improve superscript/subscript/inline note parsing.
We do not allow inline notes to be followed by `(` or `[`.
Otherwise, we parse inline notes before superscripts.
This fixes #8652.

Also, the sub/superscript parsers have been adjusted so that they
really exclude unescaped spaces (as they did not before, when the
spaces occurred in nested inlines). See #5878 for comment.
2025-09-16 12:46:25 +02:00
John MacFarlane c3a5513eed Markdown reader: refactor out litBetween. 2025-09-16 12:46:25 +02:00
reptee a0cfb3fd31 Vimdoc writer (#11132)
Support for vimdoc, documentation format used by vim in its help pages.
Relies heavily on definition lists and precise text alignment to generate tags.
2025-09-15 12:45:28 +02:00
John MacFarlane 1f3163a638 LaTeX reader: ignore \pandocbounded.
Third issue in #11140.
2025-09-15 10:50:04 +02:00
John MacFarlane f7059959ed Markdown writer: improve handling of implicit figures.
Allow implicit figures when alt text differs from caption
(in this case, we use an image attribute to add the alt).

Closes #11140.
2025-09-15 10:50:04 +02:00
John MacFarlane 9c36d884d5 RST reader: parse :alt: on figure.
Also give a better default if `alt` is not specified, using
the stringified caption rather than the filename.

Partially addresses #11140.

Add failing test case for Markdown writer issue in #11140.
2025-09-15 10:50:04 +02:00
TuongNM e2f088f4e5 LaTeX writer: Protect VERB in caption (#11139)
Also apply hlint suggestions for fewer imports and
moving brackets to avoid $.
2025-09-15 10:28:57 +02:00
massifrg 4be17f77b7 xml reader: parse MetaString (#11137)
`<MetaString>` contents parsing was missing.
2025-09-13 17:33:48 +02:00
TuongNM 5eb25ab448 Markdown reader: Fix simple table alignment (#11136)
Take wide characters into account when determining the alignment.
2025-09-12 11:44:34 +02:00
Raymond Berger c93acab035 Add support for reading typst pagebreak (#11126)
The pagebreak is parsed as a HorizontalRule inside a wrapper Div with class `page-break`.

Closes #11101.
2025-09-10 09:56:16 +02:00
John MacFarlane 71a0c5c61e Markdown writer: use approximate pipe tables when it's the only option.
If we have a table with row/colspans that can rendered as an
approximate pipe table (without row/colspans), and no other table
format is enabled that could render the table, we fall back to
an "approximate" pipe table, with no row/colspans.

Closes #11128.
2025-09-10 09:49:06 +02:00
John MacFarlane 3a2aab568d Markdown writer: refactor table cases. 2025-09-10 09:39:51 +02:00
Albert Krewinkel 4b126bd90b PandocMonad: Let fetching fail if the HTTP request is not successful.
HTTP requests that don't return a 200 error code are now treated as an
error. This ensures that a warning is triggered when using
`--embed-resources` or `--extract-media`.
2025-09-09 10:51:04 +02:00
Tuong Nguyen Manh 47e1cc46c6 RST Reader: Add col spans for simple tables
[API change] Text.Pandoc.Parsing: New functions `tableWithSpans`,
`tableWithSpans'`, `toTableComponentsWithSpans` and
`toTableComponentsWithSpans'` take a list of lists of
(Blocks, RowSpan, ColSpan) to parse a Table with different RowSpan and
ColSpan values accordingly.
New helper functions `singleRowSpans` and `singleColumnSpans` help set
all RowSpans or ColSpans to be 1 in case the table format only allows
setting one or the other.
2025-09-09 10:27:18 +02:00
Albert Krewinkel ff12c20f20 LaTeX writer: Don't add links to TOC.
Fixes: #11124
2025-09-09 10:26:05 +02:00
Albert Krewinkel 36bbdc667a T.P.Writers.Shared: add new function removeLinks.
The function converts links to spans. It is used, for example, to avoid
nested links.

The HTML writer used to put the description of nested links into small
caps, but uses a simple *span* now.
2025-09-09 10:26:05 +02:00
Tuong Nguyen Manh 6ba552232a pptx writer: Handle single column
Add an additional guard for a single column to be able to process it.
2025-09-08 09:22:56 +02:00
John MacFarlane 8aa665a33d Citeproc: put bibliography in a div with id .*__refs
as well as `refs`.  Reason: when `--file-scope` is used, a Div
with id `refs` gets a prefix attached, derived from the filename.
The prefix ends in `__`.

Closes #11072.
2025-09-06 19:54:00 +02:00
John MacFarlane f4eb08e37a Fix spacing errors. 2025-09-06 17:48:09 +02:00
John MacFarlane 536d548335 Docx reader: better handling of AlternateContent.
This revises the solution to #9214 in commit 2e8ecb3 in order to
handle a standard Word way of inserting emojis.

Closes #11113.
2025-09-06 10:48:22 +02:00
John MacFarlane 1e7138823b Partially undo commit 2e8ecb3.
This was too heavy-handed a fix, and it interferes with processing
Word emojis (#11109).
2025-09-06 10:48:22 +02:00
John MacFarlane 226f765e76 Revision of query/fragment dropping fix to #11021. 2025-09-04 13:32:05 +02:00
John MacFarlane 037a6e81e2 T.P.Citeproc.BibTeX: Protect case in periodical titles.
Thus, for example, `{npj} Quantum Information` should translate as
`[npj]{.nocase} Quantum Information`.

Closes #11048.
2025-09-03 12:56:58 +02:00
John MacFarlane 6727d2d177 T.P.SelfContained: try fetching relative resources...
...without query or fragment if the original fetch fails.

This provides a fix for #1477 in a way that doesn't raise the
problems mentioned in #11021.
2025-09-03 09:39:27 +02:00
Albert Krewinkel e0acb24528 Refactor highlighting options [API Change]
A new command line option `--syntax-highlighting` is provided; it takes
the values `none`, `default`, `idiomatic`, a style name, or a path to a
theme file. It replaces the `--no-highlighting`, `--highlighting-style`,
and `--listings` options.

The `writerListings` and `writerHighlightStyle` fields of the
`WriterOptions` type are replaced with `writerHighlightStyle`.

Closes: #10525
2025-09-02 17:50:47 +02:00
Albert Krewinkel 64757254ab T.P.Options: add type HighlightMethod and patterns [API Change]
The Text.Pandoc.Options module exports the `HighlightMethod` data type
and it's constructors. Furthermore, three pattern synonyms are exported,
`NoHighlightingString`, `DefaultHighlightingString`, and
`IdiomaticHighlightingString`, which hold the string value that's used
for decoding and encoding of HighlightMethod values.
2025-09-02 17:50:47 +02:00
Albert Krewinkel 3a298067ae T.P.Highlighting: export defaultStyle [API Change]
This allows to be more explicit about using a default style, and
providing a single point of truth for its value. The variable is an
alias for `pygments`.
2025-09-02 17:50:47 +02:00
TuongNM 3e2c029a77 RST Reader: Support multiple header rows (#11057)
[API change] Text.Pandoc.Parsing: `tableWith` and `tableWith'` now
return a list of lists of Blocks, rather than a list of Blocks, for the
header rows, allowing for multiple header rows.

Closes #10338.
2025-09-02 13:12:34 +02:00
John MacFarlane 3551e21206 makePDF: automatically embed resources from media bag in HTML...
before trying to convert it with weasyprint, etc. This will give
better results when converting from formats like .docx.

Closes #11099.
2025-09-02 09:08:47 +02:00
John MacFarlane 4d545b69fe Change latex-pos to latex-placement. 2025-09-02 08:39:47 +02:00
Sean Soon 5424d3eca0 LaTeX writer: control figure placement with attribute (#11094)
If a `latex-pos` attribute is present on a figure, it will be used as the
optional positioning hint in LaTeX (e.g. `ht`).

With implicit figures, `latex-pos` will be added to the figure (and
removed from the image)  if it is present on the image.

Closes #10369.
2025-09-01 20:41:14 +02:00
John MacFarlane 8d7aed2355 Typst reader: fix addition of image path prefix to use posix separator. 2025-08-30 10:58:19 +02:00
John MacFarlane f865b3bc4b Typst reader: properly resolve image paths in included files.
Closes #11090.
2025-08-30 00:04:23 +02:00
Repetitive 729c12394c fix: recognize binary signatures and fail early
Fail early when receiving binary input with recognized signature:
- zip[-based]: including OpenDocument and Microsoft formats
- PDF
- CFBF-based: old Microsoft formats including .doc and .xls
- DjVu
2025-08-28 21:15:36 +02:00
John MacFarlane 1bf2564b5c Raise unknown reader error for ods, odp, odf, xls, xslx, zip extensions 2025-08-27 14:27:01 +02:00
John MacFarlane 73b5908825 Add TODO comment. 2025-08-27 13:26:33 +02:00
John MacFarlane 27851bbe9d LaTeX writer: include cancel package only if needed.
That is, only if there is math that contains `\cancel`,
`\bcancel`, or `\xcancel`.
2025-08-27 13:09:07 +02:00
Albert Krewinkel 01721c0960 Org reader: improve sub- and superscript parsing.
Sub- and superscript must be preceded by a string in Org mode. Some text
preceded by space or at the start of a paragraph was previously parsed
incorrectly as sub- or superscript.
2025-08-27 13:03:46 +02:00
John MacFarlane 6cff8dfc8a HTML reader: don't drop the initial newline in a pre element.
Closes #11064.
2025-08-26 18:57:14 +02:00
Tuong Nguyen Manh 01f97ed55d Typst Writer: Check XID_Continue in identifiers
Add unicode-data dependency for isXIDContinue for this to match the
rust implementation.
Also apply hlint suggestions for redundant $, literal pattern and
moving brackets to avoid $.
2025-08-26 18:25:08 +02:00