Skip to content
Snippets Groups Projects
Commit df29f766 authored by Artur Sabirov's avatar Artur Sabirov
Browse files

chore: fix linting errors in hooks

parent 234051ce
No related branches found
No related tags found
1 merge request!315feat: check svg attributes
......@@ -13,13 +13,13 @@ log = get_plugin_logger(os.path.basename(__file__))
# https://www.mkdocs.org/dev-guide/plugins/#events
# https://github.com/mkdocs/mkdocs/blob/1.5.3/mkdocs/commands/build.py#L258
def on_files(files: Files, config: MkDocsConfig):
anchors = dict()
anchors: dict[str, list[str]] = dict()
config["anchors"] = anchors
for file in files.documentation_pages():
log.debug(file.src_path)
Page(None, file, config)
Page(None, file, config)
assert file.page is not None
file.page.read_source(config)
......@@ -27,9 +27,9 @@ def on_files(files: Files, config: MkDocsConfig):
markdown: str = file.page.markdown
lines: list[str] = re.sub("<!--.*?-->", "", markdown, flags=re.DOTALL).split("\n")
headers: list[str] = filter(lambda line: re.match("^##+ ", line), lines)
headers: list[str] = list(filter(lambda line: re.match("^##+ ", line), lines))
file_anchors = list()
file_anchors: list[str] = list()
anchors[file.src_path] = file_anchors
for line in headers:
......
......@@ -12,7 +12,7 @@ log = get_plugin_logger(os.path.basename(__file__))
# https://www.mkdocs.org/dev-guide/plugins/#events
def on_page_markdown(markdown: str, page: Page, config: MkDocsConfig, files: Files):
markdown: str = re.sub("<!--.*?-->", "", markdown, flags=re.DOTALL)
markdown = re.sub("<!--.*?-->", "", markdown, flags=re.DOTALL)
for match in re.finditer(r"(!?)\[([^\[\]]*?)\]\((.+?)\)", markdown, flags=re.DOTALL):
link = match[0].replace("\n", " ")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment