From 85b55efb2830471aa922648c6eefa6cbea58eaeb Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Sun, 19 Apr 2026 21:59:59 +0800 Subject: [PATCH] refactor(readme_parser): inline _is_leading_link at its call site The helper was only called once and the bool(inline.children) guard was redundant: first_link being non-None already implies inline.children is non-empty. Co-Authored-By: Claude --- website/readme_parser.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/website/readme_parser.py b/website/readme_parser.py index 0aa5e2da..1c067d6c 100644 --- a/website/readme_parser.py +++ b/website/readme_parser.py @@ -161,11 +161,6 @@ def _find_inline(node: SyntaxTreeNode) -> SyntaxTreeNode | None: return _find_child(para, "inline") -def _is_leading_link(inline: SyntaxTreeNode, link: SyntaxTreeNode) -> bool: - """Check if the link is the first child of inline (a real entry, not a subcategory label).""" - return bool(inline.children) and inline.children[0] is link - - def _extract_description_html(inline: SyntaxTreeNode, first_link: SyntaxTreeNode) -> str: """Extract description HTML from inline content after the first link. @@ -206,7 +201,7 @@ def _parse_list_entries( first_link = _find_child(inline, "link") - if first_link is None or not _is_leading_link(inline, first_link): + if first_link is None or inline.children[0] is not first_link: # Subcategory label: take text before the first link, strip trailing separators pre_link = [] for child in inline.children: