Merge pull request #9 from xi/variable-underscore

allow underscors in variables
This commit is contained in:
Julien Palard 2019-11-18 07:24:34 +01:00 committed by GitHub
commit 4fa26a6e56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.")