Commit graph

7986 commits

Author SHA1 Message Date
Albert Krewinkel
0d7f80c87f
HTML reader: allow sublists that are not marked as items.
The HTML standard requires all list items to be marked with a `<li>`
tag, but some tools fail to do so for sublists. The reader now accepts
these unwrapped lists as sublists.

Closes: #8150
2022-08-03 15:00:35 +02:00
Albert Krewinkel
b306f2e1fd
Org reader: add missing / to Windows file URI; fixes prev commit 2022-08-03 09:51:13 +02:00
Albert Krewinkel
096863e0ad fillMediaBag: Keep attributes of original image on Span
Images that cannot be fetched are replaced with a Span that contains the
image's description. The span now also retains all original image
attributes and inherits all attributes of the image. Furthermore, the
classes `image` and `placeholder` are added, and path and title are
store in attributes `original-image-src` and `original-image-title`,
respectively.

Closes: #8099
2022-08-02 20:09:14 -07:00
Albert Krewinkel
516c827d61
Org reader: recognize absolute paths on Windows
Fixes: #8201
2022-08-02 23:49:10 +02:00
Albert Krewinkel
7a4afce60c Markdown reader: allow special span classes in any position 2022-08-01 10:03:48 -07:00
Albert Krewinkel
f4a7c0b799 Markdown reader: allow more attributes in special spans
Spans with "smallcaps" as the first class are converted to *SmallCaps*
elements. While previously no other classes or attributes were allowed,
additional classes, attributes, and an identifier are not permitted and
kept in a *SmallCaps* wrapping *Span* element.

The same change is applied to underline spans, where the first class
must be either "ul" or "underline".

Closes: #4102
2022-08-01 10:03:48 -07:00
Albert Krewinkel
c015c35a8a
Support rowspans and colspans in grid tables (#8202)
* Add tests for zero-width and fullwidth chars in grid tables

* T.P.Parsing: simplify `gridTableWith'`, `gridTableWith` [API Change]
  The functions `gridTableWith` and `gridTableWith'` no longer takes a
  boolean argument that toggles whether a table head should be parsed:
  both, tables with heads and without heads, are always accepted now.

* Support colspans, rowspans, and multirow headers in grid tables.

  Grid tables in Markdown, reStructuredText, and Org can now contain cells
  spanning over multiple columns and/or multiple rows; table headers
  containing multiple rows are supported as well.

Note: the markdown writer does not yet support these more complex grid
table features.
2022-07-30 08:56:44 -07:00
John MacFarlane
f637ccd3bf MediaWiki reader: allow HTML comment after row start.
Closes #8110.
2022-07-28 11:28:02 -07:00
John MacFarlane
5c3423f2e2 DokuWiki reader: support latex plugin and math.
The `tex_math_dollars` extension is now supported for `dokuwiki`
(but off by default).

Content inside `<latex>...</latex>` is parsed as raw LaTeX inline,
and inside `<LATEX>..</LATEX>` as raw LaTeX block.

In addition, this commit changes the behavior of `<php>...</php>` so
that instead of producing a code block, it produces raw HTML
with `<?php ... ?>`.

Closes #8178.
2022-07-28 11:28:02 -07:00
Albert Krewinkel
aaf69044b1
Populate mediabag after filters have run. (#8114)
The mediabag is filled with document resources after the filters have
run. This allows, for example, filter authors to modify image paths
before pandoc tries to fetch the images.

Lua filters that rely on a filled mediabag can use the new
`pandoc.mediabag.fill` function to perform that action in the filter.

Closes: #8099
2022-07-28 10:50:00 -07:00
John MacFarlane
1f83f19c92 EPUB writer: allow choice of math method for v3.
Previously we always used MathML for math in EPUB3, because
the spec includes MathML.  But this is not widely supported
by readers, so it seems better to allow users to choose their
math method as they can with EPUB2 or HTML.

Closes #8164.

NOTE!  Existing workflows that produce EPUBv3 documents including
math will be affected by this change.  You must add `--mathml` to
your command line if you want to continue producing MathML.
2022-07-26 10:29:18 -07:00
John MacFarlane
ac7fa3da4d HTML writer: Allow "spanlike" classes to be combined.
Previously classes like "underline" and "marked" had to
be the first class in a span in order for the span to be
interpreted as a "ul" or "mark" element.  This commit allows
these special classes to be "stacked," e.g.
`[test]{.mark .underline}`; in addition, the special classes are no
longer required to come first in the list of classes.

See #8194 for context.
2022-07-25 11:55:48 -07:00
John MacFarlane
4ea51b6e96 --self-contained: Handle url() in style elements.
Previously we handled these in included CSS files but not
in style elements.

Closes #8193.
2022-07-23 00:34:09 +02:00
John MacFarlane
e90ce8e1ab Unescape characters in \lstinline inside \passthrough.
For full motivation, see #1629 ; this improves on
99e24cf183.

Closes #8179.
2022-07-18 19:52:33 +02:00
Albert Krewinkel
dfbfbfbf24
Parsing.GridTable: remove use of unsafe function last 2022-07-18 12:14:54 +02:00
John MacFarlane
98fb8521a7 RST writer: Fix missing spaces with nested inlines.
Previously spaces around links inside italics were omitted.

Closes #8182.
2022-07-16 15:49:45 +02:00
Albert Krewinkel
daef24f022
Lua: extend pandoc.system module. (#8184)
The module now has the additional functions `list_directory`,
`make_directory`, and `remove_directory`. This makes it easier to write
cross-platform scripts that need to inspect or modify the file system.
2022-07-15 21:22:33 +02:00
Albert Krewinkel
12cc140272
Lua: add fields pandoc.readers and pandoc.writers. (#8177)
The set of supported input and output formats is made available to Lua
users.
2022-07-12 20:14:42 +02:00
John MacFarlane
c7f5fd2400 RST writer: always escape literal backslash.
Previously we didn't escape it when it is word-internal,
but that seems wrong.  See #8178.
2022-07-12 20:11:05 +02:00
John MacFarlane
cf57a8344a Fix roff ms syntax highlighting definitions.
Begin each string definition with `\&`.
Closes #8175. Thanks to Branden Robinson.
2022-07-11 23:58:13 +02:00
John MacFarlane
56051c8ac3 RTF reader: support \nosupersub.
Closes #8170.
2022-07-07 22:56:29 +02:00
Elliot Bobrow
7fdc01ac0d
Use formatCode from #7525 in HTML and MediaWiki (#8162)
Move formatting from inside inline code elements to the outside in order
to retain formatting.
2022-07-06 22:10:24 +02:00
John MacFarlane
befa9d1301 Ensure that Nulls are ignored in creating slide shows.
Also ensure that Nulls are ignored in sectionification
by `makeSections`.

Closes #8155.
2022-07-04 14:34:14 +02:00
John MacFarlane
c1ccbc553f PDF: use sha1 hash of filename when converting svg.
The previous code threw away the directory component of
the filename in constructing a new one. This led to
surprising results if you had e.g. `foo/pic.svg` and `bar/pic.svg`;
in the final PDF they'd be the same image, because the latter
would overwrite the former in the temp directory.
2022-06-24 17:52:39 -07:00
Albert Krewinkel
6d351df1ed
Lua: ensure that tables marshaled via JSON arrays behave like Lists.
This allows to invoke methods like `map` and `includes` on lists like
`PANDOC_WRITER_OPTIONS.extensions`.
2022-06-23 22:53:11 +02:00
black-desk
2abf56f508
Remove extra soft break for tasklist (#8142)
Browser will display the extra newline character between checkbox and
text as a space, which make tasklist items cannot be aligned.

I just remove it.
2022-06-23 09:59:11 -07:00
John MacFarlane
3876f15b45 Ensure that metadata values w/o trailing newlines are...
parsed as inlines, as the manual states.

Previously, they were parsed as inlines if they would
otherwise have been a single Plain or Para, but otherwise
left unchanged.  This led to some quirky results (e.g. #8143).
We now use the general function `blocksToInlines` from T.P.Shared.
2022-06-22 23:09:51 -07:00
Albert Krewinkel
f49bee5c31
ConTeXt writer: support complex table structures. (#8116)
The following table feature are now supported in ConTeXt:

- colspans,
- rowspans,
- multiple bodies,
- row headers, and
- multi-row table head and foot.

The wrapping `placetable` environment is also given a `reference` option
with the table identifier, enabling referencing of the table from within
the document.
2022-06-21 10:22:34 -07:00
Gabriel Lewertowski
ab712246f0
Update fonts MIME following IANA recommendation (#8127) 2022-06-21 10:21:34 -07:00
Elliot Bobrow
f317ec41a1
LaTeX: Handle formatted text inside code inline (#8129)
Add `formatCode` function to Text.Pandoc.Shared [API change].

Use this in the LaTeX reader so that e.g.
`\texttt{\textbf{bold code}}` is parsed as `Strong [Code ("",[],[]) "bold code"]`.
2022-06-20 12:18:05 -07:00
Georgi Lyubenov
a21d6e9fa6
Future compat against liftA2 export from Prelude (#8132) 2022-06-19 12:36:21 -07:00
Amir Dekel
5fe154deb2
Org reader: Fix Post / Pre mixup when setting emphasis chars (#8134) 2022-06-19 19:52:56 +02:00
Albert Krewinkel
f39eeba35f
Lua: do not reset foreign encoding before running Lua
This was a leftover from previous hslua versions that relied heavily on
`Foreign.C.withCString` and the like. However, hslua 2 and later use
bytestring functions to retrieve string values, so this is no longer
needed.
2022-06-19 14:33:33 +02:00
John MacFarlane
a6344893b0 Use dev version of citeproc. 2022-06-15 10:52:26 -06:00
Elliot Bobrow
6ff4972ca9
add --embed-resources flag (#8121)
* Add `--embed-resources` flag for `--self-contained` without implying
  `--standalone`
* Deprecate `--self-contained flag`

Closes #7331
2022-06-14 17:00:18 -06:00
John MacFarlane
b263f38304 LaTeX reader: improve mathEnvWith.
When converting e.g. an align environment to an aligned environment
inside a Math element, we need to include a newline before the
`\end{aligned}`, since the previous line might end in a comment.

Closes #8122.
2022-06-13 23:14:51 -06:00
Wentao Han
8197ae00b8
LaTeX writer: Extend list of book documentclasses (#8053) 2022-06-10 08:42:14 -07:00
Albert Krewinkel
42cbc71bbc
Allow placing custom readers and writers in data subdir (#8112)
* PandocMonad: add new function `findFileWithDataFallback` [API Change]
* Custom readers: allow files to be placed in "readers" data dir
* Custom writers: allow files to be placed in "writers" data dir
2022-06-10 08:37:12 -07:00
Albert Krewinkel
2200b9c8ff
TikiWiki: support underlined text 2022-06-10 11:29:00 +02:00
Albert Krewinkel
7e6ccda6d9
Lua: use only old ByteString functions.
The function `takeWhileEnd` was added with bytestring-0.11.3.0, but older
versions should be supported as well.

Fixes the previous commit.
2022-06-09 08:54:06 +02:00
Albert Krewinkel
b3cee8bdb0
Lua: Simplify module loading code.
Modules are now loaded directly; the special pandoc Lua package searcher
is no longer necessary and has been removed.
2022-06-08 22:45:28 +02:00
YI
665d5b0fbd org reader: recognize {webp,jxl} files as images 2022-06-08 12:29:50 +02:00
Albert Krewinkel
b2b21bb4c5
Lua: add function pandoc.mediabag.fill (#8104)
The function allows to fill the mediabag with all images in a given
document. Images that cannot be fetched are replaced with a Span
containing the image description.
2022-06-06 09:25:09 -07:00
Albert Krewinkel
e5c41f11de
ConTeXt writer: use "sectionlevel" environment for headings (#8106)
The document hierarchy is now conveyed using the
`\startsectionlevel`/`\stopsectionlevel` by default. This makes it easy
to include pandoc-generated snippets in documents at arbitrary levels.
The more semantic environments "chapter", "section", "subsection", etc.
are used if the `--top-level-division` command line parameter is set to
a non-default value.

Closes: #5539
2022-06-06 09:24:28 -07:00
Albert Krewinkel
9d268e56ed
ConTeXt writer: unify link handling (#8096)
Autolinks, i.e. links with content that's the same as the linked URL,
are now marked with the `\url` command. All other links, both internal
and external, are created with the `\goto` command, leading to shorter,
slightly more idiomatic code. As before, autolinks can still be styled
via `\setupurl`, other links via `\setupinteraction`.
2022-06-04 21:49:53 -07:00
Albert Krewinkel
cc2849ccd0
Docx writer: prevent crashing when handling invalid tables
Tables with different numbers of cells per row would sometimes crash
pandoc. This fix prevents this by cutting off overlong rows.

Fixes: #8102
2022-06-05 00:00:51 +02:00
John MacFarlane
ad845c0376 makeSections: don't make a section for a div with class "fragments".
Closes #8098.
2022-06-02 09:01:18 -07:00
John MacFarlane
98a1b921e3 HTML writer: fix bug with --number-offset.
This formerly caused section divs to be produced, even
when `--section-divs` was not specified.  Closes #8097.
2022-06-02 08:46:26 -07:00
John MacFarlane
f53977e295 LaTeX writer: Improve grouping with autocites.
Closes #8088.
2022-06-01 23:24:49 -07:00
John MacFarlane
e8be78f91a Fix treatment of extensions for \input in LaTeX reader.
Previously we required a `.tex` extension, but TeX
allows any extension for `\input` (as opposed to `\include`).

Closes #8092.
2022-06-01 09:07:47 -07:00