Commit Graph
17934 Commits
Author SHA1 Message Date
John MacFarlane 4040811e63 Use latest dev texmath. 2025-01-05 23:43:15 -08:00
John MacFarlane 5283ae8a9e Use dev version of texmath.
Typst writer improvements.
2025-01-05 00:11:49 -08:00
Evan Silberman 5766443bc8 Add mdoc St for C23
Following mandoc:

https://cvsweb.bsd.lv/mandoc/st.c?rev=1.19&content-type=text/x-cvsweb-markup
2025-01-03 15:45:33 -08:00
John MacFarlane c9f6d305b3 default.nix: add happy, which is needed by toml-parser. 2025-01-02 09:56:11 -08:00
John MacFarlane 968b0c13ee Typst writer: fix handling of pixel image dimensions.
These are now converted to inches as in the LaTeX writer.

Closes #9945.
2025-01-01 23:00:35 -08:00
John MacFarlane 01b54593cc AsciiDoc writer: improve escaping.
Closes #10385.
Closes #2337.
Closes #6424.
2024-12-28 19:43:23 -08:00
John MacFarlane 9fa4fa3c51 RST reader: fix handling of underscores.
Fixes a regression in 3.6 that caused problems parsing
text with underscores.

Closes #10497.
2024-12-27 19:38:56 -08:00
Evan Silberman 07105ccbff Make pod the default reader for .pod/.pl/.pm 2024-12-27 11:10:48 -08:00
Evan Silberman c4716d41c5 Add Pod reader
Pod ("Plain old documentation") is a markup languaged used principally
to document Perl modules and programs. Since it was originally meant to
be translated pretty directly to man, the semantics are fairly simple.

This Pod reader was developed with reference to the canonical user and
implementer documentation of Pod: https://perldoc.perl.org/perlpod and
https://perldoc.perl.org/perlpodspec.

There are 1490 .pod, .pl, and .pm in the Perl 5.34 distribution found in
/System/Library/Perl on my mac. Of those, this reader dies with a parse
error on 7 of them. All of them seem to be cases where pod commands are
found within a non-colon-prefixed =begin/=end. perlpodspec says I may
treat this as an error.

[API change] adds readPod
2024-12-27 11:10:48 -08:00
Santiago Zarate af2b276afe Improve message for asciidoc input error (#10492)
Closes #8416.
2024-12-23 12:34:08 -08:00
John MacFarlane f6b42450f9 Update changelog. pandoc-lua-engine-0.4.1 3.6.1 pandoc-cli-3.6.1 2024-12-23 10:38:01 -08:00
John MacFarlane 3c0982c893 MediaWiki reader: allow empty quoted attributes.
Closes #10490.
2024-12-23 10:36:09 -08:00
John MacFarlane e122ca04b0 MediaWiki reader: allow cells starting with +.
Closes #10491.
2024-12-23 10:27:13 -08:00
John MacFarlane 26ad26b7e6 pandoc-lua-engine: bump to 0.4.1. 2024-12-23 00:51:49 -08:00
John MacFarlane 27ed0ce738 Fix spacing error. 2024-12-23 00:12:34 -08:00
John MacFarlane 85a3e9c222 Update MANUAL.txt date and regenerate man pages. 2024-12-22 23:34:13 -08:00
John MacFarlane 50ef91ab57 Bump pandoc-cli to 3.6.1 and depend on pandoc 3.6.1 2024-12-22 23:29:31 -08:00
John MacFarlane 4fc730d80f Bump to 3.6.1, update changelog 2024-12-22 23:28:49 -08:00
John MacFarlane c481843ce3 Depend on skylighting/skylighting-core 0.14.5 2024-12-22 23:28:22 -08:00
John MacFarlane b6aff21452 Docx writer: restart footnotes by section by default.
This can be overridden by a final sectPr element in the body
of the reference.docx.

It will only change things for `--top-level-division=chapter`,
since only top-level chapters are put in separate sections.
For that use it will mean that footnote numbers start over with
each chapter, which is usually what is wanted.

Closes #2773.
2024-12-22 13:18:27 -08:00
John MacFarlane ab29a767ff Remove old comment-out line. 2024-12-22 11:57:46 -08:00
John MacFarlane dc6a7d06b1 Docx writer: better handling of chapters.
When `--top-level-division=chapter` is used, a paragraph with
section properties is inserted before each level-1 heading.
By default, this causes the new heading to start on a new page
(though this default can be adjusted in Word).

This change should also make it possible to number footnotes
by chapter (#2773), though that change isn't yet made.
2024-12-22 11:38:32 -08:00
John MacFarlane d9281d1eaf Markdown writer: avoid collapsing of initial/final newline in...
...markdown raw blocks.  For motivation see #10477.
2024-12-22 10:47:30 -08:00
silby d064ad77a5 RST reader: handle explicit reference links (#10485)
This case was missed when changing the reference link strategy for RST
to allow a single pass.

Closes #10484.
2024-12-22 10:03:00 -08:00
Evan Silberman 7f791f68aa Correct example in charsInBalanced
The given example wasn't actually functional because `anyChar` parses a
`Char` and `charsInBalanced` wants a `Text` parser as its inner parser.
2024-12-20 11:51:49 -08:00
John MacFarlane cfb9bd5cf3 Mediawiki writer: escape line-initial characters...
...that would otherwise be interpreted as list starts.

Closes #9700.
2024-12-20 10:31:43 -08:00
John MacFarlane 74f64f33e4 LaTeX writer: properly handle boolean value for csquotes variable.
Closes #10403.
2024-12-20 10:01:06 -08:00
John MacFarlane 7b873ac790 Makefile add prof target 2024-12-20 10:01:01 -08:00
Evan Silberman 4c409e6cf2 Mention typst in PandocUnknownWriterError for pdf 2024-12-19 18:47:24 -08:00
John MacFarlane 7cff3590bc Allow --shift-heading-level-by=-1 to work in djot...
...in the same way it works for other formats (with the top-level
heading being promoted to metadata title).  This needed special
treatment because of the way djot surrounds sections with Divs.

Closes #10459.
2024-12-19 15:14:31 -08:00
John MacFarlaneandThomas Hodgson 86dd2f7d66 Fix default.beamer nocite location.
It must be inside a frame or it is ignored.

Improves on #10465. Obsoletes #10471.

Co-authored-by:  Thomas Hodgson <hello@twshodgson.net>
2024-12-19 14:54:04 -08:00
John MacFarlane cef339f78f T.P.mediaBag insertMedia: fast path for data URIs.
Avoid the slow URI parser from network-uri on large data URIs.

See #10075. In a benchmark with a large base64 image in HTML ->
docx, this patch causes us to go from 7942 GCs to 3654, and from
3781M in use to 1396M in use.

(Note that before the last few commits, this was running 9099 GCs
and 4350M in use.)
2024-12-19 14:22:51 -08:00
John MacFarlane 26b5c957db T.P.Class: shortcut for base64 data URIs in downloadOrRead.
This avoids calling the slow URI parser from network-uri on
data URIs, instead calling our own parser.

Benchmarks on an html -> docx conversion with large base64 image:
GCs from 7942 to 6695, memory in use from 3781M to 2351M,
GC time from 7.5 to 5.6.

See #10075.
2024-12-19 13:47:31 -08:00
John MacFarlane 449824c412 T.P.URI: pBase64DataURI now returns mime + bytes 2024-12-19 13:30:38 -08:00
John MacFarlane 3900791a0f T.P.MIME: fix extensionFromMimeType.
We had a few special cases encoded, but as previously written
they wouldn't work properly with modifiers like `;charset=utf-8`.
2024-12-19 13:08:25 -08:00
John MacFarlane df0d3fb78c Change --template to allow use of extensionless templates.
The intent is to allow bash process substitution: e.g.,
`--template <(echo "foo")`.

Previously pandoc *always* added an extension based on the
output format, which caused problems with the absolute filenames
used by bash process substitution (e.g. `/dev/fd/11`).

Now, if the template has no extension, pandoc will first
try to find it without the extension, and then add the
extension if it can't be found.

So, in general, extensionless templates can now be used.
But this has been implemented in a way that should not cause
problems for existing uses, unless you are using a template
`NAME.FORMAT` but happen to have an extensionless file `NAME` in
the template search path.

Closes #5270.
2024-12-19 10:20:22 -08:00
John MacFarlane d0b652491a HTML writer: avoid calling parseURIString for data URIs.
This was done to determine the "media category," but we can
get that directly from the mime component of data: URIs.

Profiling revealed that a significant amount of time was
spent in this function when a file contained images with
large data URIs.

Contributes to addressing #10075.
2024-12-18 20:50:32 -08:00
John MacFarlaneandEvan Silberman b27a8cc662 Further improvements to base64 data URI parsing.
Text.Pandoc.URI: export `pBase64DataURI`.  Modify `isURI` to use this
and avoid calling network-uri's inefficient `parseURI` for data URIs.

Markdown reader: use T.P.URI's `pBase64DataURI` in parsing data
URIs.

Partially addresses #10075.

Obsoletes #10434 (borrowing most of its ideas).

Co-authored-by: Evan Silberman <evan@jklol.net>
2024-12-18 16:51:01 -08:00
John MacFarlane 5ae45a0c5a Markdown reader: Adjust source position in data: URI parser.
This fixes an omission in the last commit.
2024-12-18 15:12:44 -08:00
John MacFarlaneandEvan Silberman 3da4d41c07 Markdown reader: more efficient base64 data URI parsing.
This patch borrows some code from @silby's PR #10434 and should
be regarded as co-authored.  This is a lighter-weight patch
that only touches the Markdown reader.

The basic idea is to speed up parsing of base64 URIs by parsing
them with a special path.  This should improve the problem
noted at #10075.

Benchmarks (optimized compilation):

Converting the large test.md from #10075 (7.6Mb embedded image)
from markdown to json,

before: 6182 GCs, 1578M in use, 5.471 MUT, 1.473 GC

after: 951 GCs, 80M in use, .247 MUT, 0.035 GC

For now we leave #10075 open to investigate improvements in
HTML rendering with these large data URIs.

Co-authored-by: Evan Silberman <evan@jklol.net>
2024-12-18 15:02:35 -08:00
John MacFarlane ca4ad3b4d6 HTML reader: don't canonicalize data: URIs.
It can be very expensive to call network-uri's URI parser on
these. See #10075.
2024-12-18 12:23:35 -08:00
John MacFarlane 669c2b8f64 LaTeX reader: handle figure* environment as a figure.
Closes #10472.
2024-12-18 12:11:04 -08:00
John MacFarlane d5c9fe73b8 Textile reader: improve parsing of spans.
The span needs to be separated from its surroundings by spaces.
Also, a span can have attributes, which we now attach.

Closes #9878.
2024-12-17 23:38:41 -08:00
John MacFarlane 9acff9924f Textile reader: inline constructors don't trigger if closer...
...is preceded by whitespace.

Closes #10414.
2024-12-17 20:37:01 -08:00
John MacFarlane 63a949d730 LaTeX writer: use displayquote for block quotes with csquotes.
Closes #10456.
2024-12-17 20:03:23 -08:00
John MacFarlane e096e06a84 Typst writer: properly handle data: URIs in images.
We need to produce an svg tag and parse it using `image.decode`.
This is slightly roundabout but doesn't require any external
libraries.

Closes #10460.
2024-12-17 17:56:59 -08:00
John MacFarlane 7a66c946e2 Docx writer: use styleIds not styleNames for Title, Subtitle, etc.
This change affects the default openxml template as well as the
OpenXML writer.

Closes #10282 (regression introduced in pandoc 3.5).
2024-12-17 17:33:17 -08:00
John MacFarlane d6edb57797 Text.Pandoc.PDF: fix temp file extension in toPdfViaTempFile.
We used to set this to `.html`, but this seemed inappropriate
once we started using this function for `--pdf-engine=typst`.
So we changed it in pandoc 3.6 to `.source`. But apparently
`wkhtmltopdf` needs it to be `.html`.  So now we have added
a parameter to `toPdfViaTempFile` that allows the extension
to be specified.

Closes #10468.
2024-12-17 17:30:29 -08:00
Thomas Hodgson 7d1962b617 Move nocites from LaTeX preamble to body (#10465)
Closes #10461.

Putting `\nocite` in the preamble works only with biblatex.
2024-12-17 10:17:13 -08:00
Joseph C. Sible 58cc5cc57e Use lastMay instead of reverse 2024-12-14 17:08:53 -08:00