This reverts commit f753137752.
We are going to get an error for pandoc-types, which we need to
ignore for now -- it's only in stack.yaml because the latest version
is not in nixpkgs.
Previously the indentation of the first line was stripped, so lines
with less indentation lost all their leading whitespace. Now, as in
docutils, the minimum indentation is stripped and relative indentation
is preserved.
Closes#12071.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Text runs were read as plain text, so their formatting and hyperlinks
were lost.
Runs and fields now keep their bold and italic (`b`, `i`) and their
baseline shift (`baseline`, as superscript or subscript). Adjacent runs
with the same format are joined first, so two bold runs make one Strong,
and spaces at the edges of a formatted run are kept outside it.
A run with a hyperlink (`a:hlinkClick`) becomes a Link to the target of
its relationship; adjacent runs with the same relationship make one
link. Links that act within the presentation, such as a jump to another
slide, carry an `action` and are read as plain text.
Formatting in slide titles, table cells and SmartArt, which are read as
plain text, is still ignored, as is underline.
The test fixture was written with python-pptx 1.0.2.
Contributed by @nachogarcia.
+ Parse `\pandocfootnotemark{n}` and `\pandocfootnotetext{n}{..}`,
as produced by the LaTeX writer for notes in tables, captions,
etc. Marks and texts are matched by id.
+ Resolve footnote marks inside resolved footnote texts, so that
nested notes are not lost.
+ Track `\addtocounter{footnote}{n}`, so that `\footnotemark` and
`\footnotetext` with counter adjustments (as produced by earlier
versions of pandoc) are matched correctly. Previously all
of the texts were assigned to the last mark.
+ Ignore definitions of `\pandocbounded`, `\pandocfootnotemark`,
and `\pandocfootnotetext` (e.g. from pandoc's template), which
the reader handles directly. Previously these definitions were
expanded, producing garbage and losing content.
See #11936.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Notes in tables, captions, and definition list terms are rendered
as a mark followed later by the note text. Previously we used
`\footnotemark{}` and `\footnotetext` with manual adjustments to
the footnote counter. But hyperref anchors each `\footnotetext` at
the destination of the most recent `\footnotemark`, so when there
were several such notes, all of the texts got the last mark's
anchor and the links for the other marks were broken (visibly so
with xelatex; pdflatex and lualatex silently substituted
page-level destinations).
We now emit `\pandocfootnotemark{n}` and `\pandocfootnotetext{n}{..}`,
where `n` is a unique id. These macros, defined in the default
template when the `deferred-notes` variable is set, save the
footnote mark and hyperref anchor at the mark and restore them
at the text. This removes the need for counter arithmetic, works
when the footnote counter is reset by chapter, and handles notes
nested inside deferred notes (whose texts are now emitted after
the text containing their marks). Since `\@footnotetext` is used
directly, verbatim content in such notes (`\VerbatimFootnotes`)
still works.
Users of custom LaTeX templates, or of LaTeX fragments produced
without `--standalone`, will need to include the definitions of
`\pandocfootnotemark` and `\pandocfootnotetext` from the default
template.
Closes#11936.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Previously an `<ol>` inside the body of a note was treated as
the list of notes, and its items were lost. Similarly, an `<hr>`
inside a note was dropped. We now set a local `inNoteBody` flag
while parsing a note's content, and only treat `<ol>` as the
note list (and drop `<hr>`) when not in a note body.
Closes#11852.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Charts were ignored, and a chart sheet read as an empty section.
The charts on a worksheet or chart sheet, those its drawing refers to,
are now read after its table, in the order they are drawn, as the pptx
reader reads them: a table of the values the chart part caches, in a
`chart` div. A drawing or chart that can't be read is left out, as is a
chart without cached values.
The test fixture was written part by part with a Python script.
Word can define a list through a numbering style: the abstractNum
referenced by the list has no `w:lvl` of its own, only a
`w:numStyleLink`, and the levels live in the abstractNum whose
`w:styleLink` names the same style (ECMA-376 17.9.21 and 17.9.27).
The reader only looked at the referenced abstractNum, found no levels,
and turned the list items into plain paragraphs.
When an abstractNum has no levels but has a `w:numStyleLink`, take the
levels of the abstractNum with the matching `w:styleLink`.
Closes#9222.
Only `w:u` with `w:val="single"` was read as Underline. Double, thick,
dotted, wavy and the other underline types, which Word also shows as
underlined text, were dropped. Every value except `none` now gives
Underline, as `w:highlight` already does for highlighting.
Closes#11988.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
If `PANDOC_DATA_DIRS` is set, the (absolute) directories it lists are
searched, in order, for data files not found in the user data directory,
before falling back to the default data files. This covers templates,
filters, defaults files, metadata files, CSL styles, and other data
files.
[API change] Text.Pandoc.Class: Export new functions `getDataDirs` and
`getPandocDataDirs`.
If `PANDOC_USER_DATA_DIRS` is set, print its value in `--version`
output.
Closes#7922.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With `+styles`, named paragraph and character styles are recorded
in `custom-style` attributes on Divs and Spans, as in the docx
reader. Automatic styles are resolved to the named style they are
based on, and the user-visible name of the style is used.
The default paragraph style, default table cell styles, and styles
that pandoc interprets itself (Emphasis, Strong Emphasis, Source Text,
links, table captions) are not recorded. Paragraphs in list items
and image captions are not wrapped. Headings get a `custom-style`
attribute if their style is not the standard one for their level.
OpenDocument writer: encode custom style names as LibreOffice does,
e.g. `Text body` becomes `Text_20_body`, so that they match
the styles in a reference doc.
See #12060.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>