mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 09:40:30 +08:00
chore: ruff format .
This commit is contained in:
@@ -291,7 +291,9 @@ class LinkResolver:
|
||||
self.source_pages = discover_source_pages(str(self.source_root))
|
||||
|
||||
def resolve_base_target(
|
||||
self, base_target: str, source_path: str,
|
||||
self,
|
||||
base_target: str,
|
||||
source_path: str,
|
||||
) -> ResolutionResult:
|
||||
return resolve_link_path(
|
||||
base_target=base_target,
|
||||
@@ -301,7 +303,9 @@ class LinkResolver:
|
||||
)
|
||||
|
||||
def resolve_markdown_target(
|
||||
self, target: str, source_path: str,
|
||||
self,
|
||||
target: str,
|
||||
source_path: str,
|
||||
) -> tuple[str | None, str]:
|
||||
parsed_target = parse_doc_target(target)
|
||||
if parsed_target is None:
|
||||
@@ -403,7 +407,8 @@ def find_unresolved_doc_links(source_root: Path) -> list[str]:
|
||||
content = (root / source_path).read_text(encoding="utf-8")
|
||||
for link in iter_markdown_links(content):
|
||||
resolved_path, _ = resolver.resolve_markdown_target(
|
||||
link.target, source_path,
|
||||
link.target,
|
||||
source_path,
|
||||
)
|
||||
if resolved_path is not None:
|
||||
continue
|
||||
@@ -522,7 +527,9 @@ def build_sidebar(page_infos: list[PageInfo]) -> str:
|
||||
|
||||
|
||||
def build_page_info(
|
||||
source_root: Path, source_path: str, resolver: LinkResolver,
|
||||
source_root: Path,
|
||||
source_path: str,
|
||||
resolver: LinkResolver,
|
||||
) -> PageInfo:
|
||||
source_file = source_root / source_path
|
||||
content = source_file.read_text(encoding="utf-8")
|
||||
@@ -634,7 +641,8 @@ def main() -> int:
|
||||
return 0
|
||||
|
||||
sync_docs_to_wiki(
|
||||
source_root=Path(args.source_root), wiki_root=Path(args.wiki_root),
|
||||
source_root=Path(args.source_root),
|
||||
wiki_root=Path(args.wiki_root),
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user