Home / Function/ _construct_html_link() — fastapi Function Reference

_construct_html_link() — fastapi Function Reference

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

Function python FastAPI Applications calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  5b3b4919_0c37_b982_3e43_e27ec8b34816["_construct_html_link()"]
  c463d6a9_085f_f272_b9fc_455b7e9b6a57["doc_parsing_utils.py"]
  5b3b4919_0c37_b982_3e43_e27ec8b34816 -->|defined in| c463d6a9_085f_f272_b9fc_455b7e9b6a57
  3405fcf2_6572_cb8b_b678_e8690a631a36["replace_html_links()"]
  3405fcf2_6572_cb8b_b678_e8690a631a36 -->|calls| 5b3b4919_0c37_b982_3e43_e27ec8b34816
  aa93488d_92f1_0a8b_cd55_27a49e4e659d["_add_lang_code_to_url()"]
  5b3b4919_0c37_b982_3e43_e27ec8b34816 -->|calls| aa93488d_92f1_0a8b_cd55_27a49e4e659d
  style 5b3b4919_0c37_b982_3e43_e27ec8b34816 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/doc_parsing_utils.py lines 406–430

def _construct_html_link(
    link_text: str,
    attributes: list[HTMLLinkAttribute],
    lang_code: str,
) -> str:
    """
    Reconstruct HTML link, adjusting the URL for the given language code if needed.
    """

    attributes_upd: list[HTMLLinkAttribute] = []
    for attribute in attributes:
        if attribute["name"] == "href":
            original_url = attribute["value"]
            url = _add_lang_code_to_url(original_url, lang_code)
            attributes_upd.append(
                HTMLLinkAttribute(name="href", quote=attribute["quote"], value=url)
            )
        else:
            attributes_upd.append(attribute)

    attrs_str = " ".join(
        f"{attribute['name']}={attribute['quote']}{attribute['value']}{attribute['quote']}"
        for attribute in attributes_upd
    )
    return f"<a {attrs_str}>{link_text}</a>"

Domain

Subdomains

Frequently Asked Questions

What does _construct_html_link() do?
_construct_html_link() is a function in the fastapi codebase, defined in scripts/doc_parsing_utils.py.
Where is _construct_html_link() defined?
_construct_html_link() is defined in scripts/doc_parsing_utils.py at line 406.
What does _construct_html_link() call?
_construct_html_link() calls 1 function(s): _add_lang_code_to_url.
What calls _construct_html_link()?
_construct_html_link() is called by 1 function(s): replace_html_links.

Analyze Your Own Codebase

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

Try Supermodel Free