aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-06-23LaTeX writer: new method for ensuring images don't overflow.John MacFarlane
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-23Markdown writer: fix bug with block quotes in lists.John MacFarlane
Closes #9908.
2024-06-22OpenXML writer: be craftier in adding East Asian font hints.John MacFarlane
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-22HTML writer: ensure URI escaping needed for html4.John MacFarlane
Unicode characters need not be escaped for html5, and still won't be. See #9905.
2024-06-21RST reader: Support `:cite:` role with citeproc.John MacFarlane
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-21LaTeX reader: fix parsing of dimensions beginning with `.`.John MacFarlane
E.g., `\kern.1pt`. Closes #9902.
2024-06-18Textile reader: don't let spans begin right after a symbol.John MacFarlane
Closes #9878.
2024-06-17Make `gfm_auto_identifiers` work as advertised.John MacFarlane
It is supposed to replace emojis with their aliases, but previously this only worked when the emojis were in a specially marked span. Note that this change doesn't affect `commonmark` (or `gfm`) because the relevant code is in commonmark-hs. This will also need updating. See #9876.
2024-06-12Markdown writer: don't print extra caption when using `implicit_figures`.John MacFarlane
2024-06-12Docx reader: improve handling of captions.John MacFarlane
- 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-12Docx reader: rename TblCaption to Capt.John MacFarlane
We'll use this for image captions as well. Word does not really distinguish these.
2024-06-11T.P.ImageSize: don't prefer exif width/height when they conflict...John MacFarlane
...with width/height. That was a mistaken call in #6936. Usually when these values disagree, it is because the image has been resized by a tool that leaves the original exif values the same, so the width/height metadata are more likely to be correct that exif width/height. Closes #9871.
2024-06-10LaTeX writer/template: specify language option for `selnolig`...John MacFarlane
...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-10SelfContained: strip CRs from XML before base64 encoding for data uri.John MacFarlane
This is motivated mainly by the desire to get tests to work on Windows.
2024-06-10SelfContained: only create svg elements for SVG images when...John MacFarlane
...the image has the class `inline-svg`. Otherwise just use a `data` URI as we do with other images. Closes #9787.
2024-06-08PandocMonad: convert IOErrors to warnings when fetching absolute paths (#9859)Albert Krewinkel
2024-06-08Fix "unused variable" warning.Albert Krewinkel
2024-06-07Textile writer: get rid of header, odd, even classes on tr.John MacFarlane
This follows #9376.
2024-06-07Fixes to #9376.John MacFarlane
2024-06-07Don't emit unnecessary classes in HTML tables (#9376)ThomasSoeiro
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-04Fix warning.John MacFarlane
2024-06-04LaTeX writer: task lists must be unordered.John MacFarlane
Closes #9185.
2024-06-04Docx reader: support task lists.John MacFarlane
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-04T.P.Writers.Shared: export toTaskListItem instead of isTaskList.John MacFarlane
This is more useful. Use this in OpenXML and HTML writers.
2024-06-04T.P.Readers.Docx.Lists: replace a generic traversal...John MacFarlane
using `bottomUp` with a faster one using `walk`.
2024-06-04Docx writer: better formatting for task lists.John MacFarlane
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-04T.P.Writers.Shared: export `isTaskList`.John MacFarlane
[API change] This function used to be in T.P.Writers.HTML.
2024-06-03typst,table - support '.typst:no-figure' and 'typst:figure:kind=kind' (#9778)Carlos Scheidegger
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-01Docx writer: omit jc attribute on table cells with AlignDefault.John MacFarlane
Closes #5662.
2024-06-01Docx reader: react to "left" value on jc attribute.John MacFarlane
Also fix tests.
2024-06-01Docx reader: handle column and cell alignments.John MacFarlane
OpenXML doesn't have a way of indicating column alignments, but we guess them by looking at the justification property on the first paragraph of a cell, if there is one. We take the column alignments from the first body row. Closes #8551.
2024-06-01Docx reader: allow insertion/deletion to contain arbitrary ParParts...John MacFarlane
...and not just Runs. This fixes a problem wherein comments inside insertions or deletions would be ignored. Closes #9833.
2024-06-01Support HorizontalRule in docx reader.John MacFarlane
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-01T.P.Readers.Docx.Parse: add HRule constructor to BodyPart.John MacFarlane
This paves the way to supporting horizontal rules in the reader. We still need to adjust the parser to create HRule appropriately; so far, this change has no effect, but it's a step on the way to #6285.
2024-05-31Use `\linewidth` instead of `\columnwidth` or `\textwidth`...John MacFarlane
for resizing figures, table cells, etc. in LaTeX. `\linewidth`, unlike the others, is sensitive to indented environments like lists. Closes #9775.
2024-05-31Fix metadata in docx writer.John MacFarlane
The new OpenXML template had spaces for metadata that need to be filled with OpenXML fragments with the proper shape. This patch ensures that everything is the right shape. Closes #9828.
2024-05-29Docx writer: wrap figures with id in a bookmark.John MacFarlane
Closes #8862.
2024-05-29Docx writer: add eastAsia font hints to `w:r`.John MacFarlane
We do this when the text in the run contains any CJK characters. This ensures that ambiguous code points (e.g. quotation marks) will be represented as "wide" characters when together with CJK characters. Closes #9817.
2024-05-29Add unexported module Text.Pandoc.Char.John MacFarlane
This exports `isCJK`. Use this instead of locally defined `isCJK` in T.P.Readers.MediaWiki.
2024-05-28HTML reader: better handle non-li elements in ul and ol.John MacFarlane
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-27Typst reader: handle inline bodies ending in a parbreak.John MacFarlane
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-27Typst reader: fix an incomplete pattern match.John MacFarlane
See #9807.
2024-05-27CSV reader: turn line breaks into LineBreaks not SoftBreaks.John MacFarlane
Closes #9797.
2024-05-27RST reader: tighten up rules fro when emphasis can start.John MacFarlane
Closes #9805.
2024-05-27Markdown writer: ensure blank line after HTML blocks...John MacFarlane
in commonmark-based formats. Closes #9792.
2024-05-19Allow OpenXML templates to be used with `docx`.John MacFarlane
The `--reference-doc` option allows customization of styles in docx output, but it does not allow one to adjust the content of the output (e.g., changing the order in which metadata, the table of contents, and the body of the document are displayed), or adding boilerplate text before or after the document body. For these changes, one can now use `--template` with an OpenXML template. (See the default `openxml` template for a sample.) This patch also allows `--include-before-body` and `--include-after-body` to be used with `docx` output. The included files must be OpenXML fragments suitable for inclusion in the document body. Closes #8338 (`--include-before-body`, `--include-after-body`). Closes #9069 (a custom template can be used to omit the title page). Closes #7256. Closes #2928.
2024-05-18Tweak imports to fix ghc 9.4 build failure.John MacFarlane
2024-05-18Factor out T.P.Writers.Docx.OpenXML (internal module).John MacFarlane
2024-05-18Allow author-only textual citations.John MacFarlane
E.g. `-@reese2002` outside of brackets. Closes #7219.
2024-05-15Texinfo writer: improve menus.John MacFarlane
Properly handle the case where the node name is different from the descriptive title.