Files
John MacFarlane 656a6704a5 RTF writer: emit real RTF lists with a list table.
Lists were written as plain paragraphs with a literal marker and a
hanging indent, carrying none of the `\ls`/`\ilvl` references or the
`\listtable`/`\listoverridetable` that the RTF list model (and pandoc's
own reader) expect, so lists could not round-trip.

Walk the document tagging each list with a unique id and nesting level
(`prepareLists`), build a `\listtable`/`\listoverridetable` describing
each list (`listTableRTF`, exposed via the `listtable` template
variable), and render every list paragraph with its `\ls`/`\ilvl`
reference.  The first paragraph of each item gets a `{\listtext}`
marker; continuation paragraphs keep the reference but omit it, so
multi-paragraph items round-trip.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-09 00:17:57 +02:00

34 lines
645 B
Plaintext

{\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 \fmodern Courier;}}
{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}
$if(listtable)$
$listtable$
$endif$
\widowctrl\hyphauto
$for(header-includes)$
$header-includes$
$endfor$
$if(title)$
{\pard \qc \f0 \sa180 \li0 \fi0 \b \fs36 $title$\par}
$endif$
$for(author)$
{\pard \qc \f0 \sa180 \li0 \fi0 $author$\par}
$endfor$
$if(date)$
{\pard \qc \f0 \sa180 \li0 \fi0 $date$\par}
$endif$
$if(spacer)$
{\pard \ql \f0 \sa180 \li0 \fi0 \par}
$endif$
$if(toc)$
$table-of-contents$
$endif$
$for(include-before)$
$include-before$
$endfor$
$body$
$for(include-after)$
$include-after$
$endfor$
}