mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 10:23:16 -05:00
feat: prose citations link to the pinned source
Notes, file notes and platform details carried file:line citations as plain text although profile_sync keeps each on the profile's pin. A citation now links when the profile reads one repository and the path is rooted or already used by a structured source_ref. Platform detail source_refs go through the same renderer as file cards.
This commit is contained in:
1 parent
c87610b921
commit
10a1f475b0
3 files changed
+94
-5
No files matched your search
@@ -2793,7 +2793,7 @@ def _render_emulator_file(
|
||||
for d in details:
|
||||
lines.append(f"- {d}")
|
||||
if fnote:
|
||||
lines.append(f"- {_escape_tags(str(fnote))}")
|
||||
lines.append(f"- {_escape_tags(link_prose_citations(profile, str(fnote)))}")
|
||||
if not in_repo and f.get("unsourceable"):
|
||||
# The badge alone sent readers after a dump that cannot exist, and the
|
||||
# reason was only on the gaps page, which the card did not link.
|
||||
@@ -2876,14 +2876,23 @@ def _render_platform_details(profile: dict) -> list[str]:
|
||||
if isinstance(pv, dict):
|
||||
lines.append(f" **{pk}:**")
|
||||
for sk, sv in pv.items():
|
||||
lines.append(f" - {sk}: {_plain_value(sv)}")
|
||||
lines.append(f" - {sk}: {_detail_value(profile, sk, sv)}")
|
||||
else:
|
||||
lines.append(f" **{pk}:** {_plain_value(pv)}")
|
||||
lines.append(f" **{pk}:** {_detail_value(profile, pk, pv)}")
|
||||
lines.append("")
|
||||
|
||||
return lines
|
||||
|
||||
|
||||
def _detail_value(profile: dict, key: object, value: object) -> str:
|
||||
"""A platform detail, its citations linked at the profile's pin."""
|
||||
if key == "source_ref" and isinstance(value, (str, dict)):
|
||||
return _source_ref_markdown(profile, value)
|
||||
if isinstance(value, str):
|
||||
return _escape_tags(link_prose_citations(profile, value))
|
||||
return _plain_value(value)
|
||||
|
||||
|
||||
def _plain_value(value: object) -> str:
|
||||
"""A scalar or a list of scalars as a reader writes it, not as Python does."""
|
||||
if isinstance(value, bool):
|
||||
@@ -3176,7 +3185,7 @@ def generate_emulator_page(
|
||||
|
||||
# Notes
|
||||
if notes:
|
||||
indented = _admonition_body(notes)
|
||||
indented = _admonition_body(link_prose_citations(profile, notes))
|
||||
lines.extend(['???+ note "Technical notes"', f" {indented}", ""])
|
||||
|
||||
if not files:
|
||||
@@ -4859,6 +4868,7 @@ from sitewrite import ( # noqa: E402,F401
|
||||
_sweep_generated,
|
||||
)
|
||||
from sitesources import ( # noqa: E402,F401
|
||||
link_prose_citations,
|
||||
revision_markdown,
|
||||
_repo_pins,
|
||||
_forge_sources,
|
||||
|
||||
Reference in new issue
Block a user