feat: add support for roman numeral page numbers in TOC - #481
Open
denis-samatov wants to merge 1 commit into
Open
feat: add support for roman numeral page numbers in TOC#481denis-samatov wants to merge 1 commit into
denis-samatov wants to merge 1 commit into
Conversation
- Add roman_to_int helper to parse roman numeral page numbers (e.g. 'i', 'ii', 'iv', 'xii', 'IV') - Update convert_page_to_int to convert roman numerals into integers - Prevents roman-numeral preface and introductory sections from falling back to unindexed/None pages - Add comprehensive test suite in tests/test_roman_numerals.py Closes VectifyAI#164
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
i,ii,iv,xii,IV) in Table of Contents structures.convert_page_to_int, being skipped bycalculate_page_offsetandadd_page_offset_to_toc_json, and unnecessarily falling back to fallback search.Changes
pageindex/utils.py:roman_to_int(s: str) -> int | Nonewith standard Roman numeral validation (case-insensitive, supportingithroughm).convert_page_to_int(data)to attempt integer conversion first, and ifValueError, parse valid Roman numerals into integers.tests/test_roman_numerals.py:convert_page_to_inton mixed Arabic and Roman numeral TOC structures.Verification
pytest tests/test_roman_numerals.py: 41 passed.Closes #164