2404 Commits
Author SHA1 Message Date
John MacFarlane 687155e2bd Add command test for #9121. 2024-09-10 09:16:14 -07:00
John MacFarlane 94f9727b2f ANSI writer: use black rather than green for headings. 2024-09-09 21:49:42 -07:00
John MacFarlane 4a42a7d4a9 Tests.Readers.Markdown: avoid use of 'head'. 2024-09-09 09:15:54 -07:00
John MacFarlane 90e8725f5b Tests: use 'drop 1' instead of partial function 'tail'. 2024-09-09 09:03:17 -07:00
John MacFarlane 0a362141cf Avoid use of 'head' in Tests.Shared. 2024-09-09 08:28:19 -07:00
John MacFarlane 185c29b4b2 Typst reader: change how "block" elements are handled.
Previously they were always parsed as divs.  But actually they
can occur in some "inline" contexts.  Now we first try to parse
them as inlines, and only as blocks if that fails.  A surrounding
Div or Span element is added only if there is an identifier.
2024-09-08 14:50:18 -07:00
John MacFarlane 3e6eb1cde2 Text.Pandoc.Shared: add makeSectionsWithOffsets [API change].
This is like `makeSections` but has an additional parameter
specifying number offsets, for use with the `--number-offset` option.

Use `makeSectionsWithOffsets` in HTML writer instead of ad hoc
and inefficient number-adjusting code.

Clarify MANUAL.txt: the `--number-offset` option should only
directly affect numbering of the first section heading in
a document; subsequent headings will increment normally.
Fix test output for #5071 to reflect this.
2024-09-08 08:29:23 -07:00
John MacFarlane a27dad6f68 Add options to change table/figure caption positions.
+ Add command line options `--table-caption-position` and
  `--figure-caption-position`. These allow the user to specify whether
  to put captions above or below tables and figures, respectively.
  The following output formats are supported: HTML (and related such
  as EPUB), LaTeX (and Beamer), Docx, ODT/OpenDocument, Typst.

+ Text.Pandoc.Options: add `CaptionPosition` and new
  `WriterOptions` fields `writerFigureCaptionPosition` and
  `writerTableCaptionPosition` [API change].

+ Text.Pandoc.Opt: add `Opt` fields `optFigureCaptionPosition` and
  `optTableCaptionPosition` [API change].

+ Docx writer: make table/figure rendering sensitive to caption
  position settings.

+ OpenDocument writer: make table/figure rendering sensitive to
  caption position settings.

+ Typst writer/template: implement figure caption positions by
  triggering a show rule in the default template, which determines caption
  positions for figures and tables globally.

+ LaTeX writer: make table/figure rendering sensitive to caption
  position settings. Closes #5116.

+ HTML writer/template: make `<figcaption>` placement sensitive to caption
  position settings.  For tables, `<caption>` must be the first element,
  and positioning is determined by CSS, for here we set a variable
  which the default template is sensitive to.
2024-09-08 08:29:09 -07:00
John MacFarlane 74221a0ccb LaTeX reader: math environments don't have bracketed options.
We were checking for these, and that caused problems if the math
began with `[`.

Closes #10160.
2024-09-07 08:39:09 -07:00
John MacFarlane 180d2b5a02 RTF reader: handle images inside shp contexts.
We look for the `pib` property and parse image data inside its value.

Closes #10145.
2024-09-03 22:19:04 -07:00
John MacFarlane b3d721b4ab Typst writer: don't include trailing semicolon after...
`@` style citations with suffixes.

Closes #10148.
2024-09-03 20:14:33 -07:00
John MacFarlane 6d41c1b147 ANSI writer: add test for inline code. 2024-09-03 14:29:31 -07:00
John MacFarlane 6be41d1c62 ANSI writer: Remove Figure and Table labels and numbers. 2024-09-03 14:26:53 -07:00
John MacFarlane 9953f1d256 Add ansi writer tests. 2024-09-03 13:35:01 -07:00
John MacFarlane 6808788b21 HTML reader: only parse main element's contents (if present).
If main has an id or class, we include a div with that id or class;
otherwise just the contents.

Closes #10140.
2024-09-03 10:40:08 -07:00
Evan Silberman 5e5ce1fae4 Match writer.djot expected output to doclayout
For reasons not currently clear to me(!), the tip of doclayout consumes
the breaking space that is followed by nothing (i.e. the ignored raw
LaTeX inline). The tests of djoths itself still pass.
2024-09-02 11:08:13 -07:00
John MacFarlane 1393cda27d LaTeX reader: parse nested tabular environments.
Closes #4746.
2024-09-01 11:04:46 -07:00
John MacFarlane 1a56865705 Markdown writer: avoid emitting markdown caption if...
...table has fallen back to raw HTML, which will then contain
a `<caption>` tag.

Closes #10094.
2024-08-29 11:15:20 -07:00
John MacFarlane a0bc3a574e RST reader: improve simple table support.
Multiline rows occur only when the *first* cell is empty; we were
previously treating lines with *any* empty cell as row continuations.

Closes #10093.

In addition, we no longer wrap multiline cells in Para if they
can be represented as Plain. This is consistent with docutils
behavior.
2024-08-29 10:41:52 -07:00
John MacFarlane 6c4691324f AsciiDoc writer: add link: prefix when needed.
AsciiDoc requires it except for http, https, irc, mailto, ftp schemes.

Closes #10105.
2024-08-23 12:20:43 -07:00
Albert Krewinkel b2755f77ba Org reader: fix parsing of src blocks with an -i flag.
Tabs are now preserved in the contents of *src* blocks if the the block
has the `-i` flag.

Fixes: #10071
2024-08-08 17:01:34 +02:00
John MacFarlane 1f093eab98 Asciidoc writer: preserve original base level.
We used to normalize so that the base level is always 1, but
asciidoc no longer seems to care about that, and the behavior
creates difficulties when we are converting fragments.

Closes #10062.
2024-08-06 20:07:27 -07:00
John MacFarlane 9bf112b9af LaTeX writer: preserve locator labels with --natbib.
In #9275 we made pandoc strip off locator labels (e.g. `p.`)
for natbib and biblatex output. In fact, this is only desirable
for biblatex.  natbib needs the locators to be preserved.

Closes #10057.
2024-08-06 15:16:24 -07:00
John MacFarlane 6c43c03398 Docx writer: fix regression with nested lists.
Closes #9994.  The bug affects e.g. ordered lists with bullet
sublists; after the sublist the top-level list reverts to bullets
instead of being properly numbered.

This regression was introduced in version 3.2.1 and was caused by
commit f5531f1.
2024-07-27 21:01:00 -07:00
John MacFarlane 8613aa39e8 BibTeX writer: ensure that "literal" names are enclosed in braces.
Closes #9987.
2024-07-15 18:23:20 +03:00
Albert Krewinkel 73ce302479 Harmonize maintainer email addresses in module headers. 2024-07-08 13:27:45 +02:00
Stephen Huan 9aea033cc6 Change sr -> sr-Latn in translation tests 2024-07-05 13:04:15 -07:00
John MacFarlane 2befcb007b Adjust test for #9943 so it works with Windows. 2024-07-03 22:36:21 -07:00
John MacFarlane 60c0149084 Man writer: use default middle header when metadata does not...
include `header`.  This change causes pandoc to omit the middle
header parameter when `header` is not set, rather than
emitting `""`.  The parameter is optional and man will use
a default based on the section if it is not specified.

Closes #9943.
2024-07-03 16:25:55 -06:00
John MacFarlane 5604ca612c TWiki Reader: recognize WikiWords as internal links.
Fixes #9941.
2024-07-03 15:45:52 -06:00
John MacFarlane 26b25a4428 LaTeX writer: new method for ensuring images don't overflow.
Previously we relied on graphicx internals and made global
changes to Gin to force images to be resized if they exceed
textwidth.  This approach is brittle and caused problems
with `\includesvg` (see #9660).

The new approach uses a new macro `\pandocbounded` that is
now defined in the LaTeX template. (Thanks here to Falk Hanisch in
https://github.com/mrpiggi/svg/issues/60.)

The LaTeX writer has been changed to enclose `\includegraphics`
and `\includesvg` commands in this macro when they don't explicitly
specify a width or height.

In addition, the writer now adds `keepaspectratio` to the
`\includegraphics` or `\includesvg` options if `height` is specified
without width, or vice versa. Previously, this was set in the preamble
as a global option.

Compatibility issues:

- If custom templates are used with the new LaTeX writer, they will have
  to be updated to include the new `\pandocbounded` macro, or an error
  will be raised because of the undefined macro.

- Documents that specify explicit dimensions for an image may render
  differently, if the dimensions are greater than the line width or
  page height. Previously pandoc would shrink these images to fit,
  but the new behavior takes the specified dimensions literally.
  In addition, pandoc previously always enforced `keepaspectratio`,
  even when width and height were both specified, so images with
  width and height specified that do not conform to their intrinsic
  aspect ratio will appear differently.

Closes #9660.
2024-06-23 16:12:37 -07:00
John MacFarlane 965de61edb Markdown writer: fix bug with block quotes in lists.
Closes #9908.
2024-06-23 14:33:58 -07:00
John MacFarlane b07c05a1e5 OpenXML writer: be craftier in adding East Asian font hints.
In some cases we need to break up a long text run including
both western and East Asian text, so that the punctuation in
the western text doesn't become double-wide.

Closes #9817.
2024-06-22 21:37:06 -07:00
John MacFarlane bee5b1fcd1 HTML writer: ensure URI escaping needed for html4.
Unicode characters need not be escaped for html5, and still won't be.

See #9905.
2024-06-22 18:48:55 -07:00
John MacFarlane 2b60b1a1bc RST reader: Support :cite: role with citeproc.
This patch supports a subset of the functionality of the
sphinxcontrib-bibtex extension to Sphinx. See
<https://sphinxcontrib-bibtex.readthedocs.io/en/latest/quickstart.html>.

Closes #9904.
2024-06-21 23:30:27 -07:00
John MacFarlane 7de74f3404 Add command test for #9358. 2024-06-21 11:15:04 -07:00
John MacFarlane 7786b72584 LaTeX reader: fix parsing of dimensions beginning with ..
E.g., `\kern.1pt`.

Closes #9902.
2024-06-21 11:14:31 -07:00
John MacFarlane 34aeb289c9 Textile reader: don't let spans begin right after a symbol.
Closes #9878.
2024-06-18 13:24:59 -07:00
John MacFarlane 532bbc875b Use latest commonmark-extensions.
This fixes `auto_identifiers` and `ascii_auto_identifiers`
extensions so that they substitute aliases for emojis,
as documented.

See #9876.
2024-06-17 19:57:33 -07:00
John MacFarlane 94975a4e3c Docx reader: improve handling of captions.
- Turn captioned images into Figure elements. Closes #9391.
- Improve the logic for associating elements with captions.
  Closes #9358.
- Ensure that captions that can't be associated with an
  element aren't just silently dropped. Closes #9610.
2024-06-12 22:31:33 -07:00
John MacFarlane cd9753d4af LaTeX writer/template: specify language option for selnolig...
...and only include it if `english` or `german` is used.

Since 3d8f011, the babel language is not specified as a
class option any more; so now we need to explicitly specify
the language option when we load `selnolig`.  Only `german`
and `english` are valid, so we construct the variable
`selnolig-langs` in the writer and include `selnolig` if it
is nonempty.

This should restore proper ligature suppression when
lualatex is used.

Closes #9863. Supersedes #9864.

Thanks to @fkohrt for the initial fix.
2024-06-10 19:33:43 -07:00
John MacFarlane f2092f82ff SelfContained: only create svg elements for SVG images when...
...the image has the class `inline-svg`. Otherwise just use a
`data` URI as we do with other images.

Closes #9787.
2024-06-10 10:59:16 -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
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 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
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 39c549caad Docx writer: omit jc attribute on table cells with AlignDefault.
Closes #5662.
2024-06-01 22:31:03 -07:00