Skip to content

Commit

Permalink
fix: add raw tags before reassembling content
Browse files Browse the repository at this point in the history
fixes failing tests
  • Loading branch information
jannismain committed Jul 21, 2023
1 parent 987adc4 commit 1e3ca35
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions includex.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ def includex(
prefix += 1
suffix += 1

if raw:
if not content[-1].endswith("\n"):
content[-1] += "\n"
content = ["{% raw %}\n", *content, "{% endraw %}"]
prefix += 1
suffix += 1

content = "".join(
[
((indent_char * indent) if i > 0 or indent_first else "")
Expand All @@ -183,11 +190,6 @@ def includex(
]
)

if raw:
content = "{% raw %}\n" + content + "\n{% endraw %}"
prefix += 1
suffix += 1

if escape_notice and has_escaped_characters:
if not content.endswith("\n"):
content += "\n"
Expand Down

0 comments on commit 1e3ca35

Please sign in to comment.