Merge branch 'dev' into renovate/npm-semantic-release-vulnerability

This commit is contained in:
sur.la.route 2022-06-16 13:41:08 -05:00 committed by GitHub
commit c208fc2c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 601 additions and 270 deletions

130
docs/package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "djlint_docs",
"version": "1.0.13",
"version": "1.0.14",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "djlint_docs",
"version": "1.0.13",
"version": "1.0.14",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@creativebulma/bulma-divider": "^1.1.0",
@ -36,7 +36,7 @@
"cz-conventional-changelog": "3.3.0",
"eleventy-plugin-metagen": "1.7.1",
"esbuild": "0.14.38",
"eslint": "8.16.0",
"eslint": "8.17.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.26.0",
"fontawesome-subset": "3.0.0",
@ -2541,16 +2541,16 @@
"node_modules/code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/color": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-4.2.1.tgz",
"integrity": "sha512-MFJr0uY4RvTQUKvPq7dh9grVOTYSFeXja2mBXioCGjnjJoXrAp9jJ1NQTDR73c9nwBSAQiNKloKl5zq9WB9UPw==",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
"integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
"dev": true,
"dependencies": {
"color-convert": "^2.0.1",
@ -2577,9 +2577,9 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/color-string": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.0.tgz",
"integrity": "sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ==",
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
"dev": true,
"dependencies": {
"color-name": "^1.0.0",
@ -4498,9 +4498,9 @@
}
},
"node_modules/eslint": {
"version": "8.16.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.16.0.tgz",
"integrity": "sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA==",
"version": "8.17.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz",
"integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.0",
@ -5448,7 +5448,7 @@
"node_modules/gauge": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==",
"dev": true,
"dependencies": {
"aproba": "^1.0.3",
@ -5464,7 +5464,7 @@
"node_modules/gauge/node_modules/ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
"dev": true,
"engines": {
"node": ">=0.10.0"
@ -5473,7 +5473,7 @@
"node_modules/gauge/node_modules/is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==",
"dev": true,
"dependencies": {
"number-is-nan": "^1.0.0"
@ -5578,7 +5578,7 @@
"node_modules/github-from-package": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
"integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=",
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
"dev": true
},
"node_modules/glob": {
@ -7845,9 +7845,9 @@
}
},
"node_modules/node-abi": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.8.0.tgz",
"integrity": "sha512-tzua9qWWi7iW4I42vUPKM+SfaF0vQSLAm4yO5J83mSwB7GeoWrDKC/K+8YCnYNwqP5duwazbw2X9l4m8SC2cUw==",
"version": "3.22.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.22.0.tgz",
"integrity": "sha512-u4uAs/4Zzmp/jjsD9cyFYDXeISfUWaAVWshPmDZOFOv4Xl4SbzTXm53I04C2uRueYJ+0t5PEtLH/owbn2Npf/w==",
"dev": true,
"dependencies": {
"semver": "^7.3.5"
@ -7857,9 +7857,9 @@
}
},
"node_modules/node-addon-api": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
"integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.0.0.tgz",
"integrity": "sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==",
"dev": true
},
"node_modules/node-fetch": {
@ -8102,7 +8102,7 @@
"node_modules/number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
"dev": true,
"engines": {
"node": ">=0.10.0"
@ -9378,9 +9378,9 @@
"dev": true
},
"node_modules/prebuild-install": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.0.1.tgz",
"integrity": "sha512-QBSab31WqkyxpnMWQxubYAHR5S9B2+r81ucocew34Fkl98FhvKIF50jIJnNOBmAZfyNV7vE5T6gd3hTVWgY6tg==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.0.tgz",
"integrity": "sha512-CNcMgI1xBypOyGqjp3wOc8AAo1nMhZS3Cwd3iHIxOdAUbb+YxdNuM4Z5iIrZ8RLvOsf3F3bl7b7xGq6DjQoNYA==",
"dev": true,
"dependencies": {
"detect-libc": "^2.0.0",
@ -10468,17 +10468,17 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/sharp": {
"version": "0.30.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.3.tgz",
"integrity": "sha512-rjpfJFK58ZOFSG8sxYSo3/JQb4ej095HjXp9X7gVu7gEn1aqSG8TCW29h/Rr31+PXrFADo1H/vKfw0uhMQWFtg==",
"version": "0.30.6",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.6.tgz",
"integrity": "sha512-lSdVxFxcndzcXggDrak6ozdGJgmIgES9YVZWtAFrwi+a/H5vModaf51TghBtMPw+71sLxUsTy2j+aB7qLIODQg==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
"color": "^4.2.1",
"color": "^4.2.3",
"detect-libc": "^2.0.1",
"node-addon-api": "^4.3.0",
"prebuild-install": "^7.0.1",
"semver": "^7.3.5",
"node-addon-api": "^5.0.0",
"prebuild-install": "^7.1.0",
"semver": "^7.3.7",
"simple-get": "^4.0.1",
"tar-fs": "^2.1.1",
"tunnel-agent": "^0.6.0"
@ -14164,13 +14164,13 @@
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
"dev": true
},
"color": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-4.2.1.tgz",
"integrity": "sha512-MFJr0uY4RvTQUKvPq7dh9grVOTYSFeXja2mBXioCGjnjJoXrAp9jJ1NQTDR73c9nwBSAQiNKloKl5zq9WB9UPw==",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
"integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
"dev": true,
"requires": {
"color-convert": "^2.0.1",
@ -14191,9 +14191,9 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"color-string": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.0.tgz",
"integrity": "sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ==",
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
"dev": true,
"requires": {
"color-name": "^1.0.0",
@ -15554,9 +15554,9 @@
}
},
"eslint": {
"version": "8.16.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.16.0.tgz",
"integrity": "sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA==",
"version": "8.17.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz",
"integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.0",
@ -16303,7 +16303,7 @@
"gauge": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==",
"dev": true,
"requires": {
"aproba": "^1.0.3",
@ -16319,13 +16319,13 @@
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==",
"dev": true,
"requires": {
"number-is-nan": "^1.0.0"
@ -16399,7 +16399,7 @@
"github-from-package": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
"integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=",
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
"dev": true
},
"glob": {
@ -18149,18 +18149,18 @@
}
},
"node-abi": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.8.0.tgz",
"integrity": "sha512-tzua9qWWi7iW4I42vUPKM+SfaF0vQSLAm4yO5J83mSwB7GeoWrDKC/K+8YCnYNwqP5duwazbw2X9l4m8SC2cUw==",
"version": "3.22.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.22.0.tgz",
"integrity": "sha512-u4uAs/4Zzmp/jjsD9cyFYDXeISfUWaAVWshPmDZOFOv4Xl4SbzTXm53I04C2uRueYJ+0t5PEtLH/owbn2Npf/w==",
"dev": true,
"requires": {
"semver": "^7.3.5"
}
},
"node-addon-api": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
"integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.0.0.tgz",
"integrity": "sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==",
"dev": true
},
"node-fetch": {
@ -18345,7 +18345,7 @@
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
"dev": true
},
"nunjucks": {
@ -19193,9 +19193,9 @@
"dev": true
},
"prebuild-install": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.0.1.tgz",
"integrity": "sha512-QBSab31WqkyxpnMWQxubYAHR5S9B2+r81ucocew34Fkl98FhvKIF50jIJnNOBmAZfyNV7vE5T6gd3hTVWgY6tg==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.0.tgz",
"integrity": "sha512-CNcMgI1xBypOyGqjp3wOc8AAo1nMhZS3Cwd3iHIxOdAUbb+YxdNuM4Z5iIrZ8RLvOsf3F3bl7b7xGq6DjQoNYA==",
"dev": true,
"requires": {
"detect-libc": "^2.0.0",
@ -20073,16 +20073,16 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"sharp": {
"version": "0.30.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.3.tgz",
"integrity": "sha512-rjpfJFK58ZOFSG8sxYSo3/JQb4ej095HjXp9X7gVu7gEn1aqSG8TCW29h/Rr31+PXrFADo1H/vKfw0uhMQWFtg==",
"version": "0.30.6",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.6.tgz",
"integrity": "sha512-lSdVxFxcndzcXggDrak6ozdGJgmIgES9YVZWtAFrwi+a/H5vModaf51TghBtMPw+71sLxUsTy2j+aB7qLIODQg==",
"dev": true,
"requires": {
"color": "^4.2.1",
"color": "^4.2.3",
"detect-libc": "^2.0.1",
"node-addon-api": "^4.3.0",
"prebuild-install": "^7.0.1",
"semver": "^7.3.5",
"node-addon-api": "^5.0.0",
"prebuild-install": "^7.1.0",
"semver": "^7.3.7",
"simple-get": "^4.0.1",
"tar-fs": "^2.1.1",
"tunnel-agent": "^0.6.0"

View file

@ -1,6 +1,6 @@
{
"name": "djlint_docs",
"version": "1.0.13",
"version": "1.0.14",
"description": "",
"main": "index.js",
"scripts": {
@ -40,7 +40,7 @@
"cz-conventional-changelog": "3.3.0",
"eleventy-plugin-metagen": "1.7.1",
"esbuild": "0.14.38",
"eslint": "8.16.0",
"eslint": "8.17.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.26.0",
"fontawesome-subset": "3.0.0",

View file

@ -8,6 +8,8 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte
# Changelog
Changelog is now included in the [release](https://github.com/Riverside-Healthcare/djLint/releases).
<!--## {{ "next_release" i18n }}-->
## 1.0.2
::: content

View file

@ -366,3 +366,30 @@ linter_output_format="{filename}:{line}: {code} {message} {match}"
"linter_output_format": "{filename}:{line}: {code} {message} {match}"
}
```
## preserve_leading_space
Preserve leading space on text, where possible. Ideal for non-html template files where text indent is intentional.
Usage:
**flag**
```bash
--preserve-leading-space
```
**pyproject.toml**
```ini
preserve_leading_space=true
```
**.djlintrc**
```json
{
"preserve_leading_space": true
}
```

View file

@ -8,6 +8,8 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte
# Changelog
Changelog est maintenant inclus dans la [release](https://github.com/Riverside-Healthcare/djLint/releases).
<!--## {{ "next_release" i18n }}-->
## 1.0.2
::: content

View file

@ -365,4 +365,30 @@ linter_output_format="{filename}:{line}: {code} {message} {match}"
{
"linter_output_format": "{filename}:{line}: {code} {message} {match}"
}
```
```
## preserve_leading_space
Préserve l'espace de tête du texte, dans la mesure du possible. Idéal pour les fichiers de modèles non-html où l'indentation du texte est intentionnelle.
Utilisation:
**flag**
```bash
--preserve-leading-space
```
**pyproject.toml**
```ini
preserve_leading_space=true
```
**.djlintrc**
```json
{
"preserve_leading_space": true
}
```

View file

@ -8,6 +8,8 @@ keywords: облицовка шаблонов, форматер шаблонов
# Изменения
Изменения теперь включен в [релиз](https://github.com/Riverside-Healthcare/djLint/releases).
<!--## {{ "next_release" i18n }}-->
## 1.0.2
::: content

View file

@ -361,4 +361,30 @@ linter_output_format="{filename}:{line}: {code} {message} {match}"
{
"linter_output_format": "{filename}:{line}: {code} {message} {match}"
}
```
```
## preserve_leading_space
Сохраняет пробелы в тексте, где это возможно. Идеально подходит для не-html файлов шаблонов, где отступ текста является намеренным.
Использование:
**flag**
```bash
--preserve-leading-space
```
**pyproject.toml**
```ini
preserve_leading_space=true
```
**.djlintrc**
```json
{
"preserve_leading_space": true
}
```

525
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -94,6 +94,11 @@ from .src import get_src
is_flag=True,
help="Return errors as warnings.",
)
@click.option(
"--preserve-leading-space",
is_flag=True,
help="Attempt to preserve leading space on text.",
)
@colorama_text(autoreset=True)
def main(
src: List[str],
@ -108,6 +113,7 @@ def main(
lint: bool,
use_gitignore: bool,
warn: bool,
preserve_leading_space: bool,
) -> None:
"""djLint · HTML template linter and formatter."""
config = Config(
@ -123,6 +129,7 @@ def main(
check=check,
use_gitignore=use_gitignore,
warn=warn,
preserve_leading_space=preserve_leading_space,
)
temp_file = None

View file

@ -25,7 +25,16 @@ def condense_html(html: str, config: Config) -> str:
func = partial(strip_space, config, html)
html = re.sub(re.compile(r"^[ \t]*(.*?)[\n \t]*$", re.M), func, html)
if not config.preserve_leading_space:
# remove any leading/trailing space
html = re.sub(re.compile(r"^[ \t]*(.*?)[\n \t]*$", re.M), func, html)
else:
# only remove leading space in front of tags
# <, {%, {#, {{
html = re.sub(
re.compile(r"^[ \t]*((?:<|{%|{#|{{).*?)[\n \t]*$", re.M), func, html
)
html = re.sub(re.compile(r"^(.*?)[\n \t]*$", re.M), func, html)
def if_blank_line_after_match(config: Config, html: str) -> bool:
"""Check if there should be a blank line after."""

View file

@ -161,7 +161,12 @@ def indent_html(rawcode: str, config: Config) -> str:
# otherwise, just leave same level
else:
tmp = (indent * indent_level) + item + "\n"
if not config.preserve_leading_space:
# if we are not trying to preserve indenting
# on text, the add it now.
tmp = (indent * indent_level) + item + "\n"
else:
tmp = item + "\n"
# if a opening raw tag then start ignoring.. only if there is no closing tag
# on the same line

View file

@ -191,6 +191,7 @@ class Config:
lint: bool = False,
use_gitignore: bool = False,
warn: bool = False,
preserve_leading_space: bool = False,
):
self.reformat = reformat
@ -228,6 +229,11 @@ class Config:
"format_attribute_template_tags", False
)
self.preserve_leading_space: bool = (
preserve_leading_space
or djlint_settings.get("preserve_leading_space", False)
)
# ignore is based on input and also profile
self.ignore: str = str(ignore or djlint_settings.get("ignore", ""))

View file

@ -0,0 +1,27 @@
{% if abc == 101 %}
interface Ethernet1/2
description // Connected to leaf-2
no switchport
ip address 10.1.2.1/30
ip router ospf 1 area 0.0.0.0
no shutdown
{% endif %}
{% if abc == 102 %}
interface Ethernet1/2
description // Connected to leaf-2
no switchport
ip address 10.1.2.1/30
ip router ospf 1 area 0.0.0.0
no shutdown
{% endif %}
{% if abc == 103 %}
interface Ethernet1/2
description // Connected to leaf-2
no switchport
ip address 10.1.2.1/30
ip router ospf 1 area 0.0.0.0
no shutdown
{% endif %}

View file

@ -0,0 +1,65 @@
"""Djlint tests specific to --preserve-leading-space option.
run::
pytest tests/test_config/test_preserve_leading_space/test_config.py --cov=src/djlint --cov-branch \
--cov-report xml:coverage.xml --cov-report term-missing
pytest tests/test_config/test_preserve_leading_space/test_config.py::test_config
"""
# pylint: disable=C0116
from click.testing import CliRunner
from src.djlint import main as djlint
def test_config(runner: CliRunner) -> None:
result = runner.invoke(
djlint,
[
"tests/test_config/test_preserve_leading_space/html.html",
"--check",
"--preserve-leading-space",
],
)
assert result.exit_code == 1
assert (
"""- {% if abc == 101 %}
+{% if abc == 101 %}
interface Ethernet1/2
description // Connected to leaf-2
no switchport
@@ -6,8 +6,6 @@
ip router ospf 1 area 0.0.0.0
no shutdown
{% endif %}
-
-
{% if abc == 102 %}
interface Ethernet1/2
description // Connected to leaf-2
@@ -15,8 +13,7 @@
ip address 10.1.2.1/30
ip router ospf 1 area 0.0.0.0
no shutdown
- {% endif %}
-
+{% endif %}
{% if abc == 103 %}
interface Ethernet1/2
description // Connected to leaf-2
@@ -24,4 +21,4 @@
ip address 10.1.2.1/30
ip router ospf 1 area 0.0.0.0
no shutdown
- {% endif %}
+{% endif %}
"""
in result.output
)