diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 37e66f3..cf12df9 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -12,6 +12,7 @@ on: jobs: claude-review: + if: github.event.pull_request.head.repo.full_name == github.repository # Optional: Filter by PR author # if: | # github.event.pull_request.user.login == 'external-contributor' || diff --git a/arabic_reshaper/arabic_reshaper.py b/arabic_reshaper/arabic_reshaper.py index ac954e7..5fa55a3 100644 --- a/arabic_reshaper/arabic_reshaper.py +++ b/arabic_reshaper/arabic_reshaper.py @@ -27,8 +27,8 @@ '\u06d6-\u06dc' '\u06df-\u06e8' '\u06ea-\u06ed' - '\u08d4-\u08e1' - '\u08d4-\u08ed' + '\u0897-\u089f' + '\u08ca-\u08e1' '\u08e3-\u08ff' ']', diff --git a/arabic_reshaper/tests/test_006_harakat_ranges.py b/arabic_reshaper/tests/test_006_harakat_ranges.py new file mode 100644 index 0000000..6f91c01 --- /dev/null +++ b/arabic_reshaper/tests/test_006_harakat_ranges.py @@ -0,0 +1,30 @@ +import unittest + +import arabic_reshaper + + +class TestHarakatRanges(unittest.TestCase): + def setUp(self): + self.keep = arabic_reshaper.ArabicReshaper( + configuration={'delete_harakat': False} + ) + + def test_extended_marks_do_not_break_joining(self): + # Combining marks added in later Unicode versions must not split + # the letters around them. U+FE91 and U+FE90 are initial and + # final beh. + for mark in ('\u0897', '\u089f', '\u08ca', '\u08d0', '\u08d3', + '\u08e1', '\u08e3', '\u08ff'): + with self.subTest(mark='U+%04X' % ord(mark)): + self.assertEqual( + self.keep.reshape('\u0628' + mark + '\u0628'), + '\ufe91' + mark + '\ufe90' + ) + + def test_disputed_end_of_ayah_is_not_a_haraka(self): + # U+08E2 is a format character, so deleting harakat keeps it. + self.assertIn('\u08e2', arabic_reshaper.reshape('\u0628\u08e2')) + + +if __name__ == '__main__': + unittest.main()