983 Commits
Author SHA1 Message Date
John MacFarlane cf847b0138 LaTeX reader: improve treatment of cref, Cref.
Associate with `\cref` and `\Cref` the reference-type `ref+label` and
`ref+Label`.  So far we don't do anything fancy with these.
Also, associate with `\vref` `ref` instead of `ref+page`.

See #7463.
2024-02-13 19:32:12 -08:00
John MacFarlane aa00714ba4 Typst writer: improve citation support.
Emit `form: "prose"` or `form: "year"` qualifiers if the citation
is author-in-text or suppress-author.

Strip initial comma from suffix, since typst will add an extra
one.

Closes #9452.
2024-02-12 20:01:44 -08:00
Sam May 758ff050b2 HTML5 writer: Add suffix to multiple footnote section ids
The first (and often only) `<aside id=footnotes>` block remains
unchanged, however any additional blocks from `--reference-location` are
distinguished as `#footnotes-2`, `#footnotes-3`, and so on.  No other
existing writer seems to implement per-section IDs, including HTML4.
2024-02-12 18:45:47 -08:00
John MacFarlane bf674e8ddd Markdown writer: use different width fences for nested divs.
Outer divs have longer fences. This aids clarity for the reader,
making it easier to see where the div ends. It also makes the
output compatible with some other implementations, e.g.
micromark, which require different-width fences for nesting.

Closes #9450.
2024-02-12 10:05:36 -08:00
John MacFarlane bd352e41d6 Man reader: move spaces outside of emph/strong.
This is needed to avoid problems in conversion to Markdown
and some other formats. Closes #9445.
2024-02-11 19:06:50 -08:00
John MacFarlane 0604fa297d Fix id replacements in SVGs with clipping paths.
This fixes `--embed-resources` when SVGs have `clip-path`
attributes.

Closes #9420.
2024-02-09 16:39:48 -08:00
John MacFarlane ea23868ae4 Fix size of duplicated SVGs with --embed-resources.
Closes #9439.
2024-02-09 16:39:40 -08:00
John MacFarlane 03bb426a4a Shared: makeSections behavior changes.
+ When the optional base level parameter is provided, we no
  longer ensure that the sequence of heading levels is gapless
  [behavior change]. Instead, we set the lowest heading level to
  the specified base level, and adjust the others accordingly. If
  an author wants to skip a level, e.g. from level 1 to level 3,
  they can do that. In general, the heading levels specified
  in the source document are preserved; `makeSections` only
  puts them into a hierarchical structure. Closes #9398.

+ Section numbers are now assigned so that the top level
  gets `1`, no matter what heading level is used. So, even
  if the top heading level is 2, numbers will be `1`, `2`, etc.
  rather than `0.1`, `0.2`, as in the past. Closes #5071.

+ We revert to the old behavior when the `--number-offset` option
  is used. So, for example, if a document begins with a level-3
  heading, and `--number-offset=1,2` is used, the top-level section
  numbers will be `1.2.1`, `1.2.2`, etc. This is mainly for
  backwards-compatibility.
2024-02-03 22:19:29 -08:00
John MacFarlane c1f87fdb37 Typst writer: handle labels and citaiton ids with spaces...
and other special characters. In these cases, we produce an
explicit `label()` rather than using `<>` or `@`.

Cloess #9387.
2024-01-29 12:25:09 -08:00
John MacFarlane 97eb927339 Typst writer: avoid illegal labels.
Closes #9387.
2024-01-29 11:45:15 -08:00
John MacFarlane 75d013f73e LaTeX reader: generate relative widths for \linewidth, \textheight.
Closes #9388.
2024-01-29 11:11:45 -08:00
John MacFarlane 8b539dbf1d Makefile: change default rule to build THEN test.
That way we can play with the executable while the tests complete.
2024-01-29 11:11:39 -08:00
John MacFarlane b6ac32b116 Typst writer escaping improvements.
We no longer escape `(`. The reason we did this before (#9137)
has been addressed in another way (#9252).

We only escape `=`, `+`, `-` at the beginning of a line.

We now also escape `/` at the beginning of a line.

This should reduce unnecessary escapes.

Closes #9386.
2024-01-29 10:53:51 -08:00
John MacFarlane 8d09c4aff4 EPUB reader: don't put # characters in identifiers. 2024-01-26 23:58:42 -08:00
John MacFarlane d9a70d2eaf Add some kerns where needed between quotes in LaTeX output.
Closes #9371.
2024-01-25 09:41:47 -08:00
Gokul Rajiv 254ebeb68b add testcase 2024-01-23 14:13:51 -08:00
Albert Krewinkel 57774d79e8 Org writer: escape special lines in code blocks
Fixes: #9218
2024-01-22 18:13:34 +01:00
John MacFarlane f43ffabd3c LaTeX writer: create valid table even when table is empty.
Closes #9350.
2024-01-20 10:19:32 -08:00
John MacFarlane df1944f774 Markdown writer: fix output for pipe tables...
...with a huge number of columns. Previously we got invalid pipe
tables when the number of table columns exceeded the setting of
`--columns`.

Closes #9346.
2024-01-18 08:35:21 -08:00
John MacFarlane 87533e2d04 Add command test for #9293. 2023-12-30 22:09:13 -07:00
John MacFarlane b1a1f04168 ODT/opendocument writers: properly handle highlighting styles.
These styles were going into an office:styles element in content.xml,
but this is invalid.  Instead they must go in styles.xml. See #9287.

The variable `highlighting-styles` no longer has any effect on
the default opendocument template, and highlighting styles are
not included in opendocument output.
2023-12-26 22:12:44 -08:00
John MacFarlane 81521cee0d Markdown writer: add table identifier at end of caption if present.
Suggested at #9279.
2023-12-22 11:14:09 -08:00
John MacFarlane 36d1ec3e45 Org reader: parse caption and label for grid tables.
Closes #9279.
2023-12-20 16:55:10 -08:00
John MacFarlane 0e86a84e33 LaTeX writer: omit superfluous page locator label...
when used with `--natbib` or `--biblatex`. These will treat a
bare number as a page locator, and they will be able to localize
it.

We borrow the code for stripping the locator label from the suffix
from Citeproc code. Note that the recognition of the locator label
is locale-sensitive; if `lang` is `de`, then `S. 33` is a page
reference, and `p. 33` is not!

Closes #9275.
2023-12-18 23:27:40 -08:00
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