875 Commits
Author SHA1 Message Date
John MacFarlane 6c934abe6d Citeproc: Fix bug in metaValueToReference.
This bug caused us to get some repeated content when converting
MetaBlock to Inlines.  Closes #8611.
2023-02-09 20:02:39 -08:00
John MacFarlane 1a7146ba70 Handle % in biblatex doi field.
Closes #8595.
2023-02-01 14:20:05 -08:00
John MacFarlane 58dfc3115a Add some diagnostics to newif test. 2023-02-01 09:17:45 -08:00
John MacFarlane 23178ec96e LaTeX reader: Fix bug in macro resolution for environments.
This is a regression in pandoc 3.0 that affects environments
with arguments.  Closes #8573.
2023-01-23 12:48:49 -08:00
John MacFarlane 6ebabd2118 HTML writer: don't omit newlines in task lists. 2023-01-20 10:29:40 -08:00
John MacFarlane 62e14233cd HTML writer: don't disable checkboxes in task lists.
Closes #8562.
2023-01-20 09:53:33 -08:00
Albert Krewinkel 8e688c2b0c Add tests for org tags
These were intended to be part of commit 0cc908519.
2023-01-16 18:21:36 +01:00
Albert Krewinkel ca6d4bfa49 Markdown, CommonMark: add support for wiki links. [API change]
Adds the Markdown/CommonMark extensions `wikilinks_title_after_pipe` and
`wikilinks_title_before_pipe`. The former enables links of style `[[Name
of page|Title]]` and the latter `[[Title|Name of page]]`. Titles are
optional in both variants, so this works for both:
`[[https://example.org]]`, `[[Name of page]]`.

The writer is modified to render links with title `wikilink` as a
wikilink if a respective extension is enabled.

Pandoc will use `wikilinks_title_after_pipe` if both extensions are
enabled.

Closes: #2923
2023-01-15 10:46:55 -08:00
John MacFarlane 676a6b1f82 Remove block constructor Null from the code base.
It has been removed from pandoc-types.
2023-01-13 15:20:50 -08:00
Albert KrewinkelandAner Lucero 909ced5153 Support complex figures. [API change]
Thanks and credit go to Aner Lucero, who laid the groundwork for this
feature in the 2021 GSoC project. He contributed many changes, including
modifications to the readers for HTML, JATS, and LaTeX, and to the HTML
and JATS writers.

Shared (Albert Krewinkel):

- The new function `figureDiv`, exported from `Text.Pandoc.Shared`,
  offers a standardized way to convert a figure into a Div element.

Readers (Aner Lucero):

- HTML reader: `<figure>` elements are parsed as figures, with the
  caption taken from the respective `<figcaption>` elements.

- JATS reader: The `<fig>` and `<caption>` elements are parsed into
  figure elements, even if the contents is more complex.

- LaTeX reader: support for figures with non-image contents and for
  subfigures.

- Markdown reader: paragraphs containing just an image are treated as
  figures if the `implicit_figures` extension is enabled. The identifier
  is used as the figure's identifier and the image description is also
  used as figure caption; all other attributes are treated as belonging
  to the image.

Writers (Aner Lucero, Albert Krewinkel):

- DokuWiki, Haddock, Jira, Man, MediaWiki, Ms, Muse, PPTX, RTF, TEI,
  ZimWiki writers: Figures are rendered like Div elements.

- Asciidoc writer: The figure contents is unwrapped; each image in the
  the figure becomes a separate figure.

- Classic custom writers: Figures are passed to the global function
  `Figure(caption, contents, attr)`, where `caption` and `contents` are
  strings and `attr` is a table of key-value pairs.

- ConTeXt writer: Figures are wrapped in a "placefigure" environment
  with `\startplacefigure`/`\endplacefigure`, adding the features
  caption and listing title as properties. Subfigures are place in a
  single row with the `\startfloatcombination` environment.

- DocBook writer: Uses `mediaobject` elements, unless the figure contains
  subfigures or tables, in which case the figure content is unwrapped.

- Docx writer: figures with multiple content blocks are rendered as
  tables with style `FigureTable`; like before, single-image figures are
  still output as paragraphs with style `Figure` or `Captioned Figure`,
  depending on whether a caption is attached.

- DokuWiki writer: Caption and "alt-text" are no longer combined. The
  alt text of a figure will now be lost in the conversion.

- FB2 writer: The figure caption is added as alt text to the images in
  the figure; pre-existing alt texts are kept.

- ICML writer: Only single-image figures are supported. The contents of
  figures with additional elements gets unwrapped.

- HTML writer: the alt text is no longer constructed from the caption,
  as was the case with implicit figures. This reduces duplication, but
  comes at the risk of images that are missing alt texts. Authors should
  take care to provide alt texts for all images.

  Some readers, most notably the Markdown reader with the
  `implicit_figures` extension, add a caption that's identical to the
  image description. The writer checks for this and adds an
  `aria-hidden` attribute to the `<figcaption>` element in that case.

- JATS writer: The `<fig>` and `<caption>` elements are used write
  figures.

- LaTeX writer: complex figures, e.g. with non-image contents and
  subfigures, are supported. The `subfigure` template variable is set if
  the document contains subfigures, triggering the conditional loading
  of the *subcaption* package. Contants of figures that contain tables
  are become unwrapped, as longtable environments are not allowed within
  figures.

- Markdown writer: figures are output as implicit figures if possible,
  via HTML if the `raw_html` extension is enabled, and as Div elements
  otherwise.

- OpenDocument writer: A separate paragraph is generated for each block
  element in a figure, each with style `FigureWithCaption`. Behavior for
  single-image figures therefore remains unchanged.

- Org writer: Only the first element in a figure is given a caption;
  additional block elements in the figure are appended without any
  caption being added.

- RST writer: Single-image figures are supported as before; the contents
  of more complex images become nested in a container of type `float`.

- Texinfo writer: Figures are rendered as float with type `figure`.

- Textile writer: Figures are rendered with the help of HTML elements.

- XWiki: Figures are placed in a group.

Co-authored-by: Aner Lucero <4rgento@gmail.com>
2023-01-13 09:13:27 -08:00
Albert Krewinkel 7f5bd4031b Use jira-wiki-markup 1.5.0
Fixed issues with icon-like sequences at the beginning of words.

Fixes: #8511
2023-01-11 14:55:01 +01:00
John MacFarlane 0d891afab6 isURI: don't require non-ASCII characters to be escaped.
Closes #8508.
2023-01-05 21:14:02 -08:00
John MacFarlane 7a82686adc Use \toprule\noalign{} instead of \toprule() in LaTeX tables.
And similar for `\midrule` and `\bottomrule`.

This facilitates redefining `\toprule`, `\midrule`, and `\bottomrule`
without needing to gobble the ()s.

Closes #8223.
2023-01-04 13:57:41 -08:00
John MacFarlane 6c96340bf6 Support "software" type in biblatex <-> CSL conversions.
Closes #8504.
2022-12-22 17:30:44 -08:00
Albert Krewinkel 1328e57f08 Shared: use LineBreak as default block sep in blocksToInlines
This change also affects the `pandoc.utils.blocks_to_inlines` Lua
function.

Closes: #8499
2022-12-20 13:39:16 -08:00
Albert Krewinkel c954dfab59 Markdown writer: avoid HTML fallbacks in the generated TOC.
The generated table of contents usually has IDs for each TOC link,
allowing to link back to specific parts of the TOC. However, this leads
to unidiomatic markup in formats like gfm, which do not support
attributes on links and hence fall back to HTML. The IDs on TOC items
are now removed in that case, leading to more aesthetic TOCs.

Closes: #8131
2022-12-20 18:21:16 +01:00
Albert Krewinkel 0d6c2e3e22 ConTeXt writer: fix previous commit for some unlisted sections
Unlist sections even if `--top-level-division` is not defined.
2022-12-16 14:09:09 +01:00
Albert Krewinkel da2d7ce6f5 ConTeXt writer: add support for unlisted, unnumbered headings
Closes: #8486
2022-12-16 13:48:57 +01:00
John MacFarlane 1698af8885 Textile reader: handle empty paragraphs.
Also, if attributes are added explicitly to a paragraph,
put it in a Div with the attributes.

Closes #8487.
2022-12-15 12:38:36 -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
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
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
Albert Krewinkel fb5da4a8c6 Fix command test #7743 for Windows 2022-11-23 10:01:46 +01:00
John MacFarlane 4b4771f062 Docx reader: Support parsing of highlighted text. 2022-11-19 13:28:10 -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
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
John MacFarlane 91436ebbf4 T.P.Writers.Shared toTableOfContents: handle nested Divs better.
Closes #8402.
2022-10-27 12:46:59 -07:00
John MacFarlane 400d4e1387 LaTeX reader: parse short table caption.
See jgm/pandoc-types#103.

This is not too useful yet, because writers don't do anything with
the short caption.
2022-10-21 11:44:12 -07:00
John MacFarlane e3fd2d5a03 Revert "HTML reader: avoid duplicating any existing identifier..."
This reverts commit e5fbddd3b6.
2022-10-18 12:51:34 -07:00
John MacFarlane ff22116426 Revert "Markdown reader: avoid duplicate ids with auto_identifiers."
This reverts commit eff82cfe4d.
2022-10-18 12:51:12 -07:00
John MacFarlane eff82cfe4d Markdown reader: avoid duplicate ids with auto_identifiers.
We previously avoided generating a duplicate with another automatically
generated identifier; now we also avoid duplicates with explicit
identifiers that occur before the header for which an identifier
is being generated.  (Collisions are still possible for identifiers
that occur after the header.)

T.P.Shared: `makeSections` is also modified so it doesn't give
bad results when the enclosing Div has a different identifier
from the header, as may now happen.
2022-10-18 12:42:12 -07:00
John MacFarlane e5fbddd3b6 HTML reader: avoid duplicating any existing identifier...
with `auto_identifiers`.

Closes #8383.
2022-10-18 09:51:33 -07:00
John MacFarlane abb7aab75f RST writer: improve inline escaping rules.
Also a small performance optimization.

Closes #8380.
2022-10-16 14:59:28 -07:00
Albert Krewinkel 7b7a7d6742 LaTeX writer: add separator line between table's body and its foot.
The writer uses features from the longtable package to define the table
foot. Furthermore, the table's bottom rule is now part of the foot,
where it previously was given as part of the body.
2022-10-06 22:07:25 +02:00
John MacFarlane b05c380f6f HTML writer: replace deprecated aria roles for bibliography entries.
`doc-biblioentry` -> `listitem`
`doc-bibliography` -> `list`

Closes #8354.
2022-10-05 11:58:50 -07:00
John MacFarlane dd07d8002f JATS writer: use <break/> for LineBreak...
in the limited contexts that accept it.

Closes #8344.
2022-10-01 17:46:13 -07:00
Albert Krewinkel 5be9052f5f [API Change] Extract Lua code into new package pandoc-lua-engine
The flag 'lua53` must now be used with that package if pandoc is to be
compiled against Lua 5.3.
2022-09-30 08:33:40 -07:00
John MacFarlane 48d0bfc675 Add --list-tables option.
[API change] Add writerListTables to WriterOptions.

RST writer: Remove sensitivity to "list-table" class in table attributes.
Instead, just check `writerListTables` in writer options.

See #4564.
2022-09-29 10:20:58 -07:00
danse c974ed0cae rST writer: list tables rendering, closes #4564
When a table is marked with a "list-table" attribute class, it will
now be rendered using the list table syntax documented here
http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table
2022-09-29 09:56:00 -07:00
John MacFarlane bcf06e7f5e HTML writer: prevent <a> inside <a>.
If a link text contains a link, we replace it with a span.
See #7585.
2022-09-28 08:34:50 -07:00
Albert Krewinkel b38292c234 LaTeX writer: do not repeat caption on headless tables
The caption of headless tables was repeated on each page that contained
part of the table. It is now made part of the "first head", i.e. the
table head that is printed only once.
2022-09-21 12:03:41 +02:00
John MacFarlane f3e9669e84 Commonmark writer: ensure that we don't have blank lines in raw HTML.
Closes #8307.
2022-09-19 12:03:03 -07:00
John MacFarlane cfbf0f096b Org reader: Allow org-ref v2 citations with & prefix.
Closes #8302.
2022-09-19 10:30:44 -07:00
John MacFarlane c0ff59c272 BibTeX parser: fix handling of % in url field.
`%` does not function as a comment character inside `url`
(where URL-encoding is common).

Commit 6fb2973a58 mistakenly
took this reassignment of `%` to be a general feature of
braced (but not quoted) BibTeX fields.

This commit restores the correct behavior of `%` in braced fields
other than `url`, and corrects the behavior of `%` in `url`
when the value is quoted.

Closes #7678 (again).
2022-09-18 19:17:48 -07:00
John MacFarlane 311a340687 Add prefixes to identifiers with --file-scope. (#8282)
This change only affects the case where `--file-scope` is used
and more than one file is specified on the command line.

In this case, identifiers will be prefixed with a string
derived from the file path, to disambiguate them. For example,
an identifier `foo` in `contents/file1.txt` will become
`contents__file1.txt__foo`.  Links will be adjusted accordingly:
if `file2.txt` links to `file1.txt#foo`, then the link will
be changed to point to `#file1.txt__foo`.  Similarly, a link
to `file1.txt` will point to `#file1.txt`.  A Div with an
identifier derived from the file path will be added around
each file's content, so that links to files will still work.

Closes #6384.

[API change]: Text.Pandoc.Shared exports `textToIdentifier`.
2022-09-18 18:11:40 -07:00
John MacFarlane 35a3fb7e83 Citeproc: Require a digit for an implicit "page" locator...
inside explicit locator syntax `{...}`.

Previously a locator specified as `{}` would be rendered
as `p.` with nothing after it.

Closes #8288.
2022-09-09 10:30:01 -07:00
John MacFarlane 86a3467ece HTML writer: only treat . . . as a slide pause in slides...
...and not in regular HTML output.
Closes #8281.
2022-09-05 09:51:59 -07:00
Albert Krewinkel 635b6e3953 Use dev version of gridtables
This allows to specify a table foot by enclosing it with part separator
lines, i.e., row separator lines consisting only of `+` and `=`
characters. E.g.:

    +------+-------+
    | Item | Price |
    +======+=======+
    | Eggs | 5£    |
    +------+-------+
    | Spam | 3£    |
    +======+=======+
    | Sum  | 8£    |
    +======+=======+

The last row, containing "Sum" and "8£", is the table foot.

Closes: #8257
2022-09-01 09:06:42 +02:00
Ruqi 8b5fb50198 Mediawiki reader: Parse table cell with attribs, to support rowspan, colspan (#8231) 2022-08-30 09:51:09 +02:00