Build a ParsedSection from a heading name and its body nodes.
(name: str, body: list[SyntaxTreeNode])
| 269 | |
| 270 | |
| 271 | def _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 | |
| 289 | def _is_bold_marker(node: SyntaxTreeNode) -> str | None: |
no test coverage detected