Skip to content

Releases: vapor/leaf-kit

Extend for loops with custom index support

06 Mar 20:49
139fcd5
Compare
Choose a tag to compare
This patch was authored by @vzsg and released by @0xTim.

Traditionally, the for loops in Leaf declare three variables in the loop's local context: isFirst, isLast and index. The first two aren't particularly interesting, but being able to access all indices in a nested for loop situation is sometimes useful when working with two dimensions at once. Not to mention it just popped up on Discord earlier today.

This PR extends Loop with the option of renaming index.

Example syntax:

#for(i, array in arrays):
  #for(j, element in array):
    (#(i), #(j)): #(element)
  #endfor
#endfor

Should be semver-minor.

Add #dumpContext tag

18 Aug 15:42
c67a1b0
Compare
Choose a tag to compare
This patch was authored by @marius-se and released by @0xTim.

Adds a new tag, #dumpContext() that renders the whole context for easy debugging

Adds a new `#with()` tag to make it easier to embed and extend tags

16 Aug 16:46
08fb9b2
Compare
Choose a tag to compare
This patch was authored by @pontaoski and released by @0xTim.

Adds a new #with() tag to make it easier to work with extend and embed tags:

#with(parent):
  #(child)
#endwith

Update Supported Swift Versions

16 May 13:17
bbdbdb9
Compare
Choose a tag to compare
This patch was authored and released by @0xTim.

This removes support for Swift 5.2 and Swift 5.3, making Swift 5.4 the earliest supported version as
announced

Fix warning from compiler issue in Swift 5.6

16 Mar 10:14
949270e
Compare
Choose a tag to compare
This patch was authored and released by @0xTim.

Resolves a compiler warning introduced in Swift 5.6

Resolves #99

Ignore unfound import

20 Nov 16:19
983fcbe
Compare
Choose a tag to compare
This patch was authored by @fananek and released by @0xTim.

This makes the renderer and serializer ignore imports in case no corresponding export has been found rather than erroring by default. This also adds a new configuration flag ignoreUnfoundImports to allow you to set the behaviour to error on non-existent imports

Fixes #84

Fix variable ambiguity

08 Aug 11:26
79e2652
Compare
Choose a tag to compare
This patch was authored and released by @0xTim.

Fix variable ambiguity in the LeafSerializer introduced in 1.3.0 that causes build failures in some vesions of Swift

1.3.0

07 Aug 15:40
e57cde5
Compare
Choose a tag to compare

⚠️ This release may contain some breaking behavioural changes if you're relying on HTML content to be untouched when rendering custom tags. You will need to migrate any custom tags to conform to UnsafeUnescapedLeafTag to avoid your rendered strings from escaping. No other changes are required. ⚠️

This release fixes a potential XSS vulnerability in LeafKit. Before Leaf would render any parameters passed to any tags without escaping any HTML allowing an attacker to inject malicious scripts. All tags built into LeafKit now escape any rendered strings, apart from the new unsafeHTML tag.

  • Introduces a new unsafeHTML for rendering parameters you trust that contain HTML you want to leave intact
  • Introduces UnsafeUnescapedLeafTag to conform custom tags to that won't escape any HTML.

Correctly parsing non Leaf `#` tag.

31 Mar 10:17
e8d4f88
Compare
Choose a tag to compare
This patch was authored by @Hailong and released by @0xTim.

Leaf templates containing # characters that don't match a tag will be rendered. This allows for things like anchor and colours to work correctly.

Also adds a new #comment tag

Resolves #89

add modulo (%) infix operator

12 Feb 10:58
a9b2f07
Compare
Choose a tag to compare
This patch was authored by @fananek and released by @0xTim.

Add modulo infix (%) operator support into LeafLexer. Solves #87
See testGH87 as usage reference.