fix: parse percentage as unit

This commit is contained in:
Tim Grelka
2025-05-24 23:58:58 +02:00
parent b37839b77d
commit b183ef39f1
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ class Unit(SpanToken):
# Group all units together in a capture group.
+ "|".join(units)
# Word boundary check at end of unit to ensure proper handling of units like A, Ah etc.
+ r")\b"
+ r")(?!\w)"
)
value: str
+1
View File
@@ -40,6 +40,7 @@ def test_translated_units_html():
def test_special_units_html():
"""Test special units: Don't put space before ° and %."""
assertions = {
"100%": "100%",
"100 %": "100%",
"42,24°": "42,24°",
}