Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #801

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/_data/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@
"name": "files",
"tags": ["linter", "formatter"],
"description": {
"en": "A list of paths to use as djlint's source. When this option is specfied, the command line souce must be `-` as if using stdin.",
"en": "A list of paths to use as djlint's source. When this option is specified, the command line source must be `-` as if using stdin.",
"ru": "Список путей для использования в качестве источника djlint. Когда указана эта опция, источник командной строки должен быть `-`, как при использовании stdin.",
"fr": "Une liste de chemins à utiliser comme source de djlint. Lorsque cette option est spécifiée, la source de la ligne de commande doit être `-` comme si vous utilisiez stdin."
},
Expand Down
4 changes: 2 additions & 2 deletions docs/src/docs/linter.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ every checked file. It must accept the following arguments:
- `html`: The full html content of the file.
- `filepath`: Path to the file that we are currently checking.
- `line_ends`: List of line `start` and `end` character position that you can use with
`djlint.lint.get_line()` to get line numbers from a character position. See the exemple.
`djlint.lint.get_line()` to get line numbers from a character position. See the example.
- `*args, **kwargs`: We might add other arguments in the future, so you should include
those two arguments to reduce the risk of failure on djLint upgrade.
:::
Expand Down Expand Up @@ -182,7 +182,7 @@ def run(
**kwargs: Any,
) -> List[Dict[str, str]]:
"""
Rule that fails if if the html file contains 'bad'. This is just an exemple, in
Rule that fails if if the html file contains 'bad'. This is just an example, in
reality it's much simpler to do that with "pattern rule".
"""
errors: List[Dict[str, str]] = []
Expand Down
8 changes: 4 additions & 4 deletions src/djlint/formatter/compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _clean_tag(match: re.Match) -> str:
if child_of_unformatted_block(config, html, match):
return match.group()

open_braket = match.group(1)
open_bracket = match.group(1)
tag = _fix_case(match.group(2))

attributes = (
Expand All @@ -44,13 +44,13 @@ def _clean_tag(match: re.Match) -> str:
else ""
)
if tag.lower() in html_void_elements and config.close_void_tags:
close_braket = " />"
close_bracket = " />"
else:
close_braket = (
close_bracket = (
match.group(4) if "/" not in match.group(4) else f" {match.group(4)}"
)

return f"{open_braket}{tag}{attributes}{close_braket}"
return f"{open_bracket}{tag}{attributes}{close_bracket}"

html = re.sub(
re.compile(
Expand Down
2 changes: 1 addition & 1 deletion src/djlint/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def __init__(
([^\s>!\[]+\b) # a tag name
((?:\s*?(?:\"[^\"]*\"|'[^']*'|{{(?:(?!}}).)*}}|{%(?:(?!%}).)*%}|[^'\">{}/\s]|/(?!>)))+)? # any attributes
\s*? # potentially some whitespace
(/?>) # a closing braket (/> or >)
(/?>) # a closing bracket (/> or >)
"""

self.attribute_style_pattern: str = r"^(.*?)(style=)([\"|'])(([^\"']+?;)+?)\3"
Expand Down
12 changes: 6 additions & 6 deletions tests/test_html/test_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,18 +421,18 @@
" flex-column flex-lg-row\n"
" justify-content-start justify-content-lg-between\n"
' align-items-start align-items-lg-center">Foo</div>\n'
'<div class="a-bem-block a-bem-block--with-modifer ">\n'
'<div class="a-bem-block__element a-bem-block__element--with-modifer also-another-block" >\n'
'<div class="a-bem-block__element a-bem-block__element--with-modifer also-another-block__element">\n'
'<div class="a-bem-block a-bem-block--with-modifier ">\n'
'<div class="a-bem-block__element a-bem-block__element--with-modifier also-another-block" >\n'
'<div class="a-bem-block__element a-bem-block__element--with-modifier also-another-block__element">\n'
"</div></div> </div>\n"
),
(
'<div class="ProviderMeasuresContainer__heading-row d-flex flex-column flex-lg-row justify-content-start justify-content-lg-between align-items-start align-items-lg-center">\n'
" Foo\n"
"</div>\n"
'<div class="a-bem-block a-bem-block--with-modifer ">\n'
' <div class="a-bem-block__element a-bem-block__element--with-modifer also-another-block">\n'
' <div class="a-bem-block__element a-bem-block__element--with-modifer also-another-block__element"></div>\n'
'<div class="a-bem-block a-bem-block--with-modifier ">\n'
' <div class="a-bem-block__element a-bem-block__element--with-modifier also-another-block">\n'
' <div class="a-bem-block__element a-bem-block__element--with-modifier also-another-block__element"></div>\n'
" </div>\n"
"</div>\n"
),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_html/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
" <body></body>\n"
"</html>\n"
),
id="emtpy_doc",
id="empty_doc",
),
pytest.param("", "", id="empty"),
pytest.param(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_html/test_bracket_same_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
'<img src="./1.jpg" />\n'
'<img src="./1.jpg" />\n'
),
id="void_braket_same_line",
id="void_bracket_same_line",
),
]

Expand Down
4 changes: 2 additions & 2 deletions tests/test_html/test_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
" <!-- Common use case: embed HTML text into SVG -->\n"
' <foreignObject x="20" y="20" width="160" height="160">\n'
" <!--\n"
" In the context of SVG embeded into HTML, the XHTML namespace could be avoided, but it is mandatory in the context of an SVG document\n"
" In the context of SVG embedded into HTML, the XHTML namespace could be avoided, but it is mandatory in the context of an SVG document\n"
" -->\n"
' <div xmlns="http://www.w3.org/1999/xhtml">\n'
" <p>\n"
Expand Down Expand Up @@ -82,7 +82,7 @@
" <!-- Common use case: embed HTML text into SVG -->\n"
' <foreignObject x="20" y="20" width="160" height="160">\n'
" <!--\n"
" In the context of SVG embeded into HTML, the XHTML namespace could be avoided, but it is mandatory in the context of an SVG document\n"
" In the context of SVG embedded into HTML, the XHTML namespace could be avoided, but it is mandatory in the context of an SVG document\n"
" -->\n"
' <div xmlns="http://www.w3.org/1999/xhtml">\n'
" <p>123</p>\n"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_linter/test_django_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
'{% extends "layout.h" %}\n'
'<div class="card" data-list=\'{"name": "blah"}\'>\n'
'{% include "template.html" %}\n'
"<div {% fpr %} data-{{ name }}='{{ value }}'{% endfor %}/>"
"<div {% for %} data-{{ name }}='{{ value }}'{% endfor %}/>"
),
(
[
Expand Down
2 changes: 1 addition & 1 deletion tests/test_linter/test_h026.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
]
),
id="empted quotes",
id="emptied quotes",
),
pytest.param(
("<asdf id >"),
Expand Down