From 2d64a5dff7b77e12e1ed05ffd3a65fa7be04a9e0 Mon Sep 17 00:00:00 2001 From: Tom Holland Date: Mon, 7 Nov 2016 09:56:13 -0800 Subject: [PATCH] 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.