Skip to content

Expand Anchor to hold multiple bounding boxes#8

Open
folded wants to merge 1 commit intomainfrom
multi-box-anchors
Open

Expand Anchor to hold multiple bounding boxes#8
folded wants to merge 1 commit intomainfrom
multi-box-anchors

Conversation

@folded
Copy link
Collaborator

@folded folded commented Mar 14, 2026

Summary

  • Replaces Anchor.box: BBox with Anchor.boxes: tuple[BBox, ...], allowing a single anchor to cover several visual lines (e.g. a sentence that wraps across lines in a two-column layout)
  • annotate() serialises multi-box anchors as semicolon-separated groups in data-bbox; single-box output is byte-for-byte identical to before, so the regression golden file is unchanged
  • strip() regex updated to parse the new format
  • _collect_overlapping_anchors now extends found_locations with all boxes from a matching anchor
  • bbox_alignment sorting key uses boxes[0] for reading-order stability
  • All tests updated to use the new boxes= keyword

Test plan

  • uv run pytest passes (56 tests)
  • uv run ruff check passes

🤖 Generated with Claude Code

Anchor.box: BBox is replaced by Anchor.boxes: tuple[BBox, ...], allowing
a single anchor to cover several visual lines (e.g. a full sentence that
wraps across lines in a two-column layout).

- annotate() serialises multi-box anchors as semicolon-separated groups
  in data-bbox; single-box output is unchanged, so the golden file is valid
- strip() regex updated to parse the new format
- _collect_overlapping_anchors extends found_locations with all boxes
- bbox_alignment sorting key uses boxes[0] for reading-order stability
- All tests updated to use the new boxes= keyword

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant