Chore: document the page numbering in zone OCR

This commit is contained in:
stumpylog committed 2026-11-20 09:52:58 -08:00
1 parent ad64f2a1b1
commit 6b8b946567
2 files changed
+8 -2

No files matched your search

+4 -1
View File
@@ -439,7 +439,10 @@ def zone_results_written(results: list[ZoneOcrResult]) -> bool:
def _resolve_page_idx(page_value: int | None, page_count: int | None) -> int:
"""Resolve a 1-based page or -1 (last page), defaulting to the first page."""
"""
Resolve a zone's 1-based page or -1 (last page) to a 0-based index, defaulting
to the first page. Without a page count, the last page resolves to the first.
"""
if page_value == -1:
return max((page_count or 1) - 1, 0)
return max((page_value or 1) - 1, 0)