8000 Render false-like values when iterating sections by Aschenbath · Pull Request #137 · noahmorrison/chevron · GitHub
[go: up one dir, main page]

Skip to content

Render false-like values when iterating sections - #137

Open
Aschenbath wants to merge 1 commit into
noahmorrison:mainfrom
Aschenbath:codex/oss50-20261122-chevron-falsy
Open

Aschenbath wants to merge 1 commit into
noahmorrison:mainfrom
Aschenbath:codex/oss50-20261122-chevron-falsy

Conversation

@Aschenbath
Copy link
Copy Markdown

A section iterating over False, 0, an empty string, or an empty container currently skips the item's entire body. Track the scope depth at the start of each render call so an active iteration context is rendered, while falsy sections entered within it still suppress their contents. Count nested inverted sections when collecting a loop's tokens, including when they use the same key as the loop.

Fixes #57 and #85. Existing interpolation/string conversion behavior is retained; the reported false-like list now renders (False)(0)(0.0)()([]), and the nested-array example includes its [] is empty line.

Validation on Python 3.12/Windows: seven of eight added regressions fail on the original source. All 150 tests pass with the pinned Mustache specification submodule, including parent lookups, partials, lambdas, nested inverted sections, and skipped-section controls. Changed-file Flake8 has the same seven existing findings as the baseline, with no new findings. Older Python runtimes were not tested locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False-like values are not rendered when iterating

1 participant

0