Commit graph

7811 commits

Author SHA1 Message Date
John MacFarlane
6723891c72 Markdown writer: handle explicit column widths with pipe tables.
If a table has explicit column width information *and* the
content extends beyond the `--columns` width, we need to
adjust the widths of the pipe separators to encode this width
information.

Closes #7847.
2022-01-19 09:36:48 -08:00
Michael Hoffmann
e146b1ff3b
Docx writer: Separate tables even with RawBlocks between (#7844)
Adjacent docx tables need to be separated by an empty paragraph. If
there's a RawBlock between tables which renders to nothing, be sure to
still insert the empty paragraph so that they will not collapse
together.

Fixes #7724
2022-01-18 14:28:28 -08:00
John MacFarlane
c1717378b0 Fix some haddock errors. 2022-01-17 21:03:25 -08:00
John MacFarlane
545c0911aa T.P.App.Opt: fix logic bug in fullDefaultsPath.
Previously we would (also) search the default user data directory
for a defaults file, even if a different user data directory
was specified using `--data-dir`.  This was a mistake; if
`--data-dir` is used, the default user data directory should
not be searched.
2022-01-17 21:03:25 -08:00
John MacFarlane
a92ae0a58a T.P.Shared.defaultUserDataDir: behavior change.
If the XDG data directory is not defined (e.g. because
it's not supported in the OS or HOME isn't defined), we
return the empty string instead of raising an exception.

Closes #7842.
2022-01-17 21:03:25 -08:00
Albert Krewinkel
7f50324ff9
PDF: support pagedjs-cli as pdf engine (#7838)
PagedJS is a polyfill and supports the Paged Media standards by the W3C.
<https://www.pagedjs.org/>
2022-01-17 09:19:03 -08:00
Nikolai Korobeinikov
b683b8d48a
Support checklists in asciidoctor writer (#7832)
The checklist syntax (similar to `task_list` in markdown) seems to be
an asciidoctor-only addition.

Co-authored-by: ricnorr <ricnorr@yandex-tream.ru>
2022-01-16 11:05:19 -08:00
John MacFarlane
c40727bfbb Man writer: use custom font V for inline code.
The V font is defined conditionally, so that it renders
like CB in output formats that support that, and like B
in those that don't (e.g. the terminal).

We could just redefine C, but this would affect code
blocks, too, and putting them all in boldface looks ugly,
I think.

Possible drawback: fragments created by pandoc's man
writer will presuppose a nonstandard V font.

Closes #7506.
Supersedes 253467a549.
2022-01-15 12:39:19 -08:00
John MacFarlane
253467a549 Man writer: Use boldface for inline code.
Closes #7506.

This also allows us to get rid of some special casing
on definition lists that ensured that options in code
spans would be boldface.  (If this change is ever reverted,
we'll need that again.)
2022-01-15 12:07:18 -08:00
John MacFarlane
4214218256 T.P.Readers.LaTeX.Parsing: don't export totoks.
Make the first param of `tokenize` a SourcePos instead of
SourceName, and use it instead of `totoks`.
2022-01-14 21:27:33 -08:00
John MacFarlane
0d1ba3dce3 When reading defaults file, stop at a line ....
This line signals the end of a YAML document.
This restores the behavior we got with HsYaml.
yaml complains about content past this line.
See https://github.com/jgm/pandoc/issues/4627#issuecomment-1012438765
2022-01-13 11:58:33 -08:00
John MacFarlane
4fdbb30a97 Citeproc: allow notes-after-punctuation to work...
with numerical styles that use superscripts (e.g.
american-medical-association.csl), as well as with
note styles. The default setting of `notes-after-punctuation`
is true for note styles and false otherwise.

This restores a behavior of pandoc-citeproc that wasn't properly
carried over to Citeproc.

Closes #7826.
See also jgm/pandoc-citeproc#384.
2022-01-12 21:08:28 -08:00
Michael Hoffmann
5001fd3f4d
Docx writer: Handle bullets correctly in lists by not reusing numIds (#7822)
Make sure that we only create one bullet per list item in docx.  In
particular, when a div is a list item, its contained paragraphs will
now no longer wrongly get individual bullets.

This is accomplished by making sure that for each list, we only use
the associated numId once.  Any repeated use would add incorrect
bullets to the document.

Closes #7689
2022-01-11 15:48:41 -08:00
John MacFarlane
a25e79b5be DocBook reader: Collapse internal spaces in literal...
and other similar tags.  This seems to accord with what
the docbook toolchain does.

Closes #7821.
2022-01-10 11:47:55 -08:00
John MacFarlane
7bf1191686 HTML writer: don't break attributes values when wrapping. 2022-01-10 10:40:49 -08:00
John MacFarlane
6f739cdb4d Fix regression: allow blank lines in HTML attributes.
The commit 7a9832166e
had the effect that blank lines would be collapsed
in HTML attributes.

We also roll back a change that collapsed multiple
spaces into one.
2022-01-10 10:29:25 -08:00
John MacFarlane
2e50c8d137 Improve abstract in HTML template.
* Add localized title "abstract", unless `abstract-title` variable
  is set.
* Add `abstract-title` div to abstract CSS.
* Move abstract CSS out of CSL conditional.
* Ensure that abstract is aligned left but indented on all sides.
* Use smaller font for abstract.

Improves #7588.
2022-01-09 10:56:28 -08:00
Lucas Viana
fb91a91615 Org reader: support alphabetical (fancy) lists
This adds support for alphabetical lists in org by enabling the
extension Ext_fancy_lists, mimicking the behaviour of Org Mode when
org-list-allow-alphabetical is enabled.

Enabling Ext_fancy_lists will also make Pandoc differentiate between the
delimiters of ordered lists (periods or closing parentheses). Org does
this differentiation by default when exporting to some formats (e.g.
plain text) but does not in others (e.g. html and latex), so I decided
to copy Pandoc's markdown reader behaviour.
2022-01-09 09:39:27 -08:00
John MacFarlane
66636c89b0 Org writer: fix list items starting with a code block...
or other non-paragraph content.

Closes #7810.
2022-01-08 23:21:15 -08:00
John MacFarlane
61968047e4 Avoid blank lines after tight sublists in org, haddock.
T.P.Writers.Shared `endsWithPlain` now returns True if
the list ends with a list which ends with a Plain.

See #7810.
2022-01-08 23:11:08 -08:00
John MacFarlane
1b7bdb1016 RST writer: avoid extra blank line after empty list item.
See #7810 (2).
2022-01-08 21:24:41 -08:00
John MacFarlane
8736fe11ee Org writer: fix extra blank line inserted after empty list item.
Addresses issue 2 from #7810.
2022-01-08 21:22:21 -08:00
John MacFarlane
252211bd27 Org writer: don't add blank line before lists.
The code to do this was apparently copied over from the RST
writer, but these blank lines aren't necessary or desirable
in org.  See #7810 comment 3.
2022-01-08 19:39:26 -08:00
John MacFarlane
a6741bd555 writeMedia: unescape percent-encoding in creating file path.
Closes #7819 (problem with spaces in image filenames when creating
PDFs).
2022-01-08 19:10:46 -08:00
John MacFarlane
2b51f54e19 toLocatorMap: store keys as lowercase.
We want to do a case-insensitive comparison when parsing
locators, so that e.g. both `Chap.` and `chap.` work.

Previously we lowercase terms when doing the lookup,
but they weren't lowercased in the map itself, which
led to locator-detection breaking for German (where the
terms have uppercase letters).

See
https://groups.google.com/d/msgid/pandoc-discuss/1dd44886-7b79-4e5f-97ec-57b91113df36n%40googlegroups.com
2022-01-08 16:57:59 -08:00
John MacFarlane
2986a06aaa T.P.Readers.LaTeX.SIunitx: explicit imports. 2022-01-07 18:00:57 -08:00
John MacFarlane
a965111680 Fix parsing of footnotes in --metadata-file.
Closes #7813.
2022-01-07 15:58:26 -08:00
Lucas Viana
45e2e0d018 Org writer: support starting number cookies
This complements #7806 by supporting writing Org ordered lists that
start at a specific number.
2022-01-07 10:48:28 -08:00
John MacFarlane
d562de5039 Add LaTeX babel mappings for Guajati (gu) and Oriya (or).
Closes #7815.
2022-01-07 10:25:34 -08:00
John MacFarlane
90e74c2b76 Fix typo panjabi -> punjabi.
This affects the mapping to Babel language names in the
LaTeX reader and writer.  Closes #7814.
2022-01-07 10:08:41 -08:00
Jesse Hathaway
4dcb2b6fb6 MediaWiki writer: Remove redundant display text for wiki links
Prior to this commit the MediaWiki writer always added the display
text for a wiki link:

    * [[Help|Help]]
    * [[Bubbles|Everyone loves bubbles]]

However the display text in the first example is redundant since
MediaWiki uses the target as the default display text. The result being:

    * [[Help]]
    * [[Bubbles|Everyone loves bubbles]]
2022-01-06 15:05:39 -08:00
John MacFarlane
0d99a131b1 reveal.js: Make sure images with r-stretch are not in p tags.
They must be direct children of the section.
There was previously code to make this work with the older
class name `stretch`.
See https://github.com/jgm/pandoc/issues/5965#issuecomment-1006623836
2022-01-06 10:56:33 -08:00
John MacFarlane
517d7a9cd3 reveal.js: don't add r-fit-text class to section.
It must go on header only.  See
https://github.com/jgm/pandoc/issues/5965#issuecomment-1006623836
2022-01-06 10:45:15 -08:00
Lucas Viana
4be41e3bb5 Org reader: support counter cookies in lists
This adds support for counter cookies in org lists. Such cookies are
used to override the item counter in ordered lists. In org it is
possible to set the counter at any list item, but since Pandoc AST does
not support this, we restrict the usage to setting an offset for the
entire ordered list, by using the cookie in the first list item.

Note that even though unordered lists do not have counters, Org Mode
still parses such cookies in unordered lists and suppresses them in the
output, so we do the same.

Also, even though org-list-allow-alphabetical is disabled in Emacs by
default, for some reason alphabetical cookies are always parsed and used
in Org Mode regardlessly of whether this option is enabled or the list
style is decimal, so we do the same.

E.g.
 2. test
 3. test
Is parsed as an ordered list starting at 1, as before. This also
conforms to Org Mode behaviour.

 1. [@2] test
 2. test
Is now parsed as an ordered list starting at 2, so that it conforms to
Org Mode behaviour.

Note that when parsing
 1. [@2] test
 2. [@9] test
the second cookie is silenced and the entire list starts at 2. This is
because the current Pandoc AST does not support expressing a change in
the counter at a specific item.
2022-01-06 19:33:13 +01:00
John MacFarlane
ea74582288 AsciiDoc writer: improve detection of intraword emphasis.
Closes #7803.
2022-01-05 14:48:19 -08:00
Albert Krewinkel
1f8638fb54 Lua: add pandoc.template module
The module provides a `compile` function to use strings as templates.
2022-01-04 11:55:59 -08:00
Albert Krewinkel
974a9d353a Lua: marshal templates as opaque userdata values 2022-01-04 11:55:59 -08:00
Albert Krewinkel
6a5ac90bf1 Lua: add pandoc.WriterOptions constructor 2022-01-04 11:55:59 -08:00
Albert Krewinkel
0d1d52f0a0 Lua: add function pandoc.write 2022-01-04 11:55:59 -08:00
Albert Krewinkel
5c53837259 Stop exporting writeCustom from module T.P.Writers [API change]
This ensures that all writer exported in T.P.Writers are parameterized
and work with any `PandocMonad` type. This is consistent with
T.P.Readers, as `readCustom` is not exported from that module either.
2022-01-04 11:55:59 -08:00
John MacFarlane
322364ff66 Markdown writer: fix indentation issue in footnotes.
Closes #7801.
2022-01-03 18:50:44 -08:00
John MacFarlane
53699f2ab3 DocBook reader: be sensitive to spacing="compact" in lists.
When spacing="compact" is set, Para elements are turned
into Plain, so we get a "tight" list.

Closes #7799.
2022-01-03 14:19:53 -08:00
John MacFarlane
ca7a3ed5ed Issue error with --list-extensions for invalid formats.
Cloess #7797.
2022-01-03 11:08:14 -08:00
John MacFarlane
cdfdfae4dd parseFormatSpec: cleaner error message for invalid extensions. 2022-01-03 10:32:57 -08:00
John MacFarlane
0abfe4fdab Minor code improvement. 2022-01-03 10:26:18 -08:00
John MacFarlane
75c5218d4f Don't read sources until in/out format are verified.
Partially addresses #7797.
2022-01-03 10:16:07 -08:00
Tuong Nguyen Manh
32297d5677 Odt: Add list-header
The list-header is a type of list-item.
Therefore, it will be treated exactly like one.
2022-01-02 15:05:09 -08:00
Albert Krewinkel
b7a44f9d19 Copyright notices: update for 2022 2022-01-02 11:59:22 -08:00
Albert Krewinkel
efdba79ad1 Lua writer: allow variables to be set via second return value of Doc
New templates variables can be added by giving variable-value pairs as a
second return value of the global function `Doc`.

Example:

    function Doc (body, meta, vars)
      vars.date = vars.date or os.date '%B %e, %Y'
      return body, vars
    end

Closes: #6731
2022-01-02 11:55:02 -08:00
Albert Krewinkel
85334eb6c4
Lua writer: provide global PANDOC_WRITER_OPTIONS
Closes: #6731
2022-01-02 13:57:01 +01:00