Commit Graph
959 Commits
Author SHA1 Message Date
John MacFarlane dbbd70d4f8 Add tests for alerts gfm <-> docbook. 2023-12-05 16:52:49 -08:00
John MacFarlane fe351f1fd5 Fine-tuning on alerts.
Added a test to show that we can convert smoothly between
gfm, rst, and asciidoc alerts.
2023-12-05 09:38:47 -08:00
John MacFarlane 41da8ad9e0 HTML5 writer footnote changes (aria-role, element type).
* To conform to validator's expectations, `doc-footnote` role is used
  with `aside` and `doc-endnotes` with `section`.
* `aside` is used only for notes at ends of sections or blocks;
  if all the notes come at the end of the document, `section` is
  used so we can have the `doc-endnotes` role.
2023-12-04 09:22:58 -08:00
John MacFarlane 80ea048bb2 LaTeX reader: handle otherlanguage environment...
...and language-name environments like
`\begin{french}...\end{french}`.
Closes #9202.
2023-11-29 21:22:03 -08:00
John MacFarlane 6149cec27a Update command test for SVG embedding changes. 2023-11-25 11:39:22 -05:00
John MacFarlane a2a0f73eb8 LaTeX writer: handle identifiers inside heading contents.
`\phantomsection` can't be used in this case, so we need `\hypertarget`.
Closes #9209.
2023-11-22 23:24:55 -05:00
John MacFarlane 49e64c1451 Man reader: properly handle .sp macro inside lists and block quotes.
Closes #9201.
2023-11-19 10:45:05 -08:00
Hikaru Ibayashi a3fba6d83e LaTeX reader: fix theorem label parsing (#9198)
Closes #8872.

In the current implementation , theorem labels in `theoremEnvironment` are
determined by the `LastLabel` in the current state.
This approach works well when the `\label{label_name}` is placed at the end
of the theorem body. However, when a label is placed at the beginning of the
theorem (another common practice) and additional labels follow in the theorem body,
`theoremEnvironment` incorrectly picks the last label (e.g., `\label{item2}` in #8872).

This patch addresses the issue by extracting the label extraction independently of the `LastLabel` state.
2023-11-17 18:49:03 -08:00
John MacFarlane 13e1b49224 HTML reader: Fix handling of invalidly nested sublists.
This revises the fix to #8150 (and the test case) and closes #9187.

HTML in the (invalid) form:

    <ul>
      <li>L1</li>
      <ul>
        <li>L1.1</li>
      </ul>
    </ul>

is treated by browsers like

    <ul>
      <li>L1
        <ul>
          <li>L1.1</li>
        </ul>
      </li>
    </ul>

not

    <ul>
      <li>L1
      <li><ul>
          <li>L1.1</li>
        </ul>
      </li>
    </ul>

as pandoc previously assumed.

This change will give a similar treatment to

    <ul>
      <li>L1</li>
      <p>foobar</p>
    </ul>

which also seems to match browser behavior.
2023-11-15 14:40:00 -08:00
John MacFarlane cd48bf4059 Markdown reader: don't change newlines to spaces in math.
Preserve them: otherwise we can get unwanted results if there's
a `%` comment. Closes #9193.
2023-11-15 10:06:22 -08:00
John MacFarlane 76cd115d3b Markdown reader: make attributes work with reference links.
Closes #9171.
2023-11-05 21:27:03 -08:00
John MacFarlane 5132f1ef33 T.P.RoffChar: escape - as \-.
The groff_man (7)` man page indicates that `-` characters will be
treated as typographic hyphens and are not appropriate for cases
where the output should be copy-pasteable as an ASCII
hyphen-minus character.  (E.g. in command line options.)

However, until a recent update groff man did not actually do this;
it treated `-` and `\-` the same.  With the new update (1.23.0)
the two are distinguished (see https://lwn.net/Articles/947941/
for background), so now it is important that pandoc escape `-`.

This reverts ee60ba5252.
That change was motivated by a problem with backslash-escaping
`-` in a filename for .PSPIC. That's simply a separate issue;
we shouldn't do the normal escapes in such a context. It has
been addressed in the previous commit.
2023-11-02 19:36:25 -07:00
John MacFarlane 0f3211c339 Shared: improve isTightList...
so that it recognizes an item containing only a list which is
itself tight as potentially an item in a tight list.

Closes #9161.
2023-10-28 10:07:13 -07:00
John MacFarlane 5ed86e69c4 Make reference-section-title work with jats+element_citations.
Closes #9021.
2023-10-26 17:04:55 -07:00
Julia Diaz f2a22e71df Modify JATS reader to handle BITS too (#9138)
Add provision for title-group, book, book-part-wrapper, book-meta,
book-part-meta, book-title, book-title-group, index, toc, legend,
title, collection-meta
2023-10-26 15:18:33 -07:00
John MacFarlane b671e0dfe5 Org writer: escape literal *, |, # at beginning of line with ZWS.
Closes #9159.
2023-10-26 09:18:56 -07:00
John MacFarlane ad1a745f72 LaTeX reader: better handle spacing commands...
hfill, vfill, hskip, vskip, etc.

Closes #9150.
2023-10-21 18:44:28 -07:00
John MacFarlane 5e66811875 Markdown reader: fix blindspot with superscript in links.
Previously `[^super^](#ref)` wasn't parsed as a link, due to
code that was meant to prevent footnote markers from being
recognized as reference links.  This commit tightens up that
code to avoid this bad effect.

We have also added a new restriction on footnote labels: they
cannot contain the characters `^`, `[`, or `]`. Though this is
technically a breaking change, we suspect that the impact will
be minimal, as it's very unlikely people would be using these
characters in their note labels.

Closes #8981.
2023-10-20 10:27:49 -07:00
John MacFarlane 0fdac4984b HTML reader: allow th to close td and vice versa.
Closes #9090.
2023-10-19 11:07:22 -07:00
Julia Diaz fa3513b104 JATS reader: fix handling of alt-text (#9134)
Previously we were looking for an attribute that doesn't exist in
JATS; alt-text is provided by a child element.

Closes #9130.
2023-10-17 09:16:00 -07:00
John MacFarlane ddabd85eb8 Man writer: Fix some spacing issues around links.
See #9120.

We need to use `\c` before a `.UR` or `.MT`, to avoid
an extra space, and also after.  To ensure that a space
at the beginning of the following line doesn't get swallowed
up, we escape it with `\`.
2023-10-05 09:38:45 -07:00
John MacFarlane 5a691e8c3f Man writer: use UR, MT macros for URLs, emails.
Closes #9120.
2023-10-04 22:22:25 -07:00
John MacFarlane e57953b9f0 Fix uneven indents in LaTeX line block output.
Closes #9088.
2023-09-18 15:59:26 -07:00
Seth Speaks 0d27947b96 HTML reader: parse task lists using input elements (#9066)
Allow the HTML reader to parse task lists of the sort produced by pandoc.
Closes #9047
2023-09-16 09:21:01 -07:00
John MacFarlane db9aa72037 Fix default citeproc entry-spacing.
According to the CSL manual, the default entry spacing is 1.
We were treating it as 0.

T.P.Citeproc:  always include an entry-spacing attribute
in the Div if the bibliography element contains an entry-spacing
attribute (previously we omitted it when it was 0).

LaTeX writer: use entry spacing 1 if no entry-spacing
attribute is present.

Update tests.

See #9058.
2023-09-07 09:06:23 -07:00
John MacFarlane 632e3c1809 LaTeX writer: Fix regression.
In 3.1.7, pandoc added two labels to LaTeX figure environments,
one with a phantomsection.

Closes #9045.
2023-09-01 12:21:55 -07:00
Benjamin Esham 9190b19fc7 HTML writer: use the ID prefix in the ID for the footnotes section.
In general, the ID prefix makes it possible to combine multiple pieces
of Pandoc-generated HTML with no possibility that IDs will conflict. One
exception to this was that the footnotes were always put into an element
like

    <aside id="foonotes" ...>

This commit applies the ID prefix to this ID as well.
2023-09-01 11:42:48 -07:00
John MacFarlane bad922a692 LaTeX writer: fix regression in escaping URLs.
In 3.1.6.1 the `~` was handled properly (either literally or with
`%E7`).  This broke in 3.1.6.2, which used URI encoding in both
cases and didn't escape the `\` before `%E7`. This patch restores
the former behavior: `~` isn't escaped if it isn't escaped in the
original URL, and if it is, a backslash is added before `%`.

Closes #9043.
2023-08-31 08:28:40 -07:00
John MacFarlane 1e43eb46ce Org reader: don't parse alphabetical lists...
...unless the `fancy_lists` extension is enabled.
Closes #9042.
2023-08-30 22:01:41 -07:00
John MacFarlane 09de84fff4 Support images with wikilink syntax.
E.g. `![[foo|bar]]`.  (This requires enabling one of the `wikilinks`
extensions.)

Closes #8853.
2023-08-29 20:04:39 -07:00
John MacFarlane 7dca09d03a Markdown: Allow a citation or reference link to be parsed after a !.
Closes #8254.
2023-08-29 19:25:30 -07:00
John MacFarlane cd3fcd5c0e Markdown reader: fix dropped ! before nonexistent reference.
In e.g. `![foo]` the `!` would be silently dropped if `[foo]`
wasn't a reference link label.

Closes #9038.
2023-08-29 19:14:50 -07:00
John MacFarlane f7035d080c LaTeX writer link/target improvements.
+ Use `\phantomsection` and `\label` instead of `\hypertarget`.
+ Use `\hyperref` for LaTeX internal links, `\hyperlink` for
  beamer (since `\hyperref` doesn't seem to work).

Closes #9022.
2023-08-26 16:19:01 -07:00
John MacFarlane a6fe02f46a Man writer: improvements to code and code blocks.
The aim here (see #9020) is to produce more standard and more
portable man pages.  To that end:

- We revert the fanciness introduced in #7506, which employs a
  custom font name V and a macro that makes this act like boldface
  in a terminal and monospace in other formats.  Unfortunately,
  this code uses a mechanism that is not portable (and does not
  work in mandoc).

- Instead of using V for inline code, we simply use CR.
  Note that `\f[CR]` is emitted instead of plain `\f[C]`,
  because there is no C font in man.  (This produces warnings
  in recent versions of groff.)

- For code blocks, we now use the `.EX` and `.EE` macros,
  together with `.IP` for spacing and indentation.  This gives
  more standard code that can be better interpreted e.g. by mandoc.
2023-08-25 21:35:47 -07:00
John MacFarlane 3cb6130d1a JATS writer: fix placement of ref-list...
...when no title is specified for the reference section.
(In this case we place it in `back` with an empty title.)
Closes #9017.
2023-08-23 16:10:00 -07:00
John MacFarlane d21a9cd7f8 Also escape % in URLs.
This improves the fix to #9017 in commit
7c4354646b

An alternative would be to avoid backslash escaping `#` and `%`
in URLs, and instead always add `fragile` to the slide environment.
2023-08-23 12:37:49 -07:00
John MacFarlane 40accba747 Typst writer: use ~ for nonbreaking space.
And escape literal `~`.
Closes #9010.
2023-08-21 11:29:27 -07:00
John MacFarlane 70329edcd7 LaTeX writer: improve internal links and targets.
We no longer wrap section headings in a `\hypertarget`.
This is unnecessary (hyperref creates an anchor based on the
label) and it interferes with tagging.

In addition, we now use `\hyperref` rather than `\hyperlink`
for internal links.

Currently `\hypertarget` is still being used for link anchors
not on headings.

Closes #8744. Thanks to @u-fischer.
2023-08-19 09:52:01 -07:00
John MacFarlane 068fce4293 Docx reader: omit "Table NN" from caption.
Closes #9002.
2023-08-18 17:50:59 -07:00
Brian Leung 2dde57569a Org reader: allow example lines to end immediately after the colon
See the regexp at https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-element.el?h=d1e4b9351941aa9241ab3aa0a34256376b7eca94#n2420.
2023-08-18 10:00:49 -07:00
John MacFarlane cbb33fefb7 LaTeX writer: Improve escaping of URIs in href, url.
Closes #8992.
2023-08-09 12:09:41 -07:00
John MacFarlane e611edb7d8 HTML reader: avoid duplicate id on header and div.
Closes #8991.
2023-08-09 11:36:32 -07:00
John MacFarlane e87addb58f HTML reader: properly calculate RowHeadColumns.
The previous algorithm did not handle rowspans; this one does.
Closes #8984.
2023-08-05 23:00:14 -07:00
John MacFarlane 0beab6345f Add test for #8984. 2023-08-05 11:57:31 -07:00
John MacFarlane 1d62883e14 HTML reader: require unanimity for RowHeadColumns.
Previously we used the max.  #8634 switched to the min, but this
had bad results.  This commit sets the RowHeadColumns to the consensus
value from all rows, or 0 if there is no consensus.

See #8984.
2023-08-05 11:48:29 -07:00
John MacFarlane acbc382ff4 Revert "Update #8764 command test for latest change to HTML table parser (#8634)."
This reverts commit 52d352a5ae.
2023-08-05 11:16:10 -07:00
John MacFarlane 0873895416 OpenDocument writer: implement syntax highlighting.
Still unimplemented: global background colors, line numbers.

Closes #6710, obsoletes #6717.
2023-08-04 20:43:39 -07:00
John MacFarlane 5e1b9591e1 Started implementing syntax highlighting for ODT.
Currently only colors are supported, not other text styles.

This change includes a new default opendocumnet template.

See #6710.
2023-08-04 13:31:06 -07:00
John MacFarlane 7b8e8f6f52 SelfContained: retain attributes in svg tag...
when referring to another svg's content using `<use>`.
Closes #8969.
2023-07-27 09:56:56 -06:00
John MacFarlane ecb59e1cde SelfContained: fix calculation of svg width and height.
We were computing width and height from viewBox incorrectly.
See #8969.
2023-07-26 09:49:37 -06:00