Commit Graph
8892 Commits
Author SHA1 Message Date
John MacFarlane 93d745742d Docx reader: reset lists after headers in same list numId.
Headings in docx, even ones that do not have a visible number,
can have a numId, and in odd cases can even share a numId with
a list that continues after the header. In this case the list
numbering should be reset by the header.

To accomplish this, we add a Heading constructor to BodyPart and
include on it all the information list items have.

Closes #10258.
2024-10-03 22:21:59 -07:00
John MacFarlane 4211efaad1 Remove unnecessary import. 2024-10-01 11:04:31 -07:00
John MacFarlane 7048254397 Allow extracting data: URIs even in PandocPure (--sandbox).
These don't require IO, so we should allow it in sandboxed
mode.  Closes #10249.
2024-10-01 10:16:23 -07:00
John MacFarlane c3eec896ab Text.Pandoc.Class: export extractURIData.
[API change]
2024-10-01 10:15:50 -07:00
John MacFarlane 4f15b03ad2 RST writer: change bullet list hang from 3 to 2.
This accords with the style in the reference docs.
2024-10-01 09:19:53 -07:00
John MacFarlane 0d9cfc8ec0 Amend the fix to #10236 to handle list tables.
With this patch, we also reuse bullet list code for list tables,
which simplifies the code.
2024-10-01 08:47:29 -07:00
John MacFarlane 752d57dac1 RST writer: handle cases where indented context starts with block quote.
In these cases we emit an empty comment to fix the point from
which indentation is measured; otherwise the block quote is not
parsed as a block quote.

This affects list items and admonitions.

Cloess #10236.
2024-09-30 16:05:57 -07:00
John MacFarlane b4df43b01f LaTeX writer: better fix for lists in definition lists.
In commit a26ec96d89 we added an
empty `\item[]` to the beginning of a list that occurs first
in a definition list, to avoid having one item on the line with
the label.

This gave bad results in some cases (#10241) and there is a more
idiomatic solution anyway: using `\hfill`.

Closes #10241.
2024-09-30 14:38:36 -07:00
John MacFarlane 2a6268de67 Refactor latex template using partials.
+ Split out common parts of latex template into partials: common.latex,
  fonts.latex, font-settings.latex, passoptions.latex, hypersetup.latex,
  after-header-includes.latex.
+ Split out old latex template into default.latex and default.beamer.
+ Make default.beamer the default template for beamer.
2024-09-29 14:18:31 -07:00
Albert Krewinkel 7565a90cec Stop depending on package SHA
Pandoc already depends on `crypton-conntection`, and thus transitively
on `crypton`. The latter provides a vast variety of hashing algorithms
and makes the dependency on SHA unnecessary.
2024-09-29 18:36:56 +02:00
John MacFarlane 9a3aed9cee RST writer: fix two issues with list tables.
- Fix alignment of list items corresponding to cells.
- Don't enclose the list table in a `.. table::`; this leads to
  doubled captions.

Closes #10226.
Closes #10227.
Modified test output for #4564.
2024-09-27 09:15:23 -07:00
John MacFarlane 56fc7d5cfc LaTeX reader: add em, ex, px, mu to list of units for dimension args.
Closes #10212.
2024-09-24 08:53:32 -07:00
John MacFarlane f3fff87b2c EPUB reader: fix links to other files in the epub...
making them internal links to a fragment derived from the
filename.  There was already code to handle links like
`#foo`, but not to handle links like `ch0001.html#foo`.

Closes #10207.
2024-09-22 22:49:02 -07:00
Akash PatelandJohn MacFarlane ca348940e3 Add support for list of figures (lof) and list of tables (lot) (#10029)
Two new command-line options are added:

`--lof[=true|false]`, `--list-of-figures[=true|false]`
`--lot[=true|false]`, `--list-of-tables[=true|false]`

Only docx, latex, and context are supported at this point.

Setting the `lof` and `lot` variables will also work for the formats that are
currently supported.

[API changes]

+ Lua: `list_of_figures` and `list_of_tables` can now be used in writer options.
+ Text.Pandoc.Options:  add `writerListOfFigures` and `writerListOfTables` fields
  to `WriterOptions`.
+ Text.Pandoc.App.Opt: add `optListOfFigures` and `optListOfTables` to `Opt`.

Closes #8245.

Co-authored-by: John MacFarlane <jgm@berkeley.edu>
2024-09-22 11:49:52 -07:00
John MacFarlane 46ebe25b69 Dokuwiki reader: be more forgiving about misaligned lists...
like dokuwiki itself. Closes #8863.
2024-09-21 19:35:12 -07:00
John MacFarlane 98e77e02f6 Improve blockquote parsing in dokuwiki.
Allow for quoted code blocks.
2024-09-21 19:26:32 -07:00
John MacFarlane e452f0ca3f DokuWiki reader: enable smart extension. 2024-09-21 19:26:09 -07:00
John MacFarlane 8d35b794e3 DokuWiki reader: properly parse -- and --- as dashes. 2024-09-21 18:33:34 -07:00
John MacFarlane 7e6a3b063e DokuWiki reader: fix block quote behavior.
Closes #6461.

Blockquotes are not really block containers in DokuWiki;
the lines are interpreted literally (so, e.g., you can't
start a list), and line breaks are added at the ends.
2024-09-21 18:33:28 -07:00
John MacFarlane 16a9df8c6b DokuWiki writer: don't emit <HTML> tags.
The use of these tags is now strongly discouraged for security
reasons, and will be removed.

We previously used them as a fallback for lists that could not
be represented using DokuWiki syntax, e.g. ordered lists with
fancy numbers or lists with multiple blocks in their items.

We also used them for block quotes with multiple blocks as
their contents.

We now use the `<WRAP>` syntax (from the optional WRAP plugin)
to handle lists with multiple blocks as their contents.

A new method of handling block quotes with complex contents
has the side benefit of also handling nested block quotes,
which weren't supported before.

`<HTML>` and `<html>` tags are only for raw HTML blocks and
inlines, and only if the `raw_html` extension is enabled. (It is
now a valid extension for `dokuwiki`, though off by default.)

Closes #7413.
2024-09-21 16:58:01 -07:00
John MacFarlane 56854c22f4 Make env interpolation work for to and from fields...
...in defaults files. These can contain paths of custom readers and
writers. See #8024.
2024-09-16 09:45:47 -07:00
John MacFarlane 04825ceb6b Text.Pandoc.PDF: read .toc and .log files from output directory.
When this is different from the input directory, this is
where .toc and .log files are written.

Closes #10186.
2024-09-14 17:19:00 -07:00
Erik Rask 1cdf2672f2 Parse id, class, and tabstyle on tables in DocBook Reader
Add parsing of id (xml:id), class, and tabstyle XML attributes
for table and informaltable in the DocBook reader.
The tabstyle value is put in the 'custom-style' attribute.

fixes #10181
2024-09-14 10:21:53 -07:00
John MacFarlane 8d09a58857 LaTeX writer: avoid error on refs div with empty citations.
If there are no citations, don't emit an empty CSLReferences
environment.

Closes #10185.
2024-09-14 10:12:07 -07:00
John MacFarlane 8c14784f41 HTML writer: don't emit missing title/lang warnings if templates...
does not contain the `pagetitle` or `lang` variables respectively.

Closes #9370.
2024-09-13 20:45:19 -07:00
John MacFarlane fdbfb7a807 T.P.Shared addPandocAttributes - modify for new commonmark-pandoc.
The new commonmark-pandoc version automatically adds the
attribute `wrapper="1"` on all Divs and Spans that
are introduced just as containers for attributes that belong
properly to their contents.  So we don't need to add the
attribute here.

This gives much better results in some cases. Previously the
wrapper attribute was being added even for explicit Divs and
Spans in djot, but it is not needed in these cases.
2024-09-13 09:35:33 -07:00
Evan Silberman e81c2d4bf8 Fix copy-pasteo in ANSI writer subscripts
The ANSI Superscript writer was copy-pasted and incompletely modified to
create the Subscript output writer and I forgot to call the right
function, so subscripts were getting rendered with superscripted
numbers. Adds a line for this to the ANSI golden test.
2024-09-11 08:44:48 -07:00
John MacFarlane 320a8add03 Markdown writer: fix tex_math_gfm output for display math. 2024-09-10 08:22:48 -07:00
John MacFarlane 94f9727b2f ANSI writer: use black rather than green for headings. 2024-09-09 21:49:42 -07:00
Albert Krewinkel c0f995d0a3 Remove Text.Pandoc.Shared.stripEmptyParagraphs [API change]
This is no longer used.
2024-09-09 20:09:13 -07:00
Pau RE b7bcc42590 Add unofficial gemini URI scheme 2024-09-09 20:08:18 -07:00
thomjur 1881aef09e --docx+citations: Add "SuppressAuthor" and "AuthorOnly" to citationMode 2024-09-09 20:07:18 -07:00
Sebbones 7e04673fea Support custom-style attribute for docx table 2024-09-09 20:05:42 -07:00
John MacFarlane 7db0569250 Work around absence of NonEmpty.singleton in earlier base versions. 2024-09-09 08:18:08 -07:00
John MacFarlane ace048515f OpenDocument writer: Removed another use of 'head'. 2024-09-08 21:47:25 -07:00
John MacFarlane 7602e4995f T.P.Readers.ODT.Generic.XMLConverter: remove partial functions. 2024-09-08 21:38:28 -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 9855cd98e1 Remove most uses of partial function 'head'. 2024-09-08 12:50:30 -07:00
John MacFarlane cf3a583bd4 Avoid use of partial function 'tail'. 2024-09-08 09:52:50 -07:00
John MacFarlane 7a569b9c8f Initialize some missing fields in pandoc-server.
writerEpubTitlePage, writerChunkTemplate, writerListTables.
2024-09-08 09:41:17 -07:00
John MacFarlane e589dd62d7 Docx writer: Support --number-offsets. 2024-09-08 08:29:23 -07:00
John MacFarlane bdcbb67168 T.P.Opp: Change default for optNumberOffset to [].
This behaves the same as `[0,0,0,0,0]`.
2024-09-08 08:29:23 -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 7d672fccbd Markdown writer: make math sensitive to tex_math_gfm extension.
This means that in GFM output, the "new style" math will be used
by default, e.g.

    $`x=y`$

    ```math
    x = y
    ```

To defeat this and get the older behavior, namely

    $x=y$

    $$x=y$$

one could use `-t gfm-tex_math_gfm`.
See #9121.
2024-09-05 19:38:43 -07:00
John MacFarlane 89c0052fd6 HTML writer: don't add doc-biblioref role to every link...
in a citation; only to links to the bibliography. Closes #10156.
2024-09-05 13:38:43 -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 6be41d1c62 ANSI writer: Remove Figure and Table labels and numbers. 2024-09-03 14:26:53 -07:00