Parity gallery markdown: emit <img> tags with fixed width/height instead of markdown image syntax so every screenshot renders at identical size in Gitea's markdown view. Gitea strips inline styles but keeps width/height attributes.
Some checks are pending
Android UI Tests / ui-tests (pull_request) Waiting to run
Some checks are pending
Android UI Tests / ui-tests (pull_request) Waiting to run
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -254,10 +254,31 @@ def write_markdown(
|
||||
ios: dict[str, str],
|
||||
manifest: list[tuple[str, str, set[str]]],
|
||||
) -> None:
|
||||
"""Gitea-renderable grid as markdown tables."""
|
||||
"""Gitea-renderable grid as markdown tables.
|
||||
|
||||
Images are emitted as raw `<img>` tags with explicit `width` and
|
||||
`height` attributes rather than markdown `![]()` syntax. Gitea's
|
||||
markdown renderer (goldmark + bluemonday) strips inline `style`
|
||||
attributes, but keeps the `width`/`height` HTML attributes. Forcing
|
||||
both dimensions guarantees identical cell sizes regardless of the
|
||||
underlying PNG resolution (Android is 360×800 @1x, iOS is 780×1688
|
||||
@2x; without this, row heights would shift a few percent per
|
||||
platform and break side-by-side comparisons).
|
||||
"""
|
||||
# Fixed display size for every image cell. Kept at a ~9:19.5 aspect
|
||||
# ratio (modern phone proportions). Width chosen to fit two tall
|
||||
# portrait screens side-by-side in a typical Gitea markdown pane.
|
||||
img_w, img_h = 260, 560
|
||||
|
||||
out = os.path.join(REPO_ROOT, OUT_MD)
|
||||
os.makedirs(os.path.dirname(out), exist_ok=True)
|
||||
|
||||
def img_tag(src: str, alt: str) -> str:
|
||||
return (
|
||||
f'<img src="{html.escape(src)}" alt="{html.escape(alt)}" '
|
||||
f'width="{img_w}" height="{img_h}">'
|
||||
)
|
||||
|
||||
with open(out, "w", encoding="utf-8") as f:
|
||||
f.write("# honeyDue parity gallery\n\n")
|
||||
f.write(
|
||||
@@ -284,10 +305,10 @@ def write_markdown(
|
||||
key = f"{name}_{suffix}"
|
||||
a = android.get(key)
|
||||
i = ios.get(key)
|
||||
a_cell = f"" if a else (
|
||||
a_cell = img_tag(a, f"{key} Android") if a else (
|
||||
"_\\[missing — android\\]_" if "android" in plats else "_(not on android)_"
|
||||
)
|
||||
i_cell = f"" if i else (
|
||||
i_cell = img_tag(i, f"{key} iOS") if i else (
|
||||
"_\\[missing — ios\\]_" if "ios" in plats else "_(not on ios)_"
|
||||
)
|
||||
f.write(f"| **{state_label}** | {a_cell} | {i_cell} |\n")
|
||||
|
||||
Reference in New Issue
Block a user