Home / Function/ extract_html_links() — fastapi Function Reference

extract_html_links() — fastapi Function Reference

Architecture documentation for the extract_html_links() function in doc_parsing_utils.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  30a1da0a_20e0_43a5_683f_113ddcca1bc5["extract_html_links()"]
  c463d6a9_085f_f272_b9fc_455b7e9b6a57["doc_parsing_utils.py"]
  30a1da0a_20e0_43a5_683f_113ddcca1bc5 -->|defined in| c463d6a9_085f_f272_b9fc_455b7e9b6a57
  63822d7d_03fc_4331_3f93_3026c9c03415["check_translation()"]
  63822d7d_03fc_4331_3f93_3026c9c03415 -->|calls| 30a1da0a_20e0_43a5_683f_113ddcca1bc5
  style 30a1da0a_20e0_43a5_683f_113ddcca1bc5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/doc_parsing_utils.py lines 357–403

def extract_html_links(lines: list[str]) -> list[HtmlLinkInfo]:
    """
    Extract all HTML links from the given lines.

    Return list of HtmlLinkInfo, where each dict contains:
    - `line_no` - line number (1-based)
    - `full_tag` - full HTML link tag
    - `attributes` - list of HTMLLinkAttribute (name, quote, value)
    - `text` - link text
    """

    links = []
    for line_no, line in enumerate(lines, start=1):
        for html_link in HTML_LINK_RE.finditer(line):
            link_str = html_link.group(0)

            link_text_match = HTML_LINK_TEXT_RE.match(link_str)
            assert link_text_match is not None
            link_text = link_text_match.group(2)
            assert isinstance(link_text, str)

            link_open_tag_match = HTML_LINK_OPEN_TAG_RE.match(link_str)
            assert link_open_tag_match is not None
            link_open_tag = link_open_tag_match.group(1)
            assert isinstance(link_open_tag, str)

            attributes: list[HTMLLinkAttribute] = []
            for attr_name, attr_quote, attr_value in re.findall(
                HTML_ATTR_RE, link_open_tag
            ):
                assert isinstance(attr_name, str)
                assert isinstance(attr_quote, str)
                assert isinstance(attr_value, str)
                attributes.append(
                    HTMLLinkAttribute(
                        name=attr_name, quote=attr_quote, value=attr_value
                    )
                )
            links.append(
                HtmlLinkInfo(
                    line_no=line_no,
                    full_tag=link_str,
                    attributes=attributes,
                    text=link_text,
                )
            )
    return links

Domain

Subdomains

Frequently Asked Questions

What does extract_html_links() do?
extract_html_links() is a function in the fastapi codebase, defined in scripts/doc_parsing_utils.py.
Where is extract_html_links() defined?
extract_html_links() is defined in scripts/doc_parsing_utils.py at line 357.
What calls extract_html_links()?
extract_html_links() is called by 1 function(s): check_translation.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free