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

Function _parse_sponsor_item

website/readme_parser.py:377–389  ·  view source on GitHub ↗

Parse `**[name](url)**: description` (or `[name](url) - description`).

(inline: SyntaxTreeNode)

Source from the content-addressed store, hash-verified

375
376
377def _parse_sponsor_item(inline: SyntaxTreeNode) -> ParsedSponsor | None:
378 """Parse `**[name](url)**: description` (or `[name](url) - description`)."""
379 for split_idx, child in enumerate(inline.children):
380 link = child if child.type == "link" else _find_link_deep(child)
381 if link is None:
382 continue
383 desc_html = render_inline_html(inline.children[split_idx + 1 :])
384 return ParsedSponsor(
385 name=render_inline_text(link.children),
386 url=_href(link),
387 description=_SPONSOR_SEP_RE.sub("", desc_html),
388 )
389 return None
390
391
392def parse_sponsors(text: str) -> list[ParsedSponsor]:

Callers 1

parse_sponsorsFunction · 0.85

Calls 5

_find_link_deepFunction · 0.85
render_inline_htmlFunction · 0.85
ParsedSponsorClass · 0.85
render_inline_textFunction · 0.85
_hrefFunction · 0.85

Tested by

no test coverage detected