diff --git a/nginxfmt.py b/nginxfmt.py index 3f1d70b..4d79507 100755 --- a/nginxfmt.py +++ b/nginxfmt.py @@ -39,6 +39,7 @@ def strip_line(single_line): within_quotes = not within_quotes return '"'.join(parts) + def multi_semicolon(single_line): """break multi_semicolon into multiline (except when within quotation marks).""" @@ -99,7 +100,6 @@ def strip_reg_template_tags(line: str) -> str: line = line.replace(TEMPLATE_REG_CLOSING_TAG, "}") return line - def apply_variable_template_tags(line: str) -> str: """Replaces variable indicators ${ and } with tags, so subsequent formatting is easier.""" return re.sub(r'\${\s*(\w+)\s*}', diff --git a/test_nginxfmt.py b/test_nginxfmt.py index d23aaa5..c3868b2 100644 --- a/test_nginxfmt.py +++ b/test_nginxfmt.py @@ -48,7 +48,7 @@ class TestFormatter(unittest.TestCase): self.assertEqual(["{", "a aa;", "bb b \"ccc; dddd;\";", "ee e; # ff; ee ;", "}"], clean_lines(("{", "a aa; bb b \"ccc; dddd;\"; ee e; # ff; ee ;", "}"))) - + self.assertEqual(["location ~ /\.ht", "{"], clean_lines(["location ~ /\.ht {", ])) def test_perform_indentation(self):