8574 Commits
Author SHA1 Message Date
John MacFarlane 9f43da7f81 Logging: add MakePDFWarning constructor to LogMessage.
[API change]

Use this to pass LaTeX warnings on to user as warnings.
2023-12-15 12:23:33 -08:00
John MacFarlane 04acb3f7f7 Logging: add MakePDFInfo constructor to LogMessage.
[API change]

Use this with `report` in Text.Pandoc.PDF instead of manually
writing to stderr.
2023-12-15 11:16:46 -08:00
John MacFarlane bd8e31708a PDF: Refactored PDF generation via LaTeX. 2023-12-15 10:23:41 -08:00
John MacFarlane 53fbce09be Text.Pandoc.PDF: parse logs to determine whether additional runs needed.
Previously we ran a fixed number of times. Closes #9255.
2023-12-15 10:02:26 -08:00
John MacFarlane fd73880a87 Typst writer: emit ; after typst code...
unless followed by space.  Otherwise there's the potential
that the typst code will swallow up a following character.
Closes #9252.
2023-12-14 12:28:04 -08:00
John MacFarlane 3d4a6cc4a7 Whitespace fix. 2023-12-11 22:13:27 -08:00
John MacFarlane 14e44385e3 Typst reader: don't include metadata from document element.
The problem is that typst doesn't print this metadata; it is only
used in PDF properties. The title, authors, and so on are represented
in the typst document (and there is no standardized method like
LaTeX's `\maketitle`).  So if we parse this as metadata then converting
a typst document will likely lead to a double title.
2023-12-11 10:44:10 -08:00
John MacFarlane 42091d1e13 Typst reader: parse metadata from document element. 2023-12-10 12:56:59 -08:00
John MacFarlane b0e8e99c83 Typst reader: add state fields for metadata. 2023-12-10 11:50:25 -08:00
John MacFarlane 8c90b46d8b Typst reader: support sys.version. 2023-12-10 11:22:08 -08:00
John MacFarlane 2a09252014 LaTeX writer: Add performance optimization to #9168.
We only walk the tree to raise big notes if the document
contains big notes (it is fast to check).  The removes the
slight performance penalty of #9168 for most documents.
2023-12-10 09:54:26 -08:00
Hikaru Ibayashi 3be253fb90 LaTeX writer: fix bug with big footnotes inside emphasis (#9168)
Closes #8982.
2023-12-10 09:29:45 -08:00
John MacFarlane aa95770743 Typst writer: use quote for block quotes.
Remove custom definitiion of blockquote in default template.
2023-12-09 23:23:15 -08:00
John MacFarlane d8b5541d61 Typst reader: allow @refs to become citations...
if there is no corresponding label in the document.
2023-12-09 22:51:35 -08:00
John MacFarlane cafca39ec7 Typst reader: collapse adjacent cite elements. 2023-12-09 15:50:01 -08:00
John MacFarlane cf0a050434 Typst reader: fix temporary regression in cite. 2023-12-09 15:28:54 -08:00
John MacFarlane d5e7c0ed1d Typst writer: handle supplements in cite. 2023-12-09 14:56:04 -08:00
John MacFarlane eb3a1b11d1 Typst reader: change cite (only one key allowed, a label).
This is a typst 0.9 breaking change.
2023-12-08 22:07:12 -08:00
John MacFarlane d57f3d576e Typst reader: support quote element. (typst 0.9) 2023-12-08 21:54:39 -08:00
John MacFarlane fb4cea44b9 Docx writer: Use different style for block quotes in notes.
Using "Footnote Block Text" for the style name, so it can be
given a different font size if footnotes are.

Closes #9243.
2023-12-08 13:34:33 -08:00
John MacFarlane 901359bf46 Docx writer: allow embedded fonts to be used in reference.docx.
Closes #6728.
2023-12-08 13:16:59 -08:00
John MacFarlane 5bd301ef45 Typst writer/template: support --toc-depth as in other writers.
Closes #9242.
2023-12-07 14:39:21 -08:00
John MacFarlane 8b523749ae Revert "Use base64 instead of base64-bytestring."
This reverts commit 6625e9655e.

base64 is currently buggy on 32-bit systems. Closes #9233.
2023-12-06 08:05:53 -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 fe03d4d133 Add alerts extension.
This enables GitHub style markdown alerts as a commonmark extension.

<https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts>

This extension is now default for `gfm`.
It can't be used with `markdown`, only with `commonmark` and variants.
2023-12-04 22:13:04 -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 dbdb4d9c1f Typst writer: put inline image dimensions on enclosing box, not image.
Closes #9104.
2023-12-04 08:42:12 -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
Stephan Meijer 2e8ecb3fba Docx reader: unwrap content of shaped textboxes...
* #9214 text in shape format test document

* #9214 support Text in Shape Format

* #9214 remove irrelevant code
2023-11-29 18:59:09 -08:00
John MacFarlane 9901aa2a40 Docx reader: Improve handling of w:sym.
Add T.P.Readers.Docx.Symbols. This gives us a table to use to
resolve characters included in docx via w:sym element.

Use this table to resolve characters when symbol fonts are specified.

Closes #9220.
2023-11-28 11:50:26 -08:00
John MacFarlane 4259d64d25 Correct comment. 2023-11-28 10:23:56 -08:00
John MacFarlane fc3d202e3f SelfContained: improve treatment of embedded SVGs.
- Ensure unique ids for elements by prefixing SVG id.
- Ensure SVG `id` attribute except when `use` element is used.
- Remove `width`, `height` attributes from svg element when `use`
  element is used. Instead, add `width` and `height` 100% to the
  `use` element. This seems to get the sizing right.

Closes #9206.

Ref: #8948.
2023-11-25 11:35:10 -05:00
John MacFarlane f7f2a016d9 Shared.renderTags': use minimized tag for rect. 2023-11-25 10:58:43 -05:00
John MacFarlane 6c4f938192 Shared.renderTags': allow svg path element to be minimized. 2023-11-25 00:03:53 -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 267b84e1d9 Ensure we use .svg not .svgz as extension for image/svg+xml mime type.
See #9195.
2023-11-17 10:26:09 -08:00
John MacFarlane 1880d75e7c T.P.Class.IO.openURL improvements for data uris.
- Only treat as base64 if ';base64' is present.
- Otherwise treat as UTF-8 (not 100% reliable but should cover most
  other cases).
- Strip off ';base64' (or ';charset=...' or whatever) from mime type.

This last change addresses #9195 (problems with data URIs in
conversion to docx).
2023-11-17 10:13:22 -08:00
John MacFarlane 3591733e19 Typst writer: better handling of tables with captions.
We now put these in a figure with a caption argument.

Closes #9194.
2023-11-15 21:17:06 -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 0283cdc200 Update typst writer to typst 0.9 citation format.
Closes #9188.
2023-11-14 19:55:03 -08:00
John MacFarlane 7db44d77b2 MediaWiki reader: allow attribute keys with hyphens.
Closes #9178.
2023-11-13 15:05:43 -08:00
Stephan Meijer 56f7f11473 ODT reader: Support attr text:continue-numbering (#8998)
Closes #8979.
2023-11-06 19:15:37 -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 6fdebc4afd T.P.Shared: export combineAttr.
[API change]
2023-11-05 21:26:37 -08:00
John MacFarlane 9400f75506 JATS writer: handle case where there is material after refs div.
Previously in such cases the references were not being moved to
back matter. Closes #9166.
2023-11-04 09:46:46 -07:00
John MacFarlane bb36f127e2 LaTeX template: include bookmark package unconditionally.
This package produces better PDF bookmarks than hyperref
and does it on the first pass.

As a consequence, we now default to running LaTeX only
once in producing a PDF (instead of twice). If a table
of contents is present, we still have to run three times
to get the page numbers.
2023-11-03 10:40:38 -07: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