Skip to content

Commit ca6e899

Browse files
pwilkinCISC
andauthored
Update scripts/jinja/jinja-tester.py
Co-authored-by: Sigbjørn Skjæret <[email protected]>
1 parent de41400 commit ca6e899

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

scripts/jinja/jinja-tester.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,8 @@ def format_template_content(template_content):
147147

148148
# Copy the newline / space count from the original
149149
tc_rstrip = template_content.rstrip()
150-
if not tc_rstrip.endswith("-%}") and not tc_rstrip.endswith(r'-}}'):
151-
# If orig ends with -%} or -}}, that means all newlines are stripped anyways
152-
# So we shouldn't add anything
153-
trailing_length = len(template_content) - len(tc_rstrip)
154-
result += template_content[:-trailing_length]
150+
if (trailing_length := len(template_content) - len(tc_rstrip)):
151+
result += template_content[-trailing_length:]
155152

156153
return result
157154

0 commit comments

Comments
 (0)