diff --git a/renderer/unit.py b/renderer/unit.py index 46f4ffc..86f6c9e 100644 --- a/renderer/unit.py +++ b/renderer/unit.py @@ -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 diff --git a/test/test_unit.py b/test/test_unit.py index f37bc09..763aa18 100644 --- a/test/test_unit.py +++ b/test/test_unit.py @@ -41,6 +41,7 @@ def test_special_units_html(): """Test special units: Don't put space before ° and %.""" assertions = { "100%": "100%", + "100 %": "100%", "42,24°": "42,24°", }