Releases: vapor/leaf-kit
Fix #if Conditional Logix
Fixes #if
to support checking a value's truthiness like Leaf 3 did (#28, fixes #31).
- Fix null handling for conditionals
- Fix boolean reduction for future parameter lists with > 1 boolean values
- Restored and updated leaf3 "testStringIf" test
- Added tests for conditional and/or
This patch was authored by @b-straub and released by @tanner0101.
Release Candidate 1
Update to Swift 5.2 and macOS 10.15. Add additional CI + README updates.
Release candidates represent the final shift toward focusing on bug fixes and documentation. Breaking changes will only be accepted for critical issues. We expect a final release of this package shortly after Swift 5.2's release date.
Add support for nested key paths in loops
Added support for using nested paths when specifying the right-hand expression of a for loop in Leaf templates.
For example with the following code:
struct Show: Content {
let title: String
let cast: [CastMember]
struct CastMember: Content {
let name: String
let characterName: String
}
}
let thirthyRock = Show(title: "30 Rock", cast: [
Show.CastMember(name: "Tina Fey", characterName: "Liz Lemon"),
Show.CastMember(name: "Alec Baldwin", characterName: "Jack Donaghy"),
...
])
...
req.view.render("ShowInfo", [thirthyRock])
...
It is now possible to use a Leaf template such as:
#for(show in shows):
<h2>#(show.title)</h2>
<h4>Cast</h2>
#for(castMember in show.cast):
<p>#(castMember.name) as #(castMember.characterName)</p>
#endfor
#endfor
Add isEnabled Flag to LeafCache
Adds a settable isEnabled
flag to LeafCache
to allow for caching to be turned on and off during runtime. (#29)