mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
fix: keep bold labels in nested profile blocks
The nested list structure stays, so each label renders bold instead of showing its asterisks. The platform details block becomes a list as well: its labels were paragraphs followed by items with no blank line between them. validate_site now reports any asterisks that reach a rendered page outside code, which runs in the deploy and in pipeline step 8b.
This commit is contained in:
1 parent
f8fc9a672e
commit
721622c2ea
5 files changed
+63
-9
No files matched your search
@@ -3021,11 +3021,12 @@ def _render_platform_details(profile: dict) -> list[str]:
|
||||
lines.extend(['???+ info "Platform details"', ""])
|
||||
for pk, pv in platform_details.items():
|
||||
if isinstance(pv, dict):
|
||||
lines.append(f" **{pk}:**")
|
||||
lines.extend([f" - **{pk}:**", ""])
|
||||
for sk, sv in pv.items():
|
||||
lines.append(f" - {sk}: {_detail_value(profile, sk, sv)}")
|
||||
lines.append(f" - {sk}: {_detail_value(profile, sk, sv)}")
|
||||
lines.append("")
|
||||
else:
|
||||
lines.append(f" **{pk}:** {_detail_value(profile, pk, pv)}")
|
||||
lines.append(f" - **{pk}:** {_detail_value(profile, pk, pv)}")
|
||||
lines.append("")
|
||||
|
||||
return lines
|
||||
|
||||
@@ -197,11 +197,11 @@ def _render_yaml_value(lines: list[str], val: object, indent: int = 4) -> None:
|
||||
if isinstance(val, dict):
|
||||
for k, v in val.items():
|
||||
if isinstance(v, (dict, list)) and v:
|
||||
lines.append(f"{pad}- {_field_label(k)}:")
|
||||
lines.append(f"{pad}- **{_field_label(k)}:**")
|
||||
lines.append("")
|
||||
_render_yaml_value(lines, v, indent + 4)
|
||||
else:
|
||||
lines.append(f"{pad}- {_field_label(k)}: {_field_text(k, v)}")
|
||||
lines.append(f"{pad}- **{_field_label(k)}:** {_field_text(k, v)}")
|
||||
lines.append("")
|
||||
elif isinstance(val, list):
|
||||
for item in val:
|
||||
|
||||
@@ -32,6 +32,11 @@ class Page:
|
||||
links: list[str] = field(default_factory=list)
|
||||
missing_alt: list[str] = field(default_factory=list)
|
||||
jsonld: list[str] = field(default_factory=list)
|
||||
unrendered: list[str] = field(default_factory=list)
|
||||
|
||||
|
||||
# Text inside these is shown as written, so markup there is not a leftover.
|
||||
_LITERAL_TAGS = frozenset({"pre", "code", "script", "style", "textarea"})
|
||||
|
||||
|
||||
class _PageParser(HTMLParser):
|
||||
@@ -42,9 +47,12 @@ class _PageParser(HTMLParser):
|
||||
self._title_parts: list[str] = []
|
||||
self._jsonld_depth = 0
|
||||
self._jsonld_parts: list[str] = []
|
||||
self._literal_depth = 0
|
||||
|
||||
def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
|
||||
data = dict(attrs)
|
||||
if tag in _LITERAL_TAGS:
|
||||
self._literal_depth += 1
|
||||
if tag == "html":
|
||||
self.page.lang = data.get("lang", "")
|
||||
elif tag == "title":
|
||||
@@ -73,6 +81,8 @@ class _PageParser(HTMLParser):
|
||||
self.page.canonical.append(data.get("href", ""))
|
||||
|
||||
def handle_endtag(self, tag: str) -> None:
|
||||
if tag in _LITERAL_TAGS and self._literal_depth:
|
||||
self._literal_depth -= 1
|
||||
if tag == "title":
|
||||
self._title_depth -= 1
|
||||
elif tag == "script" and self._jsonld_depth:
|
||||
@@ -85,6 +95,8 @@ class _PageParser(HTMLParser):
|
||||
self._title_parts.append(data)
|
||||
if self._jsonld_depth:
|
||||
self._jsonld_parts.append(data)
|
||||
if not self._literal_depth and "**" in data:
|
||||
self.page.unrendered.append(data.strip()[:60])
|
||||
|
||||
def close(self) -> None:
|
||||
super().close()
|
||||
@@ -192,6 +204,10 @@ def _check_pages(
|
||||
report(path, f"duplicate IDs: {duplicate_ids[:5]}")
|
||||
if page.missing_alt:
|
||||
report(path, f"images missing alt: {page.missing_alt[:5]}")
|
||||
if page.unrendered:
|
||||
# Bold that reached the reader as asterisks: a block indented
|
||||
# one level too deep is read as code (the clownmdemu analysis).
|
||||
report(path, f"markdown left unrendered: {page.unrendered[:3]}")
|
||||
|
||||
if not is_404 and len(page.jsonld) != 1:
|
||||
report(path, f"expected one JSON-LD block, got {len(page.jsonld)}")
|
||||
|
||||
Reference in new issue
Block a user