Link HTML5 object selection to source
This commit is contained in:
@@ -1120,7 +1120,7 @@ def render_html5_symbol_detail(project_id: str, references: object | None) -> st
|
||||
"""
|
||||
|
||||
|
||||
def render_html5_source(node: object | None) -> str:
|
||||
def render_html5_source(node: object | None, *, oob: bool = False) -> str:
|
||||
name = "source" if node is None else getattr(node, "qualified_name", None) or getattr(node, "name", "source")
|
||||
kind = "" if node is None else _enum_text(getattr(node, "kind", ""))
|
||||
lineage_id = "" if node is None else str(getattr(node, "lineage_id", ""))
|
||||
@@ -1133,12 +1133,14 @@ def render_html5_source(node: object | None) -> str:
|
||||
location = f"{source_path}:{line}" if source_path and line else source_path or "source unavailable"
|
||||
source_text = _node_source_text(node)
|
||||
line_count = len(source_text.splitlines()) or 1
|
||||
oob_attr = ' hx-swap-oob="outerHTML"' if oob else ""
|
||||
return f"""
|
||||
<article
|
||||
class="source-panel"
|
||||
data-html5-source
|
||||
data-html5-source-name="{escape(str(name))}"
|
||||
data-html5-lineage-id="{escape(lineage_id)}"
|
||||
{oob_attr}
|
||||
>
|
||||
<header class="source-head">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user