Skip to content

Commit

Permalink
Fix Hebrew highlighting regex (hedyorg#3500)
Browse files Browse the repository at this point in the history
Fixes hedyorg#3476

The regex `CHARACTER` from [highlighting/definition.py](https://github.com/Felienne/hedy/blob/main/highlighting/definition.py) now includes Hebrew characters. The editor no longer recognizes Hebrew characters as end-of-word.

Before (level 11):
![image](https://user-images.githubusercontent.com/61731312/198108602-c46e2f13-6628-4399-9fc8-0e238c673939.png)

After:
![image](https://user-images.githubusercontent.com/61731312/198108713-78d490ee-5b6b-4140-b3b3-4f2f9db55b3d.png)
  • Loading branch information
o11k authored Nov 21, 2022
1 parent d2ce6fe commit 93daf5c
Show file tree
Hide file tree
Showing 9 changed files with 2,455 additions and 1,493 deletions.
6 changes: 3 additions & 3 deletions highlighting/definition.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This file defines the special regexes

# list of symbols recognized as characters (with non-Latin characters)
CHARACTER = '0-9_A-Za-zÀ-ÿء-ي'
CHARACTER = '[\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}_\p{Mn}\p{Mc}\p{Nd}\p{Pc}·]'

# definition of word
WORD = '([' + CHARACTER + "]+)"
WORD = '(' + CHARACTER + "+)"
# space
SPACE = "( +)"

Expand All @@ -14,7 +14,7 @@

# beginning and end of words
START_WORD = '(^| )'
END_WORD = '(?![' + CHARACTER + '])'
END_WORD = '(?!' + CHARACTER + ')'

DIGIT = '[__DIGIT__]'

Expand Down
2 changes: 1 addition & 1 deletion highlighting/generate-rules-highlighting.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import re
import regex as re
import yaml
import json

Expand Down
Loading

0 comments on commit 93daf5c

Please sign in to comment.