allow underscors in variables

This commit is contained in:
Tobias Bengfort 2019-11-16 14:47:22 +01:00
parent b3ec58b63d
commit aa5bfee35d
2 changed files with 4 additions and 1 deletions

View File

@ -135,7 +135,7 @@ def clear(po_path, line, drop_capitalized=False):
r" - ", # Drop lone dashes (sometimes used in place of -- or ---)
r"-\\ ", # Ignore "MINUS BACKSLASH SPACE" typically used in
# formulas, like '-\ *π*' but *π* gets removed too
r"{[a-z]*?}", # Sphinx variable
r"{[a-z_]*?}", # Sphinx variable
r"'?-?\b([0-9]+\.)*[0-9]+\.[0-9abcrx]+\b'?", # Versions
r"[0-9]+h", # Hours
r"%\([a-z_]+?\)s", # Sphinx variable

View File

@ -45,6 +45,9 @@ def test_clear():
== "Hier, Marc-André Lemburg a fait"
)
# We remove variables
assert clear("test", "Starting {days_since} days ago") == "Starting days ago"
# Drop PEP 440 versions
assert (
clear("test", "under python 1.6a1, 1.5.2, and earlier.")