diff --git a/nginxfmt.py b/nginxfmt.py index 418b348..3244b85 100755 --- a/nginxfmt.py +++ b/nginxfmt.py @@ -66,12 +66,16 @@ def clean_lines(orig_lines) -> list: else: if line.startswith("#"): cleaned_lines.append(strip_variable_template_tags(line)) - elif line.startswith("rewrite"): - cleaned_lines.append(strip_variable_template_tags(line)) else: - cleaned_lines.extend( - [strip_variable_template_tags(l).strip() for l in re.split(r"([{}])", line) if l != ""]) - + if line.count(";") > 1: + newlines = line.split(";") + cleaned_lines.extend(clean_lines(["".join([ln, ";"]) for ln in newlines if ln != ""])) + else: + if line.startswith("rewrite"): + cleaned_lines.append(strip_variable_template_tags(line)) + else: + cleaned_lines.extend( + [strip_variable_template_tags(l).strip() for l in re.split(r"([{}])", line) if l != ""]) return cleaned_lines