Stop conditional variants getting different heading levels - #1738
Open
slightlyoffbeat wants to merge 3 commits into
Open
Stop conditional variants getting different heading levels#1738slightlyoffbeat wants to merge 3 commits into
slightlyoffbeat wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1738 +/- ##
==========================================
+ Coverage 88.43% 88.55% +0.11%
==========================================
Files 171 172 +1
Lines 12093 12217 +124
==========================================
+ Hits 10695 10819 +124
Misses 1398 1398 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
hey 👋 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Assign heading levels in Python instead of a Jinja counter, so conditional variants of the same block share a level rather than the second one getting an
<h2>.Key changes
springfield/cms/block_slots.py+BlockSlotsMixinreplace thenamespace(headings=0)counter that was copy-pasted across 14 loops in 11 templates. Per-page config (slot_region_groups,slot_flat_levels,slot_start_level) reproduces each page's existing levels — the download page's blocks start at h2, the roadmap's intro owns the h1.platforms=[windows]next tofirefox=is-firefoxare both visible to a Windows Firefox user, so they stay sequential.line_cardsblock with no heading of its own was rendering<h1 class="fl-heading-size-3">per card.StreamFieldkeeps block changes out of them.Behaviour matrix
is-firefox+not-firefox+ plainplatforms=[windows]+is-firefox(both can show)Testing
springfield/cms/tests/test_block_slots.py— 23 unit tests (heading detection, level assignment, per-page config, the exclusivity rule) plus 3 rendering tests.test_blocks.pythat re-implement the old rule inline pass untouched — the behaviour-preservation check.Notes for reviewer
<h1>at 80px, everyone else<h2>at 64px. All platforms now get 80px. That's the platforms being made consistent, not a redesign;section.htmldoesn't overrideheading_size, so the size class follows the level.__str__added toReferralHubPageandReferralGetFirefoxPage— ruff flagged them once the new base made them resolvable as models.