Repository navigation
Implement rule P1 in bidi.py as split_into_paragraphs - #13
Merged
Merged
Conversation
Move the paragraph splitter from demo.py into the P rules section of bidi.py, where it sits next to P2-P3. apply_bidi_algorithm still handles one paragraph. The demo now splits built-in examples as well as user text, and a new example shows two paragraphs getting different directions. README.md and CLAUDE.md are updated to match.
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
demo.pyinto the P rules section ofbidi.pyassplit_into_paragraphs, the function for UAX #9 rule P1. It replaces the comment that said P1 was not implemented.apply_bidi_algorithmstill handles one paragraph and returns the same four values; its docstring now says to split longer text with P1 first.demo.pyagain holds no algorithm logic."שלום\nHello"): the first paragraph resolves to RTL (level 1) and the second to LTR (level 0).Testing
tests/run_bidi_tests.py: 91,707 passed, 0 failedtests/run_bidi_type_tests.py: 770,241 passed, 0 failedpython bidi.py --all --briefruns every example