Skip to content

[rejected AI] indent filter ignoring blank=False when first=True - #2254

Closed
sanyamk23 wants to merge 2 commits into
pallets:mainfrom
sanyamk23:fix/indent-filter-blank
Closed

sanyamk23 wants to merge 2 commits into
pallets:mainfrom
sanyamk23:fix/indent-filter-blank

Conversation

@sanyamk23

@sanyamk23 sanyamk23 commented Aug 31, 2026 •

Copy link
Copy Markdown

Fixes #2176

When blank=False (the default), the indent filter should not indent empty/blank lines. However, when first=True and the input is an empty string, the filter was incorrectly indenting the empty result.

This caused issues when rendering Jinja templates with empty blocks -- the closing tag would get extra indentation even when the block content was empty.

Before: {% filter indent(4, first=True) %}{% endfilter %} returned ' ' instead of ''
After: Returns '' as expected

@davidism

Copy link
Copy Markdown
Member

@davidism davidism closed this Aug 31, 2026
@davidism davidism changed the title fix: indent filter ignoring blank=False when first=True [rejected AI] indent filter ignoring blank=False when first=True Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

indent filter ignores blank=False when first=True on first line

2 participants