diff --git a/src/djlint/settings.py b/src/djlint/settings.py
index 0a30ed70..8ad1f948 100644
--- a/src/djlint/settings.py
+++ b/src/djlint/settings.py
@@ -627,6 +627,7 @@ def __init__(
| ({self.template_if_for_pattern}
"""
+ r"""
+ | (?:\'|\") # allow random trailing quotes
| {{.*?}}
| {\#.*?\#}
| {%.*?%})
diff --git a/tests/test_django/test_quoted.py b/tests/test_django/test_quoted.py
index 9d3eb673..ce2b6487 100644
--- a/tests/test_django/test_quoted.py
+++ b/tests/test_django/test_quoted.py
@@ -1,6 +1,6 @@
"""Test django quoted tags.
-poetry run pytest tests/test_django/test_filter.py
+poetry run pytest tests/test_django/test_quoted.py
"""
import pytest
@@ -23,6 +23,28 @@
),
id="issue #640",
),
+ pytest.param(
+ (
+ '\n"
+ " test\n"
+ " {% if piece.like_count %}{{ piece.like_count }}{% endif %}\n"
+ "\n"
+ ),
+ (
+ '\n"
+ " test\n"
+ " {% if piece.like_count %}{{ piece.like_count }}{% endif %}\n"
+ "\n"
+ ),
+ id="issue #652",
+ ),
]