From 310e85ba334b08a6992edb3910986d4300b47e88 Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Thu, 30 Sep 2021 10:25:34 +0200 Subject: [PATCH] closes #31 --- docs/conf.py | 2 +- docs/djlint/changelog.rst | 4 ++++ src/djlint/formatter/compress_html.py | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 02c0b2f..8afb6cf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,7 +12,7 @@ project = "djlint" copyright = "2021, Riverside Healthcare" author = "Christopher Pickering" -release = "0.4.5" +release = "0.4.6" version = release # -- General configuration --------------------------------------------------- diff --git a/docs/djlint/changelog.rst b/docs/djlint/changelog.rst index 8023c4d..55cfaf7 100644 --- a/docs/djlint/changelog.rst +++ b/docs/djlint/changelog.rst @@ -1,6 +1,10 @@ Changelog ========= +0.4.6 +----- +- fix bug `#31 `_ + 0.4.5 ----- - Added best practices to docs diff --git a/src/djlint/formatter/compress_html.py b/src/djlint/formatter/compress_html.py index 2f395b7..bee8dd2 100644 --- a/src/djlint/formatter/compress_html.py +++ b/src/djlint/formatter/compress_html.py @@ -120,16 +120,19 @@ def compress_html(html: str, config: Config) -> str: r"\1\3\4", html, ) - + print(html) + print( + fr"(<({config.single_line_html_tags})[ ][^>\n]{{,80}}>)\s*([^<\n]{{,80}})\s*?()" + ) html = re.sub( re.compile( - fr"(<({config.single_line_html_tags})[ ][^\n]{{,80}}>)\s*([^<\n]{{,80}})\s*?()", + fr"(<({config.single_line_html_tags})[ ][^>\n]{{,80}}>)\s*([^<\n]{{,80}})\s*?()", re.IGNORECASE | re.MULTILINE | re.DOTALL | re.VERBOSE, ), r"\1\3\4", html, ) - + print(html) html = re.sub( re.compile( rf"({{%-?[ ]*?({config.single_line_template_tags})[^\n]{{,30}}%}})\s*([^%\n]{{,50}})\s*?({{%-?[ ]+?end(\2)[ ]*?%}})",