mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-16 00:53:10 +00:00
closes #29
This commit is contained in:
parent
8f78e1964b
commit
b00e51488a
9 changed files with 16 additions and 14 deletions
|
|
@ -12,7 +12,7 @@
|
|||
project = "djlint"
|
||||
copyright = "2021, Riverside Healthcare"
|
||||
author = "Christopher Pickering"
|
||||
release = "0.4.3"
|
||||
release = "0.4.4"
|
||||
version = release
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
0.4.4
|
||||
-----
|
||||
- Change indent config from string to int. ``--indent 3``
|
||||
|
||||
0.4.3
|
||||
-----
|
||||
- Added cli option for indent spacing. ``--indent=" "``
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ Usage:
|
|||
indent
|
||||
------
|
||||
|
||||
Use to change the code indentation. Default is four spaces.
|
||||
Use to change the code indentation. Default is 4 (four spaces).
|
||||
|
||||
Usage:
|
||||
|
||||
.. code:: toml
|
||||
|
||||
indent = " " # change indentation level
|
||||
indent = 3 # change indentation level
|
||||
|
||||
exclude
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ CLI Args
|
|||
Options:
|
||||
-e, --extension TEXT File extension to lint [default: html]
|
||||
-i, --ignore "Codes" Rules to be ignored. ex: "W013,W014"
|
||||
--indent Indent spacing.
|
||||
--indent Indent spacing. ex: 3
|
||||
--reformat Reformat the file(s).
|
||||
--check Check formatting on the file(s).
|
||||
--quiet Do not print diff when reformatting.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ build-backend = "poetry.core.masonry.api"
|
|||
|
||||
[tool.poetry]
|
||||
name="djlint"
|
||||
version="0.4.3"
|
||||
version="0.4.4"
|
||||
description="HTML Template Linter and Formatter"
|
||||
license="GPL-3.0-or-later"
|
||||
authors=["Christopher Pickering <cpickering@rhc.net>"]
|
||||
|
|
|
|||
|
|
@ -186,8 +186,8 @@ def build_quantity_tense(size: int) -> str:
|
|||
)
|
||||
@click.option(
|
||||
"--indent",
|
||||
type=str,
|
||||
help="Indent spacing.",
|
||||
type=int,
|
||||
help="Indent spacing. ex: 3",
|
||||
)
|
||||
@click.option(
|
||||
"--quiet",
|
||||
|
|
@ -199,7 +199,7 @@ def main(
|
|||
extension: str,
|
||||
ignore: str,
|
||||
reformat: bool,
|
||||
indent: Optional[str],
|
||||
indent: Optional[int],
|
||||
check: bool,
|
||||
quiet: bool,
|
||||
) -> None:
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Config:
|
|||
src: str,
|
||||
ignore: Optional[str] = None,
|
||||
extension: Optional[str] = None,
|
||||
indent: Optional[str] = None,
|
||||
indent: Optional[int] = None,
|
||||
quiet: Optional[bool] = False,
|
||||
):
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ class Config:
|
|||
)
|
||||
|
||||
# base options
|
||||
self.indent: str = str(indent or djlint_settings.get("indent", " "))
|
||||
self.indent: str = (indent or int(djlint_settings.get("indent", 4))) * " "
|
||||
print(len(self.indent))
|
||||
|
||||
default_exclude: str = r"""
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[tool]
|
||||
[tool.djlint]
|
||||
indent = " "
|
||||
indent = 2
|
||||
|
|
|
|||
|
|
@ -64,9 +64,7 @@ def test_indent(runner: CliRunner) -> None:
|
|||
)
|
||||
assert result.exit_code == 1
|
||||
|
||||
result = runner.invoke(
|
||||
djlint, ["tests/config_indent", "--check", "--indent", " "]
|
||||
)
|
||||
result = runner.invoke(djlint, ["tests/config_indent", "--check", "--indent", 3])
|
||||
|
||||
assert (
|
||||
"""-<section><p><div><span></span></div></p></section>
|
||||
|
|
|
|||
Loading…
Reference in a new issue