Commit Graph
1028 Commits
Author SHA1 Message Date
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
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 aeb84b5d13 Fix command test #6285 for Windows. 2024-06-01 16:21:39 -07: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 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 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
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 fa01764a0e CSV reader: turn line breaks into LineBreaks not SoftBreaks.
Closes #9797.
2024-05-27 14:32:59 -07:00
John MacFarlane 205e54c245 RST reader: tighten up rules fro when emphasis can start.
Closes #9805.
2024-05-27 14:11:43 -07:00
John MacFarlane a7c6a290dc Markdown writer: ensure blank line after HTML blocks...
in commonmark-based formats. Closes #9792.
2024-05-27 13:37:59 -07:00
John MacFarlane 2d74c75666 Allow author-only textual citations.
E.g. `-@reese2002` outside of brackets.

Closes #7219.
2024-05-18 10:26:27 -07:00
Gokul Rajiv 74add4b126 RST reader: fix figclass and align annotations for figures (#9744)
Fixes #7473 

Previously, `figclass`es weren't being extracted correctly.

`figclass` and `align` annotations are now implemented following the rst docs: these options apply to the figure while other options are passed onto the underlying image.
2024-05-10 15:55:06 -07:00
John MacFarlane 49df8131a5 Markdown writer: don't try to align columns in pipe tables...
...with lines greater than COLUMNS.

The alignment just reduces readibility when the lines soft wrap.
2024-04-25 14:26:17 -07:00
John MacFarlane f366e5f638 LaTeX reader: fix over-eager macro expansion in conditionals.
Closes #9676.
2024-04-21 09:01:16 -07:00
John MacFarlane 30442b7f9d Change to --file-scope behavior.
Previously a Div with an identifier derived from the filename
would be added around the contents of each file.  This caused
problems for "chunking" files into chapters, e.g. in EPUB.

We no longer add the surrounding Div. This cooperates better with
chunking. Note, however, that if you have relied on the old
behavior to link to the beginning of the contents of a file using
its filename as identifier, that will no longer work.

Closes #8741.
2024-04-20 16:28:42 -07:00
John MacFarlane 0f8086cbd3 Fix command test for #9652. 2024-04-15 10:19:22 -07:00
Carlos Scheidegger 52ee4f109f SelfContained: merge 'class' attr when both img and svg specify it (#9653)
Closes #9652.
2024-04-15 09:44:30 -07:00
Gordon Woodhull 99a45917ac Typst writer: property output (#9648)
The Typst writer will pass on specially marked attributes as raw Typst
parameters on selected elements. This allows extensive customization
using filters.

An attribute with key `typst:PROP` will set the PROP parameter on
the corresponding Typst element.

An attribute with key `typst:text:PROP` will set a parameter on a Typst
`#set text()` rule or a text element.

The feature has been implemented for the following elements:

* span text
* div and div text
* table and table text
* table cell and table cell text

It would be possible to support more elements in the future.

A separate document has been added that provides extensive
documentation and examples of the use of this feature.
2024-04-15 09:32:32 -07:00
John MacFarlane bc9f990256 OpenDocument writer: implement custom-style for spans.
Closes #9657.
2024-04-14 11:29:56 -07:00
John MacFarlane a0c1bdeb8b Markdown reader: auto-close unclosed divs.
This applies to both fenced and HTML-ish varieties.
Otherwise we face an exponential performance problem with
backtracking.

This also accords with the behavior of the `fenced_divs`
extension in commonmark.

A warning is issued when a div is implicitly closed.

Closes #9635.
2024-04-10 17:18:05 -07:00
John MacFarlane 91e758590d LaTeX writer: improve treatment of math inside soul commands.
soul commands (`ul`, `hl`, `st`) are very fragile and the math
must be handled specially.  In #9597 we improved this for strikethrough
but omitted the other soul environments. This patch generalizes the
fix and a related fix for verbatim (#1294, #5529).
2024-04-08 08:53:47 -07:00
John MacFarlane c0768e87cf Org reader: Fix treatment of id property under heading.
Cloess #9639.
2024-04-06 18:24:54 -07:00
John MacFarlane e1f4594272 DokuWiki reader: fix issues with links.
- Link text cannot contain formatting (e.g., `//` is not italics).
  Closes #9630.
- An explicitly empty link text (`[[url|]]`) works the same as an omitted
  link text. Closes #9632.
2024-04-04 10:13:02 -07:00
John MacFarlane c29c18a003 Put $ or $$ around math in csljson output.
Closes #9616.
2024-04-01 12:54:12 -07:00
John MacFarlane b28dc15817 LaTeX writer: fix math inside strikeout (closes #9597). 2024-03-22 08:50:20 -07:00
John MacFarlane ebcae86cf4 DocBook reader: add empty title to admonition div if not present.
This allows admonition elements (e.g. `<note>`) to work with
gfm admonitions even if the `<title>` is not present.

Closes #9569.
2024-03-19 08:09:54 -07:00
John MacFarlane d89167d25f Typst writer: more reliable escaping in inline [..] contexts.
For example, we need to escape `[\1. April]` or it will be
treated as an ordered list.

Closes #9586.
2024-03-18 11:43:41 -07:00
John MacFarlane c5c7022ac5 Typst writer: handle unnumbered on headings.
Closes #9585.
2024-03-18 10:13:51 -07:00
John MacFarlane a1aca22e0d LaTeX reader: better handling of colwidths.
Previously the parser just failed if the column width
specified in `p{}` wasn't a multiple of `\linewidth`.
This led to cases where content was skipped.
Now we treat these as ColWidthDefault and silently
parse the table.

A future improvement could be to guess relative column
widths from the dimensions specified, based on a default
line width.

Closes #9579.
2024-03-17 19:15:49 -07:00
John MacFarlane 660823e2ec Typst writer: only use explicit figure 'kind' for tables.
The rest of the time the autodetection should work fine.
2024-03-17 15:46:17 -07:00
John MacFarlane 2c5d66cb5c Typst writer: use kind: image for image figures. 2024-03-17 11:39:32 -07:00
John MacFarlane a6392207fc Typst writer: avoid unnecessary box around image in figure.
See #9236.
2024-03-17 11:29:25 -07:00
John MacFarlane 95661b6a05 Markdown reader: Fix bug with footnotes at end of fenced div.
Cloess #9576.
2024-03-14 11:04:26 -07:00
John MacFarlane 69eab3fce5 Fix test for #9555. 2024-03-10 11:42:40 -07:00
John MacFarlane 812f82ab09 LaTeX reader: improve tokenization of @.
Make tokenization sensitive to `\makeatletter`/`\makeatother`.
Previously we just always treated `@` as a letter.  This led
to bad results, e.g. with the sequence `\@`.  E.g.,
`a\@ b` would parse as "ab" and `a\@b` as "a".

Closes #9555.
2024-03-10 11:14:41 -07:00
John MacFarlane 626ffd74b4 LaTeX reader: Make withRaw work inside parseFromToks.
This is needed for raw environments to work inside table cells.

Closes #9517.
2024-03-09 12:53:13 -08:00
John MacFarlane 67fa6cda5c SelfContained: add role="img" to svgs.
This is needed in conjunction with `aria-label` for screen
readers. Completes the fix to #9525.
2024-02-29 12:48:27 -08:00
John MacFarlane 85b3ac3ee1 SelfContained: Add aria-label to svg elements.
Screen readers don't seem to pay attention to an alt attribute on
svg.  But they do read the aria-label. So if there's an alt
attribute, we copy its contents to aria-label, unless there is
already an aria-label. This will make pandoc's output with
`--embed-resources` more accessible.

Closes #9525.
2024-02-29 12:08:02 -08:00
John MacFarlane cd460ec9c7 Fix regression in section numbering.
Starting with pandoc 3.1.12, unnumbered sections incremented
the section number.

Closes #9516.
2024-02-28 11:31:05 -08:00
John MacFarlane c131f8d4bc Markdown reader: fix regression in link parsing...
with wikilinks extensions.  This fixes a regression introduced
in 3.1.12.  Closes #9481.
2024-02-19 12:46:43 -08:00
John MacFarlane 54b001aa19 Org reader/writer: support admonitions.
Closes #9475.
2024-02-19 11:26:57 -08:00
John MacFarlane 8a0e522c39 Typst writer: ensure that -, +, etc. are escaped at beginning of block.
Our recent relaxing of escaping (#9386) caused problems for
things like emphasized `-` characters that were rendered using
`#strong[-]#`.  This now gets rendered as `#strong[\-]`.

Closes #9478.
2024-02-19 08:52:37 -08:00
John MacFarlane b36052144b LaTeX writer: fix bug when a language is specified in two different ways.
If you used `lang: de-DE` but then had a span or div with `lang=de`, the
preamble would try to load `ngerman` twice, leading to an error.

This fix ensures that a language is only loaded once.

Closes #9472.
2024-02-18 11:44:03 -08:00
John MacFarlane 45b6df537a More fixes for SVG ids with --self-contained.
This generalizes the fix to #9420 so it applies to things like
`style="fill(url(#..."`.

Closes #9467.
2024-02-16 10:06:12 -08:00
John MacFarlane cf847b0138 LaTeX reader: improve treatment of cref, Cref.
Associate with `\cref` and `\Cref` the reference-type `ref+label` and
`ref+Label`.  So far we don't do anything fancy with these.
Also, associate with `\vref` `ref` instead of `ref+page`.

See #7463.
2024-02-13 19:32:12 -08:00
John MacFarlane aa00714ba4 Typst writer: improve citation support.
Emit `form: "prose"` or `form: "year"` qualifiers if the citation
is author-in-text or suppress-author.

Strip initial comma from suffix, since typst will add an extra
one.

Closes #9452.
2024-02-12 20:01:44 -08:00
Sam May 758ff050b2 HTML5 writer: Add suffix to multiple footnote section ids
The first (and often only) `<aside id=footnotes>` block remains
unchanged, however any additional blocks from `--reference-location` are
distinguished as `#footnotes-2`, `#footnotes-3`, and so on.  No other
existing writer seems to implement per-section IDs, including HTML4.
2024-02-12 18:45:47 -08:00
John MacFarlane bf674e8ddd Markdown writer: use different width fences for nested divs.
Outer divs have longer fences. This aids clarity for the reader,
making it easier to see where the div ends. It also makes the
output compatible with some other implementations, e.g.
micromark, which require different-width fences for nesting.

Closes #9450.
2024-02-12 10:05:36 -08:00
John MacFarlane bd352e41d6 Man reader: move spaces outside of emph/strong.
This is needed to avoid problems in conversion to Markdown
and some other formats. Closes #9445.
2024-02-11 19:06:50 -08:00