Skip to content

feat: else support for boolean helpers#720

Merged
sunng87 merged 4 commits into
sunng87:masterfrom
exoego:conditional-block
Aug 29, 2025
Merged

feat: else support for boolean helpers#720
sunng87 merged 4 commits into
sunng87:masterfrom
exoego:conditional-block

Conversation

@exoego

@exoego exoego commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

This PR makes boolean helpers (eq, and, etc) can be used with else.

{{#eq foo bar}}
OK
{{else}}
KO
{{/eq}}

// this still works
{{eq foo bar}}

It can be considered as a shorthand for {{#if (eq a b)}}SUCCESS{{else}}FAIL{{/if}}.

I need this to improve inter-operability with handlerbars.java's ConditionalHelpers

Comment thread src/helpers/helper_extras.rs Outdated
Comment thread src/helpers/helper_extras.rs Outdated
Comment thread src/helpers/helper_extras.rs Outdated
@coveralls

coveralls commented Aug 28, 2025

Copy link
Copy Markdown

Coverage Status

coverage: 83.855% (-0.2%) from 84.017%
when pulling f71657c on exoego:conditional-block
into cda7412 on sunng87:master.

exoego and others added 2 commits August 29, 2025 11:42
Co-authored-by: Ning Sun <classicning@gmail.com>

@sunng87 sunng87 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@sunng87

sunng87 commented Aug 29, 2025

Copy link
Copy Markdown
Owner

@exoego Thank you!

@sunng87 sunng87 merged commit 352a8b0 into sunng87:master Aug 29, 2025
9 checks passed
@exoego exoego deleted the conditional-block branch August 29, 2025 03:26
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.

3 participants