Files
wordcraft/crates/engine
AiBizzAppsandClaude Opus 5.5 5ee2bda8fc M6: TOC follow-ups from #52 review, and a whole TOC heading in LibreOffice (#74)
* M6: close the TOC field in its last entry, not in a text box inside it

`para_inner` took `toc_end_here` only after writing the paragraph's content,
so a nested story in the last TOC entry (a text box) reached `para_inner`
first, took the flag, and wrote the field's end inside `w:txbxContent`.
Take it before the content.

Review follow-up on #52.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M6: Update Table reads a heading above the TOC at its own index

Pass 1 shifted every heading by `entries.len()` to account for the entries
now in the body, but entries go in below the TOC heading, so a heading above
it never moves. Its lookup landed on a TOC entry and took that page (a
Preface on page 1 above a TOC on page 2 showed 2). Shift only headings below
the TOC.

Review follow-up on #52.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M6: start the TOC field in the first entry, as Word does

The writer opened the TOC field at the end of the "Contents" heading.
Word reads that fine, but LibreOffice splits the heading: "Content" as
body text, then "s" as the TOC title (on the next page when the TOC
follows a page break). Word itself writes the heading before the field
and begins the field in the first entry; written that way, LibreOffice
shows the heading whole.

Hold the heading's field back and write its begin/instruction/separate
at the start of the first entry, taken before the paragraph content so
a text box in the heading or an entry can't claim it (as with the end).

The reader moves a TOC field that starts a paragraph right after a TOC
Heading back to the end of the heading, so WordCraft's own files read
back as before and a TOC saved by Word now updates in WordCraft too
(before, Update Table left Word's first entry behind as a duplicate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 06:16:48 -04:00
..