Skip to content

Fixes #151: Generate page references for tocentry/@bookmarkRef - #193

Merged
drmacro merged 1 commit into
developfrom
feature/Issue-151-tocentry-bookmarkref-rebased
Oct 11, 2026
Merged

drmacro merged 1 commit into
developfrom
feature/Issue-151-tocentry-bookmarkref-rebased

Conversation

@ekimbernow

Copy link
Copy Markdown
Collaborator

Summary

  • A tocentry with @bookmarkRef now gets a tab and a PAGEREF field pointing at the bookmark with that @id. The bookmark's @name is looked up from the input document, including bookmarks defined after the ToC. @arg-n="true" suppresses the page number.
  • The ToC field is only marked dirty (update on open) when the toc has no explicit tocentry children. Word replaces explicit entries with generated ones when it updates a dirty field.
  • Adds two tests and fixtures, plus a README release note.

Not taken from feature/Issue-151-tocentry-bookmarkRef

That branch also made bookmark names always equal their @id, made a missing hyperlink @href throw, and skipped namespace tokens in makeRun. These change behaviour beyond this issue, so I left them out. The old branch can be deleted after merge.

Testing

  • mvn install passes.
  • Checked in Word with a fixture that has page breaks: Update Field offers "Update page numbers only", the explicit entries are kept, and "Second heading" updates from 1 to 2 where it actually falls. The entry with arg-n="true" has no page number.

🤖 Generated with Claude Code

- A tocentry with @bookmarkRef now gets a tab and a PAGEREF field that
  points to the bookmark with that @id (looked up by @name, including
  bookmarks defined after the ToC). @Arg-N="true" suppresses it.
- Only mark the ToC field dirty (update on open) when the toc has no
  explicit tocentry elements, since Word would otherwise replace the
  explicit entries with generated ones.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@drmacro drmacro self-assigned this Oct 11, 2026
@drmacro drmacro added bug Something isn't working enhancement New feature or request labels Oct 11, 2026
@drmacro
drmacro merged commit 5e0af79 into develop Oct 11, 2026
2 checks passed
@drmacro
drmacro deleted the feature/Issue-151-tocentry-bookmarkref-rebased branch October 11, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants