From 2d64a5dff7b77e12e1ed05ffd3a65fa7be04a9e0 Mon Sep 17 00:00:00 2001 From: Tom Holland Date: Mon, 7 Nov 2016 09:56:13 -0800 Subject: [PATCH 1/2] Added examples of extend and embed --- guide/leaf.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/guide/leaf.md b/guide/leaf.md index b70bbd9c..720622c7 100644 --- a/guide/leaf.md +++ b/guide/leaf.md @@ -105,6 +105,52 @@ The double token, `##` indicates a chain. If the previous tag fails, this tag wi } ``` +#### Extending + +```swift +/// base.leaf + +#import("html") + +/// html.leaf +#extend("base") + +#export("html") { + +} +``` + +Leaf renders this as: + +```html + + +``` + +#### Embedding + +```swift +/// base.leaf + +#import("html") + +/// html.leaf +#extend("base") + +#export("html") { + #embed("body") +} + +/// body.leaf + +``` +Leaf renders this as: + +```html + + +``` + ### Custom Tags Look at the existing tags for advanced scenarios, let's look at a basic example by creating `Index` together. This tag will take two arguments, an array, and an index to access. From 682bfafaa09bdfcd575a47e67af661567f269adf Mon Sep 17 00:00:00 2001 From: Tom Holland Date: Mon, 7 Nov 2016 10:03:33 -0800 Subject: [PATCH 2/2] Specify rendered template filename --- guide/leaf.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/leaf.md b/guide/leaf.md index 720622c7..b8c964f0 100644 --- a/guide/leaf.md +++ b/guide/leaf.md @@ -120,7 +120,7 @@ The double token, `##` indicates a chain. If the previous tag fails, this tag wi } ``` -Leaf renders this as: +Leaf renders `html.leaf` as: ```html @@ -144,7 +144,7 @@ Leaf renders this as: /// body.leaf ``` -Leaf renders this as: +Leaf renders `html.leaf` as: ```html