Fix the footer leaking "wrapper. #}" from a broken Jinja comment (#211)
The note explaining the hidden digest form contained a literal "{# … #}" in its
prose. Jinja doesn't nest comments, so the inner "#}" closed the comment early and
the trailing "wrapper. #}" rendered as visible text at the top of every footer.
Reworded the note without comment delimiters. Adds a test asserting no base-
template page's footer contains a stray "{#"/"#}" (fails against the old template).
Claude-Session: https://claude.ai/code/session_013dRZmX9D3JEntfMKWMTWZ8
This commit is contained in:
parent
024613c06d
commit
a5f90ad6e3
2 changed files with 14 additions and 2 deletions
|
|
@ -72,8 +72,8 @@
|
||||||
|
|
||||||
<footer class="site-footer">
|
<footer class="site-footer">
|
||||||
{# The compact digest signup is the site-wide footer pattern, not a
|
{# The compact digest signup is the site-wide footer pattern, not a
|
||||||
homepage-only surface — every page is a possible entry point.
|
homepage-only surface: every page is a possible entry point.
|
||||||
Hidden for now; restore by removing the surrounding {# … #} wrapper. #}
|
Hidden for now; restore by uncommenting the form block below. #}
|
||||||
{#
|
{#
|
||||||
<form class="digest-form digest-compact" method="post" action="{{ base }}/digest"
|
<form class="digest-form digest-compact" method="post" action="{{ base }}/digest"
|
||||||
data-digest aria-labelledby="footer-digest-label">
|
data-digest aria-labelledby="footer-digest-label">
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,18 @@ def test_hub_glossary_about(client):
|
||||||
assert client.get(f"{B}/about").status_code == 200
|
assert client.get(f"{B}/about").status_code == 200
|
||||||
|
|
||||||
|
|
||||||
|
def test_footer_has_no_leaked_jinja_comment(client):
|
||||||
|
# A comment whose prose contained a literal "#}" closed early and leaked
|
||||||
|
# "wrapper. #}" into the footer. Guard every base-template page against a
|
||||||
|
# stray Jinja comment delimiter reaching the rendered HTML.
|
||||||
|
import re
|
||||||
|
for path in (f"{B}/about", f"{B}/climate/{SLUG}", f"{B}/climate/{SLUG}/records"):
|
||||||
|
b = client.get(path).text
|
||||||
|
footer = re.search(r"<footer.*?</footer>", b, re.S)
|
||||||
|
assert footer, f"no footer on {path}"
|
||||||
|
assert "#}" not in footer.group(0) and "{#" not in footer.group(0), path
|
||||||
|
|
||||||
|
|
||||||
def test_title_name_is_short_and_unique():
|
def test_title_name_is_short_and_unique():
|
||||||
# Titles lead with the bare city name so the payload ("… in July") survives
|
# Titles lead with the bare city name so the payload ("… in July") survives
|
||||||
# SERP truncation — display_name()'s region+country is what pushed it off the
|
# SERP truncation — display_name()'s region+country is what pushed it off the
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue