Commit graph

771 commits

Author SHA1 Message Date
John MacFarlane
581c94913f LaTeX reader: allow inline groups starting with \bgroup.
Closes #7953.
2022-03-09 17:53:00 -08:00
John MacFarlane
9b5ec100e5 Markdown writer: update escaping rules for \.
We now escape `\` only if `raw_tex` is enabled or
it is followed by a non-alphanumeric.
2022-03-07 10:46:07 -08:00
John MacFarlane
97c4f3f237 LaTeX reader: rudimentary support for vbox.
Closes #7939.
2022-02-27 23:24:30 -08:00
John MacFarlane
7f6021d7b2 Markdown writer: don't produce redundant header identifier...
when the `gfm_auto_identifiers` extension is set.

Closes #7941.
2022-02-26 11:37:46 -08:00
John MacFarlane
8ceea05c75 Markdown reader: remove restriction on identifiers...
so they no longer need to begin with a letter. Closes #7920.
2022-02-23 10:04:15 -08:00
Dimitris Apostolou
2f521081ad
Fix typos (#7934) 2022-02-22 09:05:39 -08:00
John MacFarlane
6fe8014a2c LaTeX reader: Handle \label and \ref for footnotes.
Closes #7930.
2022-02-19 11:55:46 -08:00
John MacFarlane
dc534caf7a Add tests for #7919.
Together with the update in commonmark-hs and previous changes,
this closes #7919.
2022-02-13 17:43:30 -08:00
John MacFarlane
85136b064f Markdown reader: allow one-column pipe tables with pipe on right.
See #7919.

We still need to implement this for gfm (commonmark).
This must be done via changes in commonmark-hs.
2022-02-13 13:06:49 -08:00
Albert Krewinkel
e1b7f3a63d
JATS reader: improve handling of fn-group elements (#7914)
Footnotes in `<fn-group>` elements are collected and re-inserted into
the document as proper footnotes in the place where they are referenced.

Fixes: #6348
2022-02-12 17:39:02 -08:00
damon-sava-stanley
01ec1ac43a
Put id attributes on TOC entries #7907 (#7913)
Naming scheme of id is "toc-" + id of linked to header/section.
In Shared, will effect HTML, Markdown, Powerpoint, and RTF.
2022-02-11 21:37:00 -08:00
John MacFarlane
03c6025379 Add command test for #7884. 2022-02-09 12:31:18 -08:00
John MacFarlane
6cc253aab6 RIS reader: support ID and DO fields. 2022-02-05 23:34:44 -08:00
John MacFarlane
3da5440858 Add RIS bibliography format reader.
New module, Text.Pandoc.Readers.RIS, exporting readRIS.

New input format `ris`.

Closes #7894.
2022-02-05 23:25:03 -08:00
Albert Krewinkel
a6fa3df114
HTML writer: avoid duplicate "style" attributes on table cells
Fixes: #7871
2022-01-28 18:20:14 +01:00
Even Brenden
d36a16a4df Don't read files outside of user data directory
If a file path does not exist relative to the working directory, but
it does exist relative to the user data directory, and it exists outside
of the user data directory, do not read it. This applies to readDataFile
and readMetadataFile in PandocMonad and, by extension, any module that
uses these by passing them relative paths.
2022-01-28 08:51:27 -08:00
John MacFarlane
a9f901cf6b CommonMark reader: fix source position after YAML metadata.
Closes #7863.
2022-01-23 22:13:58 -08:00
John MacFarlane
9e0d146837 Update command tests to distinguish stderr and test exit status. 2022-01-21 15:01:50 -08:00
Even Brenden
7df29e495f
Search for metadata files in $DATADIR/metadata (#7851)
If files specified with `--metadata-file` are not found in the working
directory, look in `$DATADIR/metadata`.

Expose new `readMetadataFile` function from Text.Pandoc.Class
[API change].

Expose new `PandocCouldNotFindMetadataFileError` constructor for
`PandocError` from Text.Pandoc.Error [API change].

Closes #5876.
2022-01-21 12:00:45 -08:00
John MacFarlane
52b78b10c8 Avoid putting a frame around speaker notes in beamer.
If speaker notes (a Div with class 'notes') occur right
after a section heading, but above slide level, the
resulting `\note{..}` caommand should not be wrapped in
a frame, as that will cause a spurious blank slide.

Closes #7857.
2022-01-20 19:09:44 -08:00
John MacFarlane
ef8135b4a7 HTML writer: don't break lines inside code elements.
With the new (default) line wrapping of HTML, in
conjunction with the default CSS which includes
`code { whitespace: pre-wrap; }`, spurious line
breaks could be introduced into inline code.

Closes #7858.
2022-01-20 09:17:34 -08:00
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
Albert Krewinkel
b794b534a5
Remove unused file test/command/jats.csl 2022-01-19 10:12:32 +01: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
e532bceb8a Add test for #7826 notes-after-punctuation. 2022-01-13 08:41:05 -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
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
a965111680 Fix parsing of footnotes in --metadata-file.
Closes #7813.
2022-01-07 15:58:26 -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
ea74582288 AsciiDoc writer: improve detection of intraword emphasis.
Closes #7803.
2022-01-05 14:48:19 -08:00
John MacFarlane
7d56650e01 OpenDocument writer: fix vertical align bug with display math.
Previously some displayed formulas would be floated above
a preceding text line.  This is fixed by setting vertical-rel
to 'text' rather than 'paragraph-content'.

Closes #7777.
2021-12-28 16:06:25 -08:00
John MacFarlane
c4f6e6cb57 HTML writer: make line breaks more consistent.
- With `--wrap=none`, we now output line breaks between
  block-level elements. Previously they were omitted
  entirely, so the whole document was on one line, unless
  there were literal line breaks in pre sections.  This makes
  the HTML writer's behavior more consistent with that of
  other writers.

- Put newline after `<dd>`.

- Put newlines after block-level elements in footnote section.
2021-12-22 09:45:02 -08:00
John MacFarlane
7a9832166e Add text wrapping to HTML output.
Previously the HTML writer was exceptional in not being
sensitive to the `--wrap` option.  With this change `--wrap`
now works for HTML. The default (as with other formats) is
automatic wrapping to 72 columns.

A new internal module, T.P.Writers.Blaze, exports `layoutMarkup`.
This converts a blaze Html structure into a doclayout Doc Text.

In addition, we now add a line break between an `img` tag
and the associated `figcaption`.

Note: Output is never wrapped in `writeHtmlStringForEPUB`.
This accords with previous behavior since previously the HTML
writer was insensitive to `--wrap` settings.  There's no real
need to wrap HTML inside a zipped container.

Note that the contents of script, textarea, and pre tags are
always laid out with the `flush` combinator, so that unwanted
spaces won't be introduced if these occur in an indented context
in a template.

Closes #7764.
2021-12-22 09:45:02 -08:00
John MacFarlane
4b220d592c Citeproc: avoid adding comma before an author-in-text citation...
...in a note if it begins with a title (no author).

Closes #7761.
2021-12-18 12:13:06 -08:00
John MacFarlane
394fa9d072 Org reader: parse official org-cite citations.
We also support the older org-ref style as a fallback.
We no longer support the "markdown-style" citations.

See #7329.
2021-12-14 11:34:32 -08:00
John MacFarlane
9f089aa286 Org writer: add tests for org-cite citations, and improve support. 2021-12-13 12:11:58 -08:00
John MacFarlane
ccb9db34f8 Add test for #7738. 2021-12-07 23:59:59 -08:00
John MacFarlane
51f6f0e3a1 Improve Markdown writer escaping.
This fixes escaping for '#' in particular.
Closes #7726.
2021-12-03 17:52:47 -08:00
John MacFarlane
619dfa2a2a Markdown reader: don't allow ^ at beginning of link or image label.
This is reserved for footnotes.
Fixes a regression introduced by 0a93acf.

Closes #7723.
2021-11-30 12:53:54 -08:00
John MacFarlane
0d25232bbf LaTeX reader: Fix semantics of \ref.
We were including the ams environment type in addition
to the number. This is proper behavior for `\cref` but
not for `\ref`.  To support `\cref` we need to store
the environment label separately.
2021-11-24 19:48:56 -08:00
John MacFarlane
7726b69cd3 LaTeX reader: omit visible content for \label{...}.
Previously we included the text of the label in square brackets,
but this is undesirable in many cases.

See discussion in
<https://github.com/jgm/pandoc/issues/813#issuecomment-978232426>.
2021-11-24 14:47:00 -08:00
John MacFarlane
6072bdcec9 HTML reader: parse attributes on links and images.
Closes #6970.
2021-11-24 11:01:55 -08:00
John MacFarlane
79e6f8db13 Improve detection of pipe table line widths.
Fixed calculation of maximum column widths in pipe tables.
It is now based on the length of the markdown line, rather
than a "stringified" version of the parsed line.  This should
be more predictable for users. In addition, we take into account
double-wide characters such as emojis.

Closes #7713.
2021-11-23 13:29:25 -08:00
Albert Krewinkel
96a4bbe264
Capture alt-text in JATS figures (#7703)
Co-authored-by: Aner Lucero <4rgento@gmail.com>
2021-11-20 09:48:01 -08:00
John MacFarlane
4f2eac88aa MediaWiki writer: fix code for generating spans for header IDs.
We need to generate a span when the header's ID doesn't match
the one MediaWiki would generate automatically.  But MediaWiki's
generation scheme is different from ours (it uses uppercase letters,
and `_` instead of `-`, for example).

This means that in going from markdown -> mediawiki, we'll now get
spans before almost every heading, unless explicit identifiers are
used that correspond to the ones MediaWiki auto-generates.
This is uglier output but it's necessary for internal links to
work properly.

See #7697.
2021-11-19 09:05:19 -08:00
John MacFarlane
df5ae1c186 HTML writer: Don't create invalid data- attribute...
for empty attribute key. (It would be better to make these
unrepresentable in the type system, but for now this is
an improvement.)

Closes #7546.
2021-11-19 08:50:18 -08:00
John MacFarlane
25bba0cc62 MediaWiki writer: use HTML spans for anchors when header has id.
Closes #7697.
2021-11-18 21:15:51 -08:00
John MacFarlane
c19f063420 Markdown writer: don't create autolinks when this loses information.
Previously we sometimes lost attributes when rendering links as autolinks.

Closes #7692.
2021-11-15 11:06:50 -08:00