forked from mirrors/hugo-tufte
Add and Refactor shortcodes.
Add the epigraph shortcode. This should complete the Tufte-CSS specific shortcodes. Additionally, the section and div shortcodes were refactored for ease of use.
This commit is contained in:
parent
381982f4a7
commit
b9ec18d78e
6 changed files with 76 additions and 13 deletions
layouts/shortcodes
1
layouts/shortcodes/cite.html
Normal file
1
layouts/shortcodes/cite.html
Normal file
|
@ -0,0 +1 @@
|
|||
<cite>{{ .Inner }}</cite>
|
8
layouts/shortcodes/div.html
Normal file
8
layouts/shortcodes/div.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{{ $loc := .Get 0 }}
|
||||
{{ if .IsNamedParams }}
|
||||
<div {{with .Get "class"}} class="{{.}}"{{end}}{{with .Get "id"}} id="{{.}}"{{end}}>
|
||||
{{ else if or (eq $loc "") (eq $loc "begin") }}
|
||||
<div>
|
||||
{{ else if eq $loc "end" }}
|
||||
</div>
|
||||
{{ end }}
|
13
layouts/shortcodes/epigraph.html
Normal file
13
layouts/shortcodes/epigraph.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div class="epigraph">
|
||||
<blockquote>
|
||||
{{ $t := .Get "type" }}
|
||||
{{ if eq $t "compact" }}{{ .Inner }}{{ else }}<p>{{ .Inner }}</p>{{ end }}
|
||||
{{ if .IsNamedParams }}
|
||||
<footer>
|
||||
{{ with .Get "pre" }}{{ . }}{{ end }}
|
||||
{{ with .Get "cite" }}<cite>{{ . }}</cite>{{ end }}
|
||||
{{ with .Get "post" }}{{ . }}{{ end }}
|
||||
</footer>
|
||||
{{ end }}
|
||||
<blockquote>
|
||||
</div>
|
|
@ -1,9 +1,9 @@
|
|||
{{ with .Get 0 }}
|
||||
{{ if eq . "begin" }}
|
||||
<section>
|
||||
{{ else if eq . "end" }}
|
||||
</section>
|
||||
{{ end }}
|
||||
{{ $loc := .Get 0 }}
|
||||
{{ if .IsNamedParams }}
|
||||
<section {{with .Get "class"}} class="{{.}}"{{end}}{{with .Get "id"}} id="{{.}}"{{end}}>
|
||||
{{ else if or (eq $loc "") (eq $loc "begin") }}
|
||||
<section>
|
||||
{{ else if eq $loc "end" }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
|
||||
|
|
5
layouts/shortcodes/tag.html
Normal file
5
layouts/shortcodes/tag.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{ if .IsNamedParams }}
|
||||
<{{ .Get "name" }}{{with .Get "class"}} class="{{.}}"{{end}}{{with .Get "id"}} id="{{.}}"{{end}}>
|
||||
{{ else }}
|
||||
<{{ .Get 0 }}>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue