dotliquid / dotliquid

.NET Port of Tobias Lütke's Liquid template language.
http://dotliquidmarkup.org
Other
1.06k stars 297 forks source link

behavior change: blank object condition #510

Closed hieuvuvan closed 1 year ago

hieuvuvan commented 1 year ago

implement shopify empty, blank condition check. The ability to easily check a_string, array is blank, for example:

# before
{% if a_string != nil and a_string != '' %}
// do something
{% endif %}

# after
{% if a_string != blank %}
// do something
{% endif %}

ref:

codecov[bot] commented 1 year ago

Codecov Report

Base: 88.26% // Head: 88.04% // Decreases project coverage by -0.21% :warning:

Coverage data is based on head (c47b64e) compared to base (aaa5026). Patch coverage: 97.29% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #510 +/- ## ========================================== - Coverage 88.26% 88.04% -0.22% ========================================== Files 69 69 Lines 2676 2711 +35 Branches 620 634 +14 ========================================== + Hits 2362 2387 +25 - Misses 210 217 +7 - Partials 104 107 +3 ``` | [Impacted Files](https://codecov.io/gh/dotliquid/dotliquid/pull/510?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotliquid) | Coverage Δ | | |---|---|---| | [src/DotLiquid/Condition.cs](https://codecov.io/gh/dotliquid/dotliquid/pull/510/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotliquid#diff-c3JjL0RvdExpcXVpZC9Db25kaXRpb24uY3M=) | `94.05% <97.29%> (-4.43%)` | :arrow_down: | | [src/DotLiquid/Util/Symbol.cs](https://codecov.io/gh/dotliquid/dotliquid/pull/510/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotliquid#diff-c3JjL0RvdExpcXVpZC9VdGlsL1N5bWJvbC5jcw==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [src/DotLiquid/Context.cs](https://codecov.io/gh/dotliquid/dotliquid/pull/510/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotliquid#diff-c3JjL0RvdExpcXVpZC9Db250ZXh0LmNz) | `94.48% <0.00%> (-0.37%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotliquid). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotliquid)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

microalps commented 1 year ago

It looks like the code for resolving the special names empty and blank is in Context.Resolve method. I would expect a change to simply enhance the code there to differentiate between empty and blank - currently they are the same.

FYI all empty tests were successful without any code change.

microalps commented 1 year ago

Closed and created #522 to implement correctly