Skip to content

Add missing documentation about for loop features#576

Merged
GuillaumeGomez merged 1 commit intoaskama-rs:masterfrom
GuillaumeGomez:add-missing-for-docs
Aug 18, 2025
Merged

Add missing documentation about for loop features#576
GuillaumeGomez merged 1 commit intoaskama-rs:masterfrom
GuillaumeGomez:add-missing-for-docs

Conversation

@GuillaumeGomez
Copy link
Copy Markdown
Collaborator

Fixes #455.

Comment thread book/src/template_syntax.md Outdated
Comment on lines +485 to +486
And in case the iterator is empty, you can an `else` block right after the `for`
loop:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"You can add an optional {% else %} block that is printed if the loop was never entered, either because the iterator was empty, or the filter condition was never match."

Copy link
Copy Markdown
Member

@Kijewski Kijewski Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, "is printed" may be a bad phrasing. "is entered if the loop was never entered"?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better indeed!

@GuillaumeGomez
Copy link
Copy Markdown
Collaborator Author

Applied suggestion and fixed merge conflict.

Copy link
Copy Markdown
Member

@Kijewski Kijewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit c335f99 into askama-rs:master Aug 18, 2025
42 checks passed
@GuillaumeGomez GuillaumeGomez deleted the add-missing-for-docs branch August 18, 2025 14:12
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.

Document {% for target in iterable if cond %} and {% for .. %} {% else %}`

2 participants