Commit Graph
42 Commits
Author SHA1 Message Date
John MacFarlane 676ccdc904 T.P.Writers.Shared: htmlAttrs: use data- prefix when needed.
This now behaves like the HTML writer, adding the `data-`
prefix for custom attributes.  This will affect, e.g.,
the mediawiki writer.

Closes #11680.
2026-06-03 12:23:44 +02:00
John MacFarlane ebd425d867 Typst writer: don't add a carriage return after \ for hard break.
They are not necessary.  Note that they can still be included if
you use `--wrap=preserve` and add a newline in your source
document.

This fixes issues with line breaks in headings.
Closes #11446.
2026-02-07 10:57:50 +01:00
John MacFarlane c8ad2752c4 Markdown writer: properly handle tables with footers.
Closes #11416.
2026-01-23 10:51:29 +01:00
John MacFarlane e87b86261f Typst writer: don't add semicolons as much.
Previously we added semicolons after inline commands not
followed by spaces, but mainly this was to deal with one issue:
the presence of a semicolon after an inline command, which
would be swallowed as a command separator (#9252).

This commits adopts an approach that should avoid so many
superfluous semicolons: it escapes semicolons that might come
right after a command.  See #11196.
2025-10-05 16:33:03 +02:00
John MacFarlane e201e3370a Markdown tables: implement table_attributes extension.
When `table_attributes` is enabled (as it is by default for
pandoc's Markdown), attributes can be attached to a table by
including them at the end of the caption. Previously the writer
would emit an identifier in this position, but the reader didn't
handle it. Now arbitrary attributes are allowed, and they work in
both the reader and writer.

Closes #10884.

[API change]: Text.Pandoc.Extensions: Add `Ext_table_attributes`
constructor for `Extension`.
2025-10-02 13:37:53 +02:00
John MacFarlane 78efe58641 T.P.Writer.Shared gridTable: more grid table fixes.
Fix headings with colspans. If the heading contains a colspan, we still
need to include information in the header line about the colspecs.

Fix headerless tables.  The top line should encode colspan information.

Closes #10855.
2025-05-28 12:46:00 -07:00
John MacFarlane 728bcf0731 gridTable - small improvements. 2025-05-20 11:35:09 -07:00
John MacFarlane 97b7d48333 gridTable: fix (3.7) regression with missing cell alignments.
Closes #10853.
2025-05-19 15:51:40 -07:00
John MacFarlane ca321e1b75 Fix problems with gridTable and add tests.
Closes #10848.
2025-05-16 18:10:06 -07:00
John MacFarlane c2482b9107 LaTeX writer: make alignment work within multirow in tables.
Closes #10772.
2025-04-09 22:38:43 -07:00
John MacFarlane 4bf3a735f5 LaTeX writer: use * for multirow width when no colwidth specified.
Otherwise the multirow will be excessively wide.

Closes #10685.
2025-03-14 18:42:59 -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
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 604f541b0f Typst writer: support Typst 0.11 table features. (#9593)
* Typst writer: support Typst 0.11 table features.

- colspans
- rowspans
- cell alignment overrides
- relative column widths
- header and footer
- multiple table bodies with intermediate headers

Row heads are not yet supported.

The default typst template has been modified so that tables
don't have lines by default. As is standard with pandoc, we only
add a line under a header or over a footer. However, a different
default stroke pattern can easily be added in a template.

Closes #9588.
2024-03-20 14:25:08 -07:00
John MacFarlane 992bc86981 LaTeX writer: fix rowspans in tables...
...so they use the width of the column (`=` as the width
parameter). Closes #9140.
2023-10-17 21:22:53 -07:00
John MacFarlane f4baa88f42 LaTeX writer: don't treat table as "simple" if they have col widths.
This should help fix a problem wherein some grid tables with
colspans were overly wide.  See #9140.

The example given there still produces suboptimal
output (overlapping text), so not closing yet.
2023-10-17 21:11:16 -07:00
John MacFarlane 05ad84a0c6 LaTeX writer: better fix for colspecs for multicolumn table.
Improves on the last commit; closes #8831.
2023-05-08 13:09:04 -07:00
Albert Krewinkel a197b57c0a LaTeX writer: include short figure/table caption if one is given.
Short captions are used by LaTeX when generating a the list of figures
or list of tables. Adding a short caption will now overwrite the full
caption in these lists.
2023-02-05 13:09:51 +01:00
John MacFarlane 7a82686adc Use \toprule\noalign{} instead of \toprule() in LaTeX tables.
And similar for `\midrule` and `\bottomrule`.

This facilitates redefining `\toprule`, `\midrule`, and `\bottomrule`
without needing to gobble the ()s.

Closes #8223.
2023-01-04 13:57:41 -08:00
Wout Gevaert e9d2ceb9bd Add tests for the new table features 2022-11-11 10:12:07 -08:00
Albert Krewinkel 7b7a7d6742 LaTeX writer: add separator line between table's body and its foot.
The writer uses features from the longtable package to define the table
foot. Furthermore, the table's bottom rule is now part of the foot,
where it previously was given as part of the body.
2022-10-06 22:07:25 +02:00
John MacFarlane dd07d8002f JATS writer: use <break/> for LineBreak...
in the limited contexts that accept it.

Closes #8344.
2022-10-01 17:46:13 -07:00
Albert Krewinkel 81e31ee637 LaTeX writer: add label to tables that have an identifier
Tables with an identifier are marked with a `\label`. A caption is
always included in this case, even if the caption is empty.

Closes: #8219
2022-08-17 12:39:07 +02:00
Albert Krewinkel 18484cbf47 LaTeX writer: fix widths of multicolumn cells
Fixes: #8218
2022-08-07 22:10:15 +02:00
Albert Krewinkel 4c2d03e96c Fix LaTeX tests for tables with colspans 2022-06-01 11:32:55 +02:00
John MacFarlane 5f0bfd41a8 LaTeX writer: add () after booktabs rules.
These commands take optional arguments with () and [],
which can lead to problems if the content of the table
cell begins with these characters.

Closes #8001.
2022-03-30 10:07:09 -07:00
Albert Krewinkel a6fa3df114 HTML writer: avoid duplicate "style" attributes on table cells
Fixes: #7871
2022-01-28 18:20:14 +01:00
John MacFarlane c266734448 Use pretty-simple to format native output.
Previously we used our own homespun formatting.  But this
produces over-long lines that aren't ideal for diffs in tests.
Easier to use something off-the-shelf and standard.

Closes #7580.

Performance is slower by about a factor of 10, but this isn't
really a problem because native isn't suitable as a serialization
format. (For serialization you should use json, because the reader
is so much faster than native.)
2021-09-21 12:37:42 -07:00
Peter Fabinski 8667ba2bcc LaTeX table writer: Increase column width precision (#7466)
In some cases, the rounding performed by the LaTeX table
writer would introduce visible overrun outside the text
area.
This adds two more decimal places to the width values.
2021-08-03 15:34:39 -06:00
John MacFarlane 8eed5b90d0 LaTeX writer: add strut at end of minipage if it contains...
line breaks.  Without them, the last line is shorter
than it should be, at least in some cases.
2021-06-21 23:33:00 -07:00
John MacFarlane 21cc52abe3 LaTeX writer: Fix regression in table header position.
In recent versions the table headers were no longer bottom-aligned
(if more than one line).  This patch fixes that by using minipages
for table headers in non-simple tables.

Closes #7347.
2021-06-05 14:13:58 -06:00
John MacFarlane 9a18cf4b59 LaTeX writer: revert table line height increase in 2.11.3.
In 2.11.3 we started adding `\addlinespace`, which produced less
dense tables.  This wasn't an intentional change; I misunderstood
a comment in the discussion leading up to the change. This commit
restores the earlier default table appearance.

Note that if you want a less dense table, you can use something like
`\def\arraystretch{1.5}` in your header.

Closes #6996.
2021-01-02 07:56:07 -08:00
Albert Krewinkel 8f402beab9 LaTeX writer: support colspans and rowspans in tables. (#6950)
Note that the multirow package is needed for rowspans.
It is included in the latex template under a variable,
so that it won't be used unless needed for a table.
2020-12-20 18:04:54 -08:00
Kolen Cheung bfb2a492c8 test/tables/*.native: normalized (#6888)
The 3 native table test cases are normalized so that it will looks exactly like it is written by some pandoc writers.

Note that apart from white space normalization, it includes other normalization such as `[Str "Nordic countries"] to [Str "Nordic",Space,Str "countries"]`.
2020-11-24 22:33:36 -08:00
Albert Krewinkel d286242131 JATS writer: support advanced table features 2020-11-19 22:09:52 +01:00
Andy Morris f1f2728259 Fix duplicate "class" attribute in HTML writer 2020-10-30 16:38:59 +01:00
Albert Krewinkel 90af138443 Fix typos in comments, doc strings, error messages, and tests
Typos reported by
https://fossies.org/linux/test/pandoc-master.tar.gz/codespell.html

See: #6738
2020-10-14 22:26:51 +02:00
Albert Krewinkel 34151e8da8 HTML writer: support intermediate table headers
Closes: #6314
2020-09-13 23:23:11 +02:00
Albert Krewinkel 8711640512 HTML writer: support attributes on all table elements
Add attributes to tbody and tr elements.
2020-09-13 20:26:06 +02:00
Albert Krewinkel a400d0dc62 HTML writer: render table footers if present
Part of: #6314
2020-09-12 21:49:01 +02:00
Albert Krewinkel 9423b4b7d9 Support colspans and rowspans in HTML tables (#6644)
* HTML writer: add support for row headers, colspans, rowspans
* Add planet table tests

See #6312
2020-09-10 09:47:40 -07:00