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 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
class='fragment {{ .Get "class" }}'
{{ with .Get "index" }}
data-fragment-index='{{ . }}'
{{ end }}
>
<span class='fragment {{ .Get "class" }}'
{{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}>
{{ .Inner }}
</span>