Skip to content

Commit a79a4ee

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b6830a0 commit a79a4ee

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/sphinx_tags/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ def run(self):
6666
# self.content: StringList(['different, tags,', 'separated'],
6767
# items=[(path, lineno), (path, lineno)])
6868
page_tags.extend(
69-
[_normalize_display_tag(tag) for tag in ",".join(self.content).split(",")]
69+
[
70+
_normalize_display_tag(tag)
71+
for tag in ",".join(self.content).split(",")
72+
]
7073
)
7174
# Remove empty elements from page_tags
7275
# (can happen after _normalize_tag())
@@ -274,7 +277,9 @@ def __init__(self, entrypath: Path):
274277

275278
self.tags = []
276279
if tagblock:
277-
self.tags = [_normalize_display_tag(tag).rstrip('"') for tag in tagblock if tag != ""]
280+
self.tags = [
281+
_normalize_display_tag(tag).rstrip('"') for tag in tagblock if tag != ""
282+
]
278283

279284
def assign_to_tags(self, tag_dict):
280285
"""Append ourself to tags"""
@@ -299,12 +304,14 @@ def _normalize_tag(tag: str, dashes: bool = False) -> str:
299304
char = "-"
300305
return re.sub(r"[\s\W]+", char, tag).lower().strip(char)
301306

307+
302308
def _normalize_display_tag(tag: str) -> str:
303309
"""Strip extra whitespace from a tag name for display purposes.
304310
305311
Example: ' Tag:with (extra whitespace) ' -> 'Tag:with (extra whitespace)'
306312
"""
307-
return re.sub(r"\s+", ' ', tag.strip())
313+
return re.sub(r"\s+", " ", tag.strip())
314+
308315

309316
def tagpage(tags, outdir, title, extension, tags_index_head):
310317
"""Creates Tag overview page.

0 commit comments

Comments
 (0)