From aa5bfee35d577d72eb066bdad7f11184e806df01 Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Sat, 16 Nov 2019 14:47:22 +0100 Subject: [PATCH] allow underscors in variables --- pospell.py | 2 +- tests/test_pospell.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pospell.py b/pospell.py index c6fea4c..1673b16 100644 --- a/pospell.py +++ b/pospell.py @@ -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 diff --git a/tests/test_pospell.py b/tests/test_pospell.py index 361087b..ea7b4ca 100644 --- a/tests/test_pospell.py +++ b/tests/test_pospell.py @@ -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.")