Skip to content

Commit

Permalink
Fix #39 also escape _ to -lowbar-
Browse files Browse the repository at this point in the history
  • Loading branch information
goodmami committed Oct 18, 2024
1 parent 23fa3b3 commit 30404fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'\\': '-bsol-',
']': '-rsqb-',
'^': '-Hat-',
'_': '_', # keep, even though it's conflated with ' ' -> '_'
'_': '-lowbar-',
'`': '-grave-',
'{': '-lbrace-',
'|': '-vert-',
Expand All @@ -46,7 +46,7 @@ def escape_lemma(lemma: str) -> str:
or '0' <= c <= '9' # not in initial position
# or c == ':' # drop this for xsd:id compatibility
# or c in '-' # blocked for special purpose (see below)
or c in '_.·' # _ is special-purpose, but accept
or c in '.·'
or 0xC0 <= codepoint <= 0xD6
or 0xD8 <= codepoint <= 0xF6
or 0xF8 <= codepoint <= 0x2FF
Expand Down
1 change: 1 addition & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ def test_escape_lemma():
assert escape_lemma("a:b:c") == "a-colon-b-colon-c"
assert escape_lemma("a-b-c") == "a--b--c"
assert escape_lemma("a´b´c") == "a-acute-b-acute-c"
assert escape_lemma("a_b_c") == "a-lowbar-b-lowbar-c"

0 comments on commit 30404fc

Please sign in to comment.