Commit Graph
19741 Commits
Author SHA1 Message Date
Nacho García 83840a6760 Pptx reader: read merged table cells as spans.
Merged cells in a table were ignored: a merged cell's text stayed in
its first cell, and every cell it covered was read as an empty cell of
its own.

A cell's `gridSpan` and `rowSpan` now become its column and row span,
and the cells it covers (`hMerge`, `vMerge`) are left out. As a cell
can't span the header row and the body, a span from the header row is
kept to that row; the body cells it covered become empty cells. Row
spans are clipped to the rows there are.

The test fixture was written with python-pptx 1.0.2.
2026-11-03 07:34:39 -08:00
Nacho García 9ececd548b Pptx reader: mark hidden slides.
Slides hidden from the slide show (`show="0"` on `p:sld`) were read
like any other, with nothing to tell them apart. They are still read,
now with the class `hidden` on their header.

The MANUAL now says how slides are read: a level-2 heading with the
identifier `slide-N`, then the slide's content.

The test fixture was written with python-pptx 1.0.2.

Discussed in #12023.
2026-11-02 14:12:51 -08:00
John MacFarlane df2954da96 CI: cache ghc. 2026-11-02 07:46:18 -08:00
John MacFarlaneandClaude Opus 5.5 50e5c0791a CI: rework caching so it can be shared between workflows. (#12049)
Key caches on a hash of the dependency plan, computed by a new composite
action, so that CI, nightly, and release candidate builds use the same
cabal store.  Use the same cabal version everywhere and pass
`--enable-tests`, since both affect the unit ids of dependencies.
Nightly now uses cabal build and list-bin, because cabal install
doesn't accept `--enable-tests`.

Save caches only on pushes to main.  Replace secrets.CACHE_VERSION,
which is empty in PRs from forks, so that those PRs restore main's
caches instead of rebuilding and saving their own.

Pass --enable-tests to cabal test on Linux, so that it doesn't
recompile everything compiled by cabal build.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 17:46:22 -08:00
Nacho García b4af943b0b Xlsx reader: render numbers as Excel's General format.
Numbers were rendered with Haskell's `show`: 0.05 became 5.0e-2,
12345678 became 1.2345678e7, 21 became 21.0, and floating-point noise
showed (0.30000000000000004). Booleans became 1.0 and 0.0.

Numbers are now rendered as Excel's General format renders them, except
that they aren't rounded to fit a column: at most 15 significant digits
(Excel's precision) and no trailing zeros. Numbers with 12 or more
digits before the decimal point use scientific notation, as General
does, but keep all their digits (1.23456789012E+11); so do numbers
below 1e-9. Booleans read as TRUE and FALSE.

Cells with another number format (dates, percentages, fixed decimals)
are still rendered this way.

The test fixture was written part by part with a Python script.

Discussed in #12023.
2026-11-01 12:17:18 -08:00
Nacho García 68c8a8522d Xlsx reader: render dates and times.
Number formats were ignored, so a date came out as its serial number
(45231.0 rather than 2023-11-01).

The reader now reads the custom number formats (`numFmts`) and each
cell format's `numFmtId`. A number in a cell whose format shows a date
or time is rendered as an ISO 8601 date (2023-11-01), a time (14:30, or
14:30:05 if the format shows seconds), or both, joined by a space. The
formats recognised are the built-in ones (14-22, 45 and 47) and custom
ones whose first section has a date or time token (y, m, d, h, s)
outside quoted text, escapes and brackets. The workbook's 1904 date
system is honoured, as is the 1900 system's nonexistent 29 February
1900.

Durations, such as built-in format 46 (`[h]:mm:ss`) or a custom `[h]:mm`,
are left as numbers, as are negative numbers and day 0 under a format
that shows the date.

The test fixtures were written part by part with a Python script.

Discussed in #12023.
2026-11-01 09:57:14 -08:00
John MacFarlane dbaaac1e2e Add tools/usedev.sh.
This is a script to streamline something we do frequently
in developing.

Produced by Claude Opus 5.5.
2026-11-01 09:47:12 -08:00
Nacho García fb12302b7f Xlsx reader: look up a cell's font through its cell format. (#12033)
A cell's style index (`s`) refers to a cell format in `cellXfs`, which
refers to a font by `fontId`. The reader used the style index as a font
index directly, so cells got another cell format's bold and italic. In
80 test workbooks, a fifth of the non-empty cells had the wrong
emphasis.

Fonts are now looked up through the cell format.

The test fixture was written part by part with a Python script. Its
cell formats point at the fonts out of order.
2026-11-01 09:26:18 -08:00
John MacFarlane 8d170b62cf Add emph flip-flopping to HTML style template.
So, emph within emph renders as upright, etc.

This was already in the default EPUB CSS.
2026-11-01 09:18:21 -08:00
John MacFarlane 42c5ba2038 Docx writer: implement flip-flopping for emph.
Emph within emph becomes upright.  This is important for correct
formatting of titles in CSL, among other things.  LaTeX does this
automatically, and in HTML we achieve it via CSS.

Closes #11961.
2026-11-01 09:10:12 -08:00
John MacFarlane fe8e5021f4 Docx.Types: EnvProps - use Set instead of list for properties.
(These don't repeat.)
2026-10-31 23:17:48 -07:00
John MacFarlane dd947c43a7 Use latest dev typst-hs 2026-10-31 22:41:58 -07:00
John MacFarlane 5d4c0abffb Use latest dev typst-hs. 2026-10-31 16:50:03 -07:00
John MacFarlane 06f84eccd9 Add check-sdist to CI. 2026-10-31 11:27:32 -07:00
John MacFarlane db21bcf06d Makefile: reorganize check-cabal.
Add check-sdist target we can run separately.
2026-10-31 11:25:22 -07:00
John MacFarlane d80975704a make check-cabal: exit with error status on outdated deps. 2026-10-31 11:17:55 -07:00
John MacFarlane 1b2ef641b3 Add pull request template. 2026-10-31 10:49:11 -07:00
Nacho García d24f39568b Xlsx reader: read inline strings, and rich text as written. (#12019)
Cells of type `inlineStr` keep their text in an `is` element rather
than in `v`, so they were read as empty and dropped. openpyxl writes
every string this way.

Rich-text shared strings were read by joining the text of all their
descendants with spaces. A run boundary inside a word or before
punctuation added a space ("Hel lo", "< 100T"), and phonetic runs
(`rPh`) leaked into the text.

Both now take the text of their `t`, or of their runs' `t`,
concatenated as written, skipping phonetic runs.

The test fixture was written part by part with a Python script.

Closes #12014.
2026-10-29 21:34:17 -07:00
Nacho García 1b31dce55d Xlsx reader: resolve package-absolute relationship targets. (#12018)
Relationship targets were turned into archive paths by prefixing
`xl/`. OPC also allows targets relative to the package root, starting
with `/`, and openpyxl (and so pandas) writes worksheet targets that
way, so every workbook they write failed with "Entry not found:
xl//xl/worksheets/sheet1.xml". A root relationship to
`/xl/workbook.xml` failed the same way.

Targets are now resolved as OPC specifies: a target starting with `/`
from the package root, any other relative to the folder of the part
that holds the relationship. This applies to the workbook, worksheets,
shared strings and styles.

The test fixture was written part by part with a Python script, using
absolute targets throughout.

Closes #12013.
2026-10-29 21:30:37 -07:00
Nacho García 53c59fe1ab Pptx reader: read the shapes inside group shapes. (#12022)
Only the top-level children of a slide's shape tree were parsed, so
everything inside a group shape (`p:grpSp`) was dropped silently: text
boxes, pictures and tables. Groups, including nested ones, are now
replaced by the shapes they contain, in document order.

The test fixture was written with python-pptx 1.0.2.

Closes #12017.
2026-10-29 21:26:17 -07:00
Nacho García 5fee311c6a Pptx reader: don't add spaces between text runs. (#12021)
The text of a paragraph was built by joining all its `a:t` elements
with spaces. A run boundary can fall anywhere, often inside a word or
before punctuation, so "Ever|worker" read as "Ever worker" and
"openai|, anthropic" as "openai , anthropic". Line breaks (`a:br`)
were dropped, and each paragraph went into a single Str.

Runs and fields are now concatenated as written, `a:br` becomes a
LineBreak, and the text is split into Str and Space with the builder.
Slide titles, table cells and SmartArt nodes, which are built from the
same text, get the same treatment; their paragraphs are still joined
with a space.

The helpers live in Text.Pandoc.Readers.OOXML.Shared, as SmartArt
can't import from Shapes.

The test fixture was written with python-pptx 1.0.2.

Closes #12016.
2026-10-29 21:24:37 -07:00
Alain LesageandAlain Lesage 75ebbfa7c8 PDF via LaTeX: do at most 3 runs when only a TOC is present. (#12012)
Since #10308, the presence of a .toc file forced a rerun after every
run, so documents with a TOC always got the maximum of 4 runs, while
the comment (and #10308) only require 3.

Co-authored-by: Alain Lesage <15161099+Alain-L@users.noreply.github.com>
2026-10-29 12:44:34 -07:00
Caio Vinícius 6cb2494cb8 Docx reader: merge adjacent styled code blocks (#11977)
Without `+styles`, consecutive "Source Code" paragraphs are combined
into a single code block by `combineBlocks`. With `+styles`, each
paragraph is first wrapped in a `Div` carrying its `custom-style`
attribute, so the `CodeBlock` case no longer matched and every line
became its own `Div [CodeBlock]`.

Add a case that merges adjacent `Div [CodeBlock]` blocks when both the
`Div` and the `CodeBlock` attributes are equal.

Closes #9183.
2026-10-29 12:43:19 -07:00
Jeremy Levartovsky 8605c4aa6e ipynb: make ANSI escape stripping linear. (#12007)
filterIpynbOutput stripped ANSI escapes from output code blocks by
rebuilding the text one character at a time with T.cons, so time was
quadratic in the length of the output. A notebook with one 32,000-line
stream output took 4.3 s to convert to HTML; the notebooks attached to
#7744 took 42 s. Split at each ESC [ with T.breakOn and join the pieces
once instead. Output is unchanged.

Add test/command/7744.md, since nothing tested the stripping itself.

Closes #7744.
2026-10-28 11:46:04 -07:00
John MacFarlane 0a54cf2c3b Fix stack.yaml. 2026-10-28 10:17:13 -07:00
John MacFarlane c5f88a0505 Use dev commonmark-hs. 2026-10-28 09:54:04 -07:00
John MacFarlane 27c23e1481 Makefile: remove default CABALOPTS.
These can be put in cabal.project.local.
This will ensure that the same options are used by HLS,
so that rebuilds aren't needed.

An alternative approach would be to use a different build
directory (dist-newstyle) for the unoptimized make build target.
2026-10-28 08:34:41 -07:00
Alain LesageandAlain Lesage 60725b8673 EPUB writer: skip dates that cannot be normalized. (#12002)
Such dates produced an empty dc:date, which epubcheck rejects.
They are now dropped; if no date remains, the current time is used,
as when no date is given.

Co-authored-by: Alain Lesage <15161099+Alain-L@users.noreply.github.com>
2026-10-27 20:20:02 -07:00
Alain LesageandAlain Lesage d4c1c4784f EPUB writer: fix id clash with added title header. (#12003)
When content precedes the first level-1 header, a header with the
title is added. Its generated identifier could duplicate an existing
header's, so the TOC and internal links pointed to the wrong chapter.

Co-authored-by: Alain Lesage <15161099+Alain-L@users.noreply.github.com>
2026-10-27 20:18:05 -07:00
John MacFarlaneandClaude Opus 5.5 dd7fc4a0be Reset sourcepos when parsing footnotes and grid table cells.
Extends the fix for #11888 (c8c68ec0a) to footnote definitions in
the Markdown reader and to grid table cells.  Otherwise, when one of
these ends a file, relative paths in it can be rebased against the
next file on the command line.

Closes #12001.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 20:14:24 -07:00
John MacFarlane 52faab9654 Nightly: use macos-15 instead of macos-26.
Hopefully this will fix the build failure.

Cf. actions/runner-images#14940 and haskell/cabal#12468
2026-10-27 09:54:34 -07:00
John MacFarlane e8b83b9ffe Revert "Nightly: use default Xcode's toolchain and SDK on macOS."
This reverts commit c56e34f5ad.
2026-10-26 14:47:55 -07:00
John MacFarlane d2dd5e69b2 Fix release checklist template pandoc.wasm upload instruction. 2026-10-26 14:20:16 -07:00
John MacFarlane b5a77d9d01 Makefile: Fix release-templates target so it pushes tags. 2026-10-26 14:06:29 -07:00
John MacFarlane 30b1354684 Update flake.lock. 3.13 pandoc-lua-engine-0.5.4.2 pandoc-server-0.1.4.2 pandoc-cli-3.13 2026-10-26 12:45:02 -07:00
John MacFarlane cc0b0de545 Update changelog 2026-10-26 10:15:47 -07:00
John MacFarlane 9194b86a94 Use texmath 0.13.3.3 2026-10-26 09:36:04 -07:00
John MacFarlane fe7bc1744c Acitons: Fix cache in nightly. 2026-10-26 09:04:31 -07:00
John MacFarlane a3a4dc0f3d Update authors. 2026-10-25 23:12:13 -07:00
John MacFarlane b5e35e840c Add missing test files in pandoc.cabal. 2026-10-25 23:07:56 -07:00
John MacFarlane 7e6ffa9b68 Update changelog. 2026-10-25 23:03:24 -07:00
John MacFarlane 0de46898c6 Update flake.lock. 2026-10-25 13:27:02 -07:00
John MacFarlane 14694f0f41 Update man page date and man pages. 2026-10-25 11:44:05 -07:00
John MacFarlane ba0e2c7a0c Use released texmath 0.13.3.2. 2026-10-25 11:31:29 -07:00
John MacFarlane 5caedd5ac4 Use released citeproc 0.14.1.1. 2026-10-25 11:30:08 -07:00
John MacFarlane 6ee43e4395 Use released gridtables 0.1.1.1. 2026-10-25 11:07:38 -07:00
John MacFarlane 9e9d85bea0 Bump versions: pandoc, pandoc-cli to 3.13.
pandoc-lua-engine to 0.5.4.2, allow pandoc 3.13.
pandoc-server to 0.1.4.2, allow pandoc 3.13.
2026-10-25 10:45:45 -07:00
Wleeaf 19ef19747f RST reader: allow inline markup and bare links after : / ' " <
Since 3.2.1 these characters could no longer precede an inline
markup start-string or a bare URI or email address, although the
reStructuredText spec allows them.  So <https://example.com> was not
a link and <jane-doe@example.com> became a link to doe@example.com.

Also implement the rule that a start-string between an opening
character and its closing counterpart, as in (*) or "*", is not
inline markup.
2026-10-25 10:35:25 -07:00
Patrick CreightonandCopilot a5af15c2d5 Docx reader: fix namespaces in notes and comments. (#11996)
The contents of footnotes, endnotes and comments were read with the
namespace prefixes declared in word/document.xml rather than in their
own parts. If word/footnotes.xml, word/endnotes.xml or word/comments.xml
declared a prefix that document.xml did not, such as `r` or `m`, the
elements using it were dropped: a hyperlink in a footnote lost its text,
and an equation in an endnote or comment disappeared. They are now read
with the namespace maps that archiveToNotes and archiveToComments
already compute.

Closes #11991.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-24 17:33:07 -07:00
John MacFarlane be4ff52d64 Update release checklist template. 2026-10-24 17:20:40 -07:00