Merge pull request #358 from Riverside-Healthcare/dev

This commit is contained in:
sur.la.route 2022-08-29 20:45:50 -05:00 committed by GitHub
commit ffdb1f0e14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 464 additions and 310 deletions

110
docs/package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "djlint_docs",
"version": "1.0.25",
"version": "1.0.26",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "djlint_docs",
"version": "1.0.25",
"version": "1.0.26",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@creativebulma/bulma-divider": "^1.1.0",
@ -37,7 +37,7 @@
"eleventy-plugin-edit-on-github": "1.1.0",
"eleventy-plugin-metagen": "1.7.11",
"esbuild": "0.15.5",
"eslint": "8.22.0",
"eslint": "8.23.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.26.0",
"fontawesome-subset": "4.2.0",
@ -50,7 +50,7 @@
"postcss-cli": "10.0.0",
"postcss-nested": "5.0.6",
"prettier": "2.7.1",
"prismjs": "1.28.0",
"prismjs": "1.29.0",
"sass": "1.54.5",
"slugify": "1.6.5"
}
@ -636,14 +636,14 @@
}
},
"node_modules/@eslint/eslintrc": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz",
"integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz",
"integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.3.2",
"espree": "^9.4.0",
"globals": "^13.15.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
@ -653,6 +653,9 @@
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/@eslint/eslintrc/node_modules/argparse": {
@ -760,6 +763,19 @@
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@humanwhocodes/module-importer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
"integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
"dev": true,
"engines": {
"node": ">=12.22"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@humanwhocodes/object-schema": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
@ -4311,14 +4327,15 @@
}
},
"node_modules/eslint": {
"version": "8.22.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.22.0.tgz",
"integrity": "sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA==",
"version": "8.23.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz",
"integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.0",
"@eslint/eslintrc": "^1.3.1",
"@humanwhocodes/config-array": "^0.10.4",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@ -4328,7 +4345,7 @@
"eslint-scope": "^7.1.1",
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.3.0",
"espree": "^9.3.3",
"espree": "^9.4.0",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
@ -4353,8 +4370,7 @@
"regexpp": "^3.2.0",
"strip-ansi": "^6.0.1",
"strip-json-comments": "^3.1.0",
"text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3"
"text-table": "^0.2.0"
},
"bin": {
"eslint": "bin/eslint.js"
@ -4813,9 +4829,9 @@
}
},
"node_modules/espree": {
"version": "9.3.3",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.3.3.tgz",
"integrity": "sha512-ORs1Rt/uQTqUKjDdGCyrtYxbazf5umATSf/K4qxjmZHORR6HJk+2s/2Pqe+Kk49HHINC/xNIrGfgh8sZcll0ng==",
"version": "9.4.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz",
"integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==",
"dev": true,
"dependencies": {
"acorn": "^8.8.0",
@ -9109,9 +9125,9 @@
}
},
"node_modules/prismjs": {
"version": "1.28.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.28.0.tgz",
"integrity": "sha512-8aaXdYvl1F7iC7Xm1spqSaY/OJBpYW3v+KJ+F17iYxvdc8sfjW194COK5wVhMZX45tGteiBQgdvD/nhxcRwylw==",
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
"dev": true,
"engines": {
"node": ">=6"
@ -11344,12 +11360,6 @@
"node": ">= 0.4.0"
}
},
"node_modules/v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true
},
"node_modules/v8-compile-cache-lib": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz",
@ -12176,14 +12186,14 @@
"optional": true
},
"@eslint/eslintrc": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz",
"integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz",
"integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.3.2",
"espree": "^9.4.0",
"globals": "^13.15.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
@ -12279,6 +12289,12 @@
"integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==",
"dev": true
},
"@humanwhocodes/module-importer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
"integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
"dev": true
},
"@humanwhocodes/object-schema": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
@ -14916,14 +14932,15 @@
}
},
"eslint": {
"version": "8.22.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.22.0.tgz",
"integrity": "sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA==",
"version": "8.23.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz",
"integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.0",
"@eslint/eslintrc": "^1.3.1",
"@humanwhocodes/config-array": "^0.10.4",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@ -14933,7 +14950,7 @@
"eslint-scope": "^7.1.1",
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.3.0",
"espree": "^9.3.3",
"espree": "^9.4.0",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
@ -14958,8 +14975,7 @@
"regexpp": "^3.2.0",
"strip-ansi": "^6.0.1",
"strip-json-comments": "^3.1.0",
"text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3"
"text-table": "^0.2.0"
},
"dependencies": {
"argparse": {
@ -15300,9 +15316,9 @@
"dev": true
},
"espree": {
"version": "9.3.3",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.3.3.tgz",
"integrity": "sha512-ORs1Rt/uQTqUKjDdGCyrtYxbazf5umATSf/K4qxjmZHORR6HJk+2s/2Pqe+Kk49HHINC/xNIrGfgh8sZcll0ng==",
"version": "9.4.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz",
"integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==",
"dev": true,
"requires": {
"acorn": "^8.8.0",
@ -18443,9 +18459,9 @@
"dev": true
},
"prismjs": {
"version": "1.28.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.28.0.tgz",
"integrity": "sha512-8aaXdYvl1F7iC7Xm1spqSaY/OJBpYW3v+KJ+F17iYxvdc8sfjW194COK5wVhMZX45tGteiBQgdvD/nhxcRwylw==",
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
"dev": true
},
"process-nextick-args": {
@ -20174,12 +20190,6 @@
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true
},
"v8-compile-cache-lib": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz",

View file

@ -1,6 +1,6 @@
{
"name": "djlint_docs",
"version": "1.0.25",
"version": "1.0.26",
"description": "",
"main": "index.js",
"scripts": {
@ -41,7 +41,7 @@
"eleventy-plugin-edit-on-github": "1.1.0",
"eleventy-plugin-metagen": "1.7.11",
"esbuild": "0.15.5",
"eslint": "8.22.0",
"eslint": "8.23.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.26.0",
"fontawesome-subset": "4.2.0",
@ -54,7 +54,7 @@
"postcss-cli": "10.0.0",
"postcss-nested": "5.0.6",
"prettier": "2.7.1",
"prismjs": "1.28.0",
"prismjs": "1.29.0",
"sass": "1.54.5",
"slugify": "1.6.5"
},

536
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -60,13 +60,13 @@
"@semantic-release/commit-analyzer": "9.0.2",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "8.0.5",
"@semantic-release/github": "8.0.6",
"@semantic-release/npm": "9.0.1",
"@semantic-release/release-notes-generator": "10.0.3",
"cz-conventional-changelog": "3.3.0",
"lint-staged": "13.0.3",
"semantic-release": "19.0.3",
"xo": "0.51.0"
"semantic-release": "19.0.5",
"xo": "0.52.2"
},
"config": {
"commitizen": {

View file

@ -1,47 +1,47 @@
astroid==2.11.7; python_full_version >= "3.7.2"
atomicwrites==1.4.0; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
astroid==2.12.5; python_full_version >= "3.7.2"
atomicwrites==1.4.1; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
black==22.1.0; python_full_version >= "3.6.2"
click==8.0.3; python_version >= "3.6"
black==22.6.0; python_full_version >= "3.6.2"
click==8.1.3; python_version >= "3.6"
colorama==0.4.5; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
coverage==6.4.2; python_version >= "3.7"
cssbeautifier==1.14.4
coverage==6.4.4; python_version >= "3.7"
cssbeautifier==1.14.6
dill==0.3.5.1; python_full_version >= "3.7.2"
editorconfig==0.12.3
execnet==1.9.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
flake8==3.9.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
html-tag-names==0.1.2; python_version >= "3.7" and python_version < "4.0"
html-void-elements==0.1.0; python_version >= "3.7" and python_version < "4.0"
importlib-metadata==4.11.0; python_version >= "3.7"
importlib-metadata==4.12.0; python_version >= "3.7"
iniconfig==1.1.1; python_version >= "3.7"
isort==5.10.1; python_full_version >= "3.6.1" and python_version < "4.0"
jsbeautifier==1.14.4
jsbeautifier==1.14.6
lazy-object-proxy==1.7.1; python_version >= "3.6" and python_full_version >= "3.7.2"
mccabe==0.6.1; python_full_version >= "3.7.2"
mccabe==0.7.0; python_full_version >= "3.7.2"
mypy-extensions==0.4.3; python_full_version >= "3.6.2" and python_version >= "3.6"
mypy==0.971; python_version >= "3.6"
packaging==21.3; python_version >= "3.7"
pathspec==0.9.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
pep8-naming==0.13.1
platformdirs==2.5.0; python_version >= "3.7" and python_full_version >= "3.7.2"
pep8-naming==0.13.2
platformdirs==2.5.2; python_version >= "3.7" and python_full_version >= "3.7.2"
pluggy==1.0.0; python_version >= "3.7"
py==1.11.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
pycodestyle==2.7.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pyflakes==2.3.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pylint==2.14.5; python_full_version >= "3.7.2"
pyparsing==3.0.7; python_version >= "3.7"
pycodestyle==2.9.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pyflakes==2.5.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pylint==2.15.0; python_full_version >= "3.7.2"
pyparsing==3.0.9; python_version >= "3.7"
pytest-cov==3.0.0; python_version >= "3.6"
pytest-forked==1.4.0; python_version >= "3.6"
pytest-xdist==2.5.0; python_version >= "3.6"
pytest==7.1.2; python_version >= "3.7"
pyyaml==6.0; python_version >= "3.6"
regex==2022.1.18
regex==2022.8.17
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
tomli==2.0.1; python_version >= "3.7" and python_full_version >= "3.7.2" and python_full_version <= "3.11.0a6" and python_version < "3.11" or python_version < "3.11"
tomlkit==0.11.1; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.7.2"
tqdm==4.62.3; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
typed-ast==1.4.3; python_version < "3.8" and implementation_name == "cpython" and python_full_version >= "3.7.2" and python_version >= "3.6"
tomlkit==0.11.4; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.7.2"
tqdm==4.64.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
typed-ast==1.5.4; python_version < "3.8" and implementation_name == "cpython" and python_full_version >= "3.7.2" and python_version >= "3.6"
types-pyyaml==6.0.11
typing-extensions==4.1.0; python_version < "3.8" and python_version >= "3.7" and python_full_version >= "3.7.2"
typing-extensions==4.3.0; python_version < "3.8" and python_version >= "3.7" and python_full_version >= "3.7.2"
wrapt==1.14.1; python_full_version >= "3.7.2"
zipp==3.7.0; python_version < "3.8" and python_version >= "3.7"
zipp==3.8.1; python_version < "3.8" and python_version >= "3.7"

View file

@ -8,7 +8,7 @@ from functools import partial
import regex as re
from ..helpers import inside_ignored_block
from ..helpers import inside_ignored_block, inside_template_block
from ..settings import Config
@ -19,10 +19,15 @@ def expand_html(html: str, config: Config) -> str:
"""Add whitespace.
Do not add whitespace if the tag is in a non indent block.
Do not add whiatespace if the tag is a in a template block
"""
if inside_ignored_block(config, html, match):
return match.group(1)
if inside_template_block(config, html, match):
return match.group(1)
if out_format == "\n%s" and match.start() == 0:
return match.group(1)
@ -54,6 +59,7 @@ def expand_html(html: str, config: Config) -> str:
add_right,
html,
)
print(html)
# template tag breaks
def should_i_move_template_tag(out_format: str, match: re.Match) -> str:

View file

@ -85,6 +85,22 @@ def is_safe_closing_tag(config: Config, item: str) -> bool:
)
def inside_template_block(config: Config, html: str, match: re.Match) -> bool:
"""Check if a re.Match is inside of a template block."""
return any(
ignored_match.start(0) <= match.start() and match.end(0) <= ignored_match.end()
for ignored_match in list(
re.finditer(
re.compile(
config.template_blocks,
re.DOTALL | re.IGNORECASE | re.VERBOSE | re.MULTILINE,
),
html,
)
)
)
def inside_ignored_block(config: Config, html: str, match: re.Match) -> bool:
"""Do not add whitespace if the tag is in a non indent block."""
return any(
@ -93,7 +109,7 @@ def inside_ignored_block(config: Config, html: str, match: re.Match) -> bool:
re.finditer(
re.compile(
config.ignored_blocks,
re.DOTALL | re.IGNORECASE | re.VERBOSE | re.MULTILINE | re.DOTALL,
re.DOTALL | re.IGNORECASE | re.VERBOSE | re.MULTILINE,
),
html,
)

View file

@ -7,19 +7,20 @@
- golang
patterns:
# open
- '{{[^\s#/@^]+'
- '{%-[^\s]+'
- '{%[^\s|\-]+'
- '{{[^\s#/@^\-\+]+'
- '{%[\-\+][^\s]+'
- '{%[^\s|\-|\+]+'
# handlebars
- '[^{]{#[^\s-]+|^{#[^\s-]+'
- '[^{]{#-[^\s]+|^{#-[^\s]+'
- '[^{]{\/[^\s]+|^{\/[^\s]+'
- '[^{]{\@[^\s]+|^{\@[^\s]+'
# close
- '[^(\s|^|\-)]+[}|%|#]}'
- '[^(\s|^|\-|\+)]+[}|%|#]}'
- '[^(\s|^)]+\-[}|%|#]}'
- '[^\s][ ]{2,}[}|%|#]}'
- '{[{|%|#]-?[ ]{2,}'
- '[^(\s|^)]+\+[}|%|#]}'
- '[^\s\-\+][ ]{2,}[}|%|#]}'
- '{[{|%|#]\-?\+?[ ]{2,}'
- rule:
name: T002
message: Double quotes should be used in tags.

View file

@ -577,7 +577,9 @@ class Config:
+ r"""
"""
)
self.template_blocks: str = r"""
{%((?!%}).)+%}
"""
self.ignored_blocks: str = r"""
<(pre|textarea).*?</(\1)>
| <(script|style).*?(?=(\</(?:\3)>))

View file

@ -42,3 +42,7 @@ def test_call(runner: CliRunner, tmp_file: TextIO) -> None:
{% endcall %}
"""
)
# tags inside template tags should not be formatted.
output = reformat(tmp_file, runner, b"{% call (a, b) render_form(form, '<hr>'>) %}")
assert output.exit_code == 0

View file

@ -55,13 +55,18 @@ def test_T001(runner: CliRunner, tmp_file: TextIO) -> None:
tmp_file.name,
b"""<div>
{%
("SashaNose", "1"),
("something", "1"),
%}
</div>""",
)
result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
assert "T001" not in result.output
# allow jinja spaceless tags
write_to_file(tmp_file.name, b"{{- foo }}{{+ bar }}{{ biz -}}{{ baz +}}")
result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
assert "T001" not in result.output
def test_T002(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(tmp_file.name, b"{% extends 'this' %}")
@ -114,7 +119,7 @@ def test_H006(runner: CliRunner, tmp_file: TextIO) -> None:
b"""{# [INFO][JINJA] I use syntax "{% if <img alt=\""",
if I want that something happened solely if "img" exists in the content of my articles #}
<script src="KiraJS.js" defer></script>
<script src="script.js" defer></script>
""",
)
result = runner.invoke(djlint, [tmp_file.name])
@ -136,7 +141,7 @@ def test_H008(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
b"""<link rel="stylesheet" href="KiraCSS.css" media="print" onload="this.media='all'" media=''/>""",
b"""<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'" media=''/>""",
)
result = runner.invoke(djlint, [tmp_file.name])
assert result.exit_code == 1
@ -144,7 +149,7 @@ def test_H008(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
b"""<link rel="stylesheet" href="KiraCSS.css" media="print" onload="this.media='all'"/>""",
b"""<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'"/>""",
)
result = runner.invoke(djlint, [tmp_file.name])
assert "H008 1:" not in result.output
@ -777,15 +782,15 @@ def test_T032(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
b"""{# [INFO] Simple example #}
{% set kira = [
'Goddess', 'Genius'
{% set stuff = [
'value', 'value'
] %}
{# [INFO] Real example #}
{% set kira_online_scaners = [
('https://quttera.com/sitescan/', 'SashaButtonLightSkyBlue', 'Quttera'),
('https://sitecheck.sucuri.net/results/', 'SashaButtonLimeGreen', 'Sucuri'),
('https://www.isithacked.com/check/', 'SashaButtonPlum', 'Is It Hacked?'),
{% set online_scaners = [
('https://example.com', 'blue', 'One'),
('https://example.com', 'green', 'Two'),
('https://example.com', 'plum', 'Three'),
] %}
""",
)
@ -905,7 +910,7 @@ def test_ignoring_rules(runner: CliRunner, tmp_file: TextIO) -> None:
\t\t{# djlint:off H006 #}
\t\t<img src="{{ kira_variable }}.webp" alt="Kira Goddess!" />
\t\t<img src="{{ variable }}.webp" alt="stuff" />
\t\t{# djlint:on #}