fix multiline `;` in one line case and rewrite regex curly bracket case.

fix multiline `;` in one line case  and rewrite regex curly bracket case.
pull/6/head
RickieL 6 years ago committed by GitHub
parent 21012dab46
commit 93748ca7a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"):
else:
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

Loading…
Cancel
Save