Skip to content

Commit 935f134

Browse files
committed
templatekit rc
1 parent 1173e6d commit 935f134

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ let package = Package(
77
.library(name: "Leaf", targets: ["Leaf"]),
88
],
99
dependencies: [
10-
// Swift Promises, Futures, and Streams.
10+
// Promises and reactive-streams in Swift built for high-performance and scalability.
1111
.package(url: "https://github.com/vapor/async.git", from: "1.0.0-rc"),
1212

13-
// Core extensions, type-aliases, and functions that facilitate common tasks.
13+
// 🌎 Utility package containing tools for byte manipulation, Codable, OS APIs, and debugging.
1414
.package(url: "https://github.com/vapor/core.git", from: "3.0.0-rc"),
1515

16-
// Service container and configuration system.
16+
// 📦 Dependency injection / inversion of control framework.
1717
.package(url: "https://github.com/vapor/service.git", from: "1.0.0-rc"),
1818

19-
// Easy-to-use foundation for building powerful templating languages in Swift.
20-
.package(url: "https://github.com/vapor/template-kit.git", .branch("leaf-rc")),
19+
// 📄 Easy-to-use foundation for building powerful templating languages in Swift.
20+
.package(url: "https://github.com/vapor/template-kit.git", from: "1.0.0-rc"),
2121
],
2222
targets: [
2323
.target(name: "Leaf", dependencies: ["Async", "Bits", "CodableKit", "COperatingSystem", "Service", "TemplateKit"]),

Tests/LeafTests/LeafTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,20 @@ class LeafTests: XCTestCase {
413413
}
414414
}
415415

416+
func testTemplating() throws {
417+
let home = """
418+
#set("title", "Home")
419+
#set("body") {<p>#(foo)</p>}
420+
#embed("base")
421+
"""
422+
let expected = """
423+
<title>Home</title>
424+
<body><p>bar</p></title>
425+
"""
426+
let data = try TemplateDataEncoder().encode(["foo": "bar"])
427+
try XCTAssertEqual(renderer.testRender(home, data), expected)
428+
}
429+
416430
static var allTests = [
417431
("testPrint", testPrint),
418432
("testConstant", testConstant),
@@ -440,6 +454,7 @@ class LeafTests: XCTestCase {
440454
("testEmptyForLoop", testEmptyForLoop),
441455
("testKeyEqual", testKeyEqual),
442456
("testInvalidForSyntax", testInvalidForSyntax),
457+
("testTemplating", testTemplating),
443458
]
444459
}
445460

Views/base.leaf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<title>#get(title)</title>
2+
<body>#get(body)</title>

0 commit comments

Comments
 (0)