dotliquid / dotliquid

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

The "include" tag with a "with" operator does not work correctly #549

Open tiritas opened 3 months ago

tiritas commented 3 months ago

Dotliquid version

5.5.0

Expected behavior

  1. The include with a with operator should not be iterating IEnumerable objects. The for operator is for iterating the template for each item in an IEnumerable, but the with operator is only supposed to pass the variable to the included template. It was added because liquid was unable to pass variables that had the same name as the template itself.

    Actual behavior

    The with operator acts just like for. This is particularly problematic, when a string is passed, because of a second issue: DotLiquid treats strings as arrays of characters (because they implement IEnumerable), resulting in the included template being rendered once for each character in the string.

I have fixed both of these issued and would like to make a pull request. Do I need to fork the project, or can I push a new branch directly to this project?