Skip to content

Clarify %if template behavior#6399

Open
emiham wants to merge 3 commits intobeetbox:masterfrom
emiham:master
Open

Clarify %if template behavior#6399
emiham wants to merge 3 commits intobeetbox:masterfrom
emiham:master

Conversation

@emiham
Copy link
Contributor

@emiham emiham commented Feb 27, 2026

Description

Fixes #4991.

I don't know if there's a single, good workaround for this, so I opted to not add an example solution.

To Do

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

@emiham emiham requested a review from a team as a code owner February 27, 2026 16:43
Copy link
Contributor

@Serene-Arc Serene-Arc left a comment

Choose a reason for hiding this comment

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

This is a good clarification for the behaviour you had a problem with, but I wonder if this is something that only makes sense for programmers. Then again, this might be something that only programmers or people somewhat familiar with programming conventions understand. Might not be a problem in that case.

Perhaps make it clear that for different data types, some are always interpreted as False. 0 is that for an integer, False for a boolean, '' for a string, etc.

@emiham
Copy link
Contributor Author

emiham commented Mar 2, 2026

This is a good clarification for the behaviour you had a problem with, but I wonder if this is something that only makes sense for programmers. Then again, this might be something that only programmers or people somewhat familiar with programming conventions understand. Might not be a problem in that case.

I agree that it might be confusing to some people not having the prerequisite programming knowledge, but I still think those people would be better off with more documentation that can at least point them in the right direction/help them ask the right questions when asking for help.

Perhaps make it clear that for different data types, some are always interpreted as False. 0 is that for an integer, False for a boolean, '' for a string, etc.

This is a great point, I had not considered this at all! I can't figure out where in the code the path format actually gets interpreted, do you think you could point me to that? I did try importing two albums named "False" and "false", which both evaluate as False, so that should definitely also be mentioned. I'm curious about what other values might run into this though. Edit: I found the relevant code.

Copy link
Member

@snejus snejus left a comment

Choose a reason for hiding this comment

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

Would you mind adding some examples for the %if function behaviour, following what we have under %first{text,count,skip,sep,join} below?

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.33%. Comparing base (dcef1f4) to head (4792cb6).
⚠️ Report is 53 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6399      +/-   ##
==========================================
+ Coverage   69.18%   69.33%   +0.15%     
==========================================
  Files         140      141       +1     
  Lines       18686    18793     +107     
  Branches     3053     3061       +8     
==========================================
+ Hits        12927    13031     +104     
- Misses       5114     5117       +3     
  Partials      645      645              

see 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Variant of %if template function that does not treat 0 as false

3 participants