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

Function _build_section

website/readme_parser.py:271–286  ·  view source on GitHub ↗

Build a ParsedSection from a heading name and its body nodes.

(name: str, body: list[SyntaxTreeNode])

Source from the content-addressed store, hash-verified

269
270
271def _build_section(name: str, body: list[SyntaxTreeNode]) -> ParsedSection:
272 """Build a ParsedSection from a heading name and its body nodes."""
273 desc_children = _extract_description_children(body)
274 desc = render_inline_text(desc_children) if desc_children else ""
275 desc_html = render_inline_html(desc_children) if desc_children else ""
276 content_nodes = body[1:] if desc_children else body
277 entries = _parse_section_entries(content_nodes)
278 entry_count = len(entries) + sum(len(e["also_see"]) for e in entries)
279 return ParsedSection(
280 name=name,
281 slug=slugify(name),
282 description=desc,
283 description_html=desc_html,
284 entries=entries,
285 entry_count=entry_count,
286 )
287
288
289def _is_bold_marker(node: SyntaxTreeNode) -> str | None:

Callers 1

flush_catFunction · 0.85

Calls 6

render_inline_textFunction · 0.85
render_inline_htmlFunction · 0.85
_parse_section_entriesFunction · 0.85
ParsedSectionClass · 0.85
slugifyFunction · 0.85

Tested by

no test coverage detected