Add the frag shortcode
This commit is contained in:
parent
072230bfbf
commit
67a64c121d
3 changed files with 29 additions and 6 deletions
|
@ -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
|
||||||
|
|
4
layouts/shortcodes/frag.html
Normal file
4
layouts/shortcodes/frag.html
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<span class='fragment {{ .Get "class" }}'
|
||||||
|
{{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}>
|
||||||
|
{{ .Get "c" }}
|
||||||
|
</span>
|
|
@ -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>
|
Loading…
Reference in a new issue