Commit Graph
8318 Commits
Author SHA1 Message Date
Albert Krewinkel 8ce28fc4d7 T.P.App: cleanup code, extract internal functions 2022-12-14 20:34:39 +01:00
Albert Krewinkel e08958a66d T.P.App: unify check for standalone output 2022-12-14 16:31:52 +01:00
John MacFarlane 3439c1ae94 Docx reader: fix handling of oMathPara in w:p with other content.
Closes #8483.

The problem is that oMathPara can either occur at the block-level
(child of w:body) or at the inline level (child of w:p, potentially
with other content). We need to handle both cases.
Previously the code just assumed that if we had a w:p with an oMathPara,
the math would be the sole content.

This patch removes OMathPara as a constructor of BodyPart
and adds it as a constructor of ParPart.
2022-12-11 20:20:28 -08:00
Albert Krewinkel e0e6087145 Shared: change defaultBlocksSeparator to PARAGRAPH SEPARATOR
This Unicode char (U+2029) is intended as a semantic separator between
paragraphs; it is cleaner and less intrusive than the pilcrow sign that
we used before. This also changes the default `sep` value used in the
`pandoc.utils.blocks_to_inlines` Lua function.
2022-12-08 00:24:07 +01:00
Albert Krewinkel a03b77fbd3 Lua: support -D CLI option for custom writers [API change]
A new error `PandocNoTemplateError` (code 87) is thrown if a template is
required but cannot be found.
2022-12-05 08:52:37 -08:00
John MacFarlane a4ac1ebb95 Fix metadata parsing corner case.
Closes #8465.
2022-12-04 11:14:43 -08:00
John MacFarlane 634696fb87 HTML writer: remove obsolete stuff about mathml-script.
This was a shim we used to include for mathml support.
We don't do anything with this any more, so this is dead code.
2022-12-04 10:20:22 -08:00
John MacFarlane 732ef20546 HTML writer: include math links if there are raw...
commands or environments that can be interpreted as math e.g. by
MathJax.  See #8469.
2022-12-04 10:14:59 -08:00
John MacFarlane aaa3beacc0 EPUB writer: make title page optional.
New command line option: `--epub-title-page=true|false`.

New `writerEpubTitlePage` field on `WriterOptions` [API change].

New `optEpubTitlePage` field on `Opts` [API change].

Closes #6097.
2022-12-04 09:59:05 -08:00
John MacFarlane c5beb1db45 Avoid using 'error' for unassigned table cells.
Instead, throw a regular pandoc error.  This is not necessarily
a programming error, as it can be triggered by inserting a
cell with ColSpan 0 in the AST.  Unfortunately the types
don't prevent that.

Closes #8468.
2022-12-02 14:47:29 -08:00
John MacFarlane 8b01e200f0 Multiple input files with --file-scope:
fix case where the links are URL-encoded, e.g. with `%20`.

Closes #8467.
2022-12-01 19:20:06 -08:00
John MacFarlane ed4bdd059c HTML writer: Add prooftree to list of math environments.
This will cause raw LaTeX prooftree environments to be rendered
appropriately when `--mathjax` is used.

Closes #8462.
2022-11-29 17:07:03 -08:00
John MacFarlane 513bdef40b DocBook writer: Fix position of textobject.
It is a child of `inlinemediaobject`, not `imageobject`.

Add regression tests for #8437.

Closes #8437.
2022-11-29 10:16:41 -08:00
John MacFarlane fe799eea91 AsciiDoc writer: in link text, only replace commas...
...with entities when they're in Str elements.  If a link
contains an image, it may have attributes, and the commas
there should not be converted.

See #8437, #8070.
2022-11-29 09:56:41 -08:00
John MacFarlane 6191be11ff DocBook writer: don't indent contents of title element. 2022-11-29 09:43:11 -08:00
John MacFarlane 6a23ac0d1d DocBook writer: render image alt text using textobject element.
See #8437.
2022-11-29 09:37:31 -08:00
John MacFarlane 8f9e16265b DocBook reader: support href on link...
even in a fragment.  (We now just look for an `href` attribute without
worrying about the namespace.)

See #8437.
2022-11-29 09:23:10 -08:00
John MacFarlane 07ebafcb01 DocBook reader: parse title from imageobject/objectinfo.
See #8437.
2022-11-29 09:13:48 -08:00
vkraven b6622c07b6 Textile Reader:
- Adding a Parser to look for ordered list start attribute numbers if any
 - Add command test for ordered list start attributes (#2465)
 - Cleanup and formatting
2022-11-28 19:30:20 -07:00
John MacFarlane f53ab3ca8c LaTeX reader: Add unnumbered class for \part*.
Closes  #8447.
2022-11-25 08:59:33 -07:00
Albert Krewinkel 2dec0ff52d Docx writer: support relative image widths.
Image widths given in percent are interpreted to be relative to the text
width. This is similar to the way percent widths are handled in other
writers, e.g. HTML and LaTeX. Previously, percent widths were taken
relative to the image's native size.
2022-11-21 16:32:41 +01:00
John MacFarlane 4b4771f062 Docx reader: Support parsing of highlighted text. 2022-11-19 13:28:10 -08:00
John MacFarlane bb0fd13bcb RST reader: support mark role for round-trip. 2022-11-19 12:44:25 -08:00
John MacFarlane 127ded4fae LaTeX reader: support more soul commands, including \hl. 2022-11-19 12:44:07 -08:00
John MacFarlane 75435381ac Add support for mark extension for highlighted text.
+ Extensions: Add `Ext_mark` extension.
  This is not part of the pandoc extensions by default.
+ Markdown reader: parse `==..==` if `mark` extension enabled.
+ Markdown writer: support `mark` extension.
+ Docx writer: render Span with class `mark` as highlighted.
  Currently yellow is hardcoded.
+ LaTeX writer: support highlighted text for Span with class `mark`.
+ RST writer: use special `mark` role for Span with class `mark`.
+ Update MANUAL.txt.

Closes #7743.
2022-11-19 12:30:12 -08:00
John MacFarlane 144bf90ab9 LaTeX writer: Use soul instead of ulem for strikeout, underline.
This handles things like hyphenation, line breaks, and nonbreaking
spaces better.

Closes #8411.
2022-11-19 12:28:41 -08:00
John MacFarlane afe096d9e3 Markdown writer: escape ! before [.
See #8254.
2022-11-11 10:58:07 -08:00
Wout Gevaert 323be80838 Use 'literal tag' instead of 'text (T.unpack tag)' in tagWithAttrs 2022-11-11 10:12:07 -08:00
Wout Gevaert 0b003de6f1 Change the Mediawiki writer to use the 'new' table structure
Now MediaWiki tables can use colspan and rowspan :D
2022-11-11 10:12:07 -08:00
Wout Gevaert c5dbedcd4e [API change] Add functions htmlAddStyle, htmlAlignmentToString and htmlAttrs to Writers/Shared.hs
The functions htmlAddStyle and htmlAlignmentToString are moved from Writers/HTML.hs, where they were called 'addStyle' and 'alignmentToString' respectively.
The function htmlAttrs is split off from tagWithAttrs in Writers/Shared.hs. It creates a representation of an Attr object, as one would see in a tagWithAttrs (but without the tag)
2022-11-11 10:12:07 -08:00
John MacFarlane 314c2d1d32 Better error when parsing EndNote references fails.
(Tell them that it concerns EndNote references.)
2022-11-10 10:14:59 -08:00
John MacFarlane cb5e3ded12 In --verbose mode add message when running citeproc.
(As with other filters.)
2022-11-09 12:34:56 -08:00
John MacFarlane 1989573074 Ms writer: remove -C option on PSPIC.
Some old versions don't support this option, and since it's
the default it shouldn't be necessary.
2022-11-08 15:20:08 -08:00
John MacFarlane 452fe5aa17 EPUB writer: refactor to use T.P.Chunks. 2022-11-06 21:31:40 -08:00
John MacFarlane 04973586eb Move SecInfo, toTOCTree to T.P.Chunks.
Also add `secPath` to `SecInfo`.
2022-11-06 21:31:40 -08:00
John MacFarlane 9e2df2a718 Add Text.Pandoc.Chunks.
This module provides functions to split Pandoc documents into
chunks to be rendered in separate files, e.g. one per section.

Internal identifiers are rewritten appropriately to point to
the new locations.

See #6122.
2022-11-06 21:31:34 -08:00
John MacFarlane 036aac3851 Fix warnings. 2022-11-06 12:47:01 -08:00
John MacFarlane 2682c79e95 EPUB writer: refactor createChaptersAndRefTable. 2022-11-06 09:54:25 -08:00
John MacFarlane f9ce4ff4d0 T.P.Writers.Shared: refactor toTableOfContents.
We now export `toTOCTree` and `SecInfo`, which provide a more neutral
way of generating TOC information from Blocks, and we use these in
`toTableOfContents`.

This is desirable because some output formats may require a TOC
structure that isn't just a rendered pandoc list.
2022-11-06 09:50:14 -08:00
John MacFarlane 848f6b51b2 Text.Pandoc.App: Change parseOptionsFromArgs and parseOptions... (#8406)
They now return `Either OptInfo Opt`.

Add `OptInfo` type.

Add `handleOptInfo` function.  This performs the IO actions for
things like `--version` that were previously done in `parseOptionsFromArgs`.
An argument for a `ScriptingEngine` has been added, to facilitate
printing custom templates and custom extensions for Lua filters.
(However, at this stage nothing is yet done with it.)

[API change]
2022-11-02 19:07:22 -07:00
John MacFarlane 8718fab964 EPUB writer: add includeTitlePage param to createNavEntry.
So far this isn't used, but it contributes to solving #6097.
2022-11-02 10:20:41 -07:00
John MacFarlane df8e8230c5 EPUB writer: Simplify params for createNavEntry. 2022-11-02 10:16:19 -07:00
John MacFarlane 61d93d2450 ODT reader: handle "section" elements.
Previously these were simply skipped! Closes #8409.
2022-11-02 09:56:22 -07:00
John MacFarlane b3f4a66ec8 ipynb reader: add cell id to attachment filename...
...when storing in the MediaBag. Otherwise attachments with the same name
can overwrite each other.  Closes #8415.
2022-11-02 09:23:09 -07:00
John MacFarlane 0c641c1025 Fix import. 2022-10-31 22:15:09 -07:00
John MacFarlane 9620ce3ea0 Add explicit imports to fix compiler warnings. 2022-10-31 21:20:52 -07:00
John MacFarlane df36019768 First stab at mtl 2.3 compliance.
This will no doubt produce a bunch of warnings and hence CI
failures, which we'll need to work around with explicit imports.
2022-10-31 16:51:51 -07:00
John MacFarlane c7af10fe89 hlint suggestions. 2022-10-30 12:37:19 -07:00
John MacFarlane 8b3be07ae8 hlint suggestions. 2022-10-30 11:02:00 -07:00
John MacFarlane cd6945fb4b Fix an import warning. 2022-10-29 14:34:09 -07:00