Add the frag shortcode

This commit is contained in:
dzello 2018-04-30 12:08:32 -07:00
parent 072230bfbf
commit 67a64c121d
3 changed files with 29 additions and 6 deletions

View file

@ -22,6 +22,29 @@ The `fragment` shortcode makes content appear incrementally.
--- ---
### Frag shortcode
The `frag` shortcode is like `fragment` but more terse. It accepts the content as the `c` attribute.
```
{{</* frag c="One" */>}}
{{</* frag c="Two" */>}}
{{</* frag c="Three" */>}}
```
{{< frag c="One" >}}
{{< frag c="Two" >}}
{{< frag c="Three" >}}
---
Both `fragment` and `frag` accept two additional parameters:
- `class`: sets the class of the wrapping `span` element
- `index`: controls the order in which sections will appear
---
{{% section %}} {{% section %}}
### Section shortcode ### Section shortcode

View file

@ -0,0 +1,4 @@
<span class='fragment {{ .Get "class" }}'
{{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}>
{{ .Get "c" }}
</span>

View file

@ -1,8 +1,4 @@
<span <span class='fragment {{ .Get "class" }}'
class='fragment {{ .Get "class" }}' {{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}>
{{ with .Get "index" }}
data-fragment-index='{{ . }}'
{{ end }}
>
{{ .Inner }} {{ .Inner }}
</span> </span>