MCPcopy
hub / github.com/vinta/awesome-python / _extract_description_html

Function _extract_description_html

website/readme_parser.py:170–183  ·  view source on GitHub ↗

Extract description HTML from inline content after the first link. AST: [link("name"), text(" - Description.")] -> "Description." The separator (- / en-dash / em-dash) is stripped.

(inline: SyntaxTreeNode, first_link: SyntaxTreeNode)

Source from the content-addressed store, hash-verified

168
169
170def _extract_description_html(inline: SyntaxTreeNode, first_link: SyntaxTreeNode) -> str:
171 """Extract description HTML from inline content after the first link.
172
173 AST: [link("name"), text(" - Description.")] -> "Description."
174 The separator (- / en-dash / em-dash) is stripped.
175 """
176 link_idx = next((i for i, c in enumerate(inline.children) if c is first_link), None)
177 if link_idx is None:
178 return ""
179 desc_children = inline.children[link_idx + 1 :]
180 if not desc_children:
181 return ""
182 html = render_inline_html(desc_children)
183 return _DESC_SEP_RE.sub("", html)
184
185
186def _parse_list_entries(

Callers 1

_parse_list_entriesFunction · 0.85

Calls 1

render_inline_htmlFunction · 0.85

Tested by

no test coverage detected