diff options
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r-- | layouts/shortcodes/alert.html | 4 | ||||
-rw-r--r-- | layouts/shortcodes/button.html | 6 | ||||
-rw-r--r-- | layouts/shortcodes/childpages.html | 34 | ||||
-rw-r--r-- | layouts/shortcodes/code.html | 28 | ||||
-rw-r--r-- | layouts/shortcodes/collapse.html | 11 | ||||
-rw-r--r-- | layouts/shortcodes/doublecode.html | 33 | ||||
-rw-r--r-- | layouts/shortcodes/lead.html | 3 | ||||
-rw-r--r-- | layouts/shortcodes/panel.html | 14 |
8 files changed, 133 insertions, 0 deletions
diff --git a/layouts/shortcodes/alert.html b/layouts/shortcodes/alert.html new file mode 100644 index 0000000..13e24f0 --- /dev/null +++ b/layouts/shortcodes/alert.html @@ -0,0 +1,4 @@ +{{ $style := .Get "style" }} +<div class="alert alert-{{ $style }}" role="alert"> + {{ print .Inner | markdownify }} +</div> diff --git a/layouts/shortcodes/button.html b/layouts/shortcodes/button.html new file mode 100644 index 0000000..27fcf26 --- /dev/null +++ b/layouts/shortcodes/button.html @@ -0,0 +1,6 @@ +{{ $style := .Get "style" }} +{{ $link := .Get "link" }} + +<a href="{{ $link }}" class="btn btn-{{ $style }}"> + {{ print .Inner | markdownify }} +</a> diff --git a/layouts/shortcodes/childpages.html b/layouts/shortcodes/childpages.html new file mode 100644 index 0000000..94ff26f --- /dev/null +++ b/layouts/shortcodes/childpages.html @@ -0,0 +1,34 @@ +{{- $sortTerm := .Get "sort" | default "Weight" }} + +{{- .Scratch.Set "current" .Page }} + +{{- if (.Get "page")}} + {{- with .Site.GetPage "section" (.Get "page") }} + {{- $.Scratch.Set "current" . }} + {{- end }} +{{- end }} + +{{- $cpage := (.Scratch.Get "current") }} + + +<ul class="docs-children list-unstyled"> + {{- .Scratch.Set "pages" $cpage.Pages }} + {{- if $cpage.Sections}} + {{- .Scratch.Set "pages" ($cpage.Pages | union $cpage.Sections) }} + {{- end}} + {{- $pages := (.Scratch.Get "pages") }} + + {{- if eq $sortTerm "Weight"}} + {{- template "childs" dict "menu" $pages.ByWeight "pages" .Site.Pages "sortTerm" $sortTerm}} + {{end}} +</ul> + + + +{{ define "childs" }} + {{- range .menu }} + <li class="h2 py-1"> + <a href="{{.RelPermalink}}"> {{ .Title }} </a> + </li> + {{ end }} +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html new file mode 100644 index 0000000..5d8a778 --- /dev/null +++ b/layouts/shortcodes/code.html @@ -0,0 +1,28 @@ +{{ .Scratch.Set "content" "" }} +{{ .Scratch.Set "identifier" "" }} + +{{ $identifier := "" }} +{{ $filepath := .Get "file"}} +{{ if ($filepath) }} + {{ .Scratch.Set "content" ($filepath | readFile) }} + {{ .Scratch.Set "identifier" (first 10 (md5 (.Scratch.Get "content"))) }} +{{ else }} + {{ .Scratch.Set "content" .Inner }} + {{ .Scratch.Set "identifier" (first 10 (md5 .Inner)) }} +{{ end}} + +{{ $lang := .Get "lang" }} + +<div class="position-relative"> + <div class="position-absolute" style="right:0;"> + <button class="btn btn-light" data-clipboard-target="#{{printf "clipboard_%s" (.Scratch.Get "identifier") }}"> + Copy + </button> + </div> + <div id="{{printf "clipboard_%s" (.Scratch.Get "identifier") }}"> + {{ (print "```" $lang "\n" (.Scratch.Get "content") "\n```") | markdownify }} + </div> +</div> + + + diff --git a/layouts/shortcodes/collapse.html b/layouts/shortcodes/collapse.html new file mode 100644 index 0000000..3770e17 --- /dev/null +++ b/layouts/shortcodes/collapse.html @@ -0,0 +1,11 @@ +{{ .Scratch.Set "identifier" (first 10 (md5 .Inner)) }} + +<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#{{printf "collapse_%s" (.Scratch.Get "identifier") }}" aria-expanded="false"> + {{ print (.Get "title") }} +</button> + +<div class="collapse" id="{{printf "collapse_%s" (.Scratch.Get "identifier") }}"> + <div class="card card-body"> + {{ .Inner }} + </div> +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/doublecode.html b/layouts/shortcodes/doublecode.html new file mode 100644 index 0000000..e57b355 --- /dev/null +++ b/layouts/shortcodes/doublecode.html @@ -0,0 +1,33 @@ +{{ .Scratch.Set "content" "" }} +{{ .Scratch.Set "identifier" "" }} + +{{ $identifier := "" }} +{{ $filepath := .Get "file"}} +{{ if ($filepath) }} +{{ .Scratch.Set "content" ($filepath | readFile) }} +{{ .Scratch.Set "identifier" (first 10 (md5 (.Scratch.Get "content"))) }} +{{ else }} +{{ .Scratch.Set "content" .Inner }} +{{ .Scratch.Set "identifier" (first 10 (md5 .Inner)) }} +{{ end}} + +{{ $lang := .Get "lang" }} + +<div class="border border-light" style="border-width:3px!important;"> + + <div class="px-3 py-2"> + {{ (.Scratch.Get "content") | safeHTML }} + </div> + +</div> + +<div class="position-relative"> + <div class="position-absolute" style="right:0;"> + <button class="btn btn-light" data-clipboard-target="#{{printf "clipboard_%s" (.Scratch.Get "identifier") }}"> + Copy + </button> + </div> + <div id="{{printf "clipboard_%s" (.Scratch.Get "identifier") }}"> + {{ (print "```" $lang "\n" (.Scratch.Get "content") "\n```") | markdownify }} + </div> +</div> diff --git a/layouts/shortcodes/lead.html b/layouts/shortcodes/lead.html new file mode 100644 index 0000000..b63cb9e --- /dev/null +++ b/layouts/shortcodes/lead.html @@ -0,0 +1,3 @@ +<p class="lead"> + {{ print .Inner | markdownify }} +</p> diff --git a/layouts/shortcodes/panel.html b/layouts/shortcodes/panel.html new file mode 100644 index 0000000..a5ad93c --- /dev/null +++ b/layouts/shortcodes/panel.html @@ -0,0 +1,14 @@ +{{ $style := .Get "style"}} + +<div class="card my-3 border-top-0 border-right-0 border-bottom-0 border-left border-{{ $style }} rounded" style="border-width:4px !important;"> + <div class="wrap border border-left-0 rounded"> + {{ with .Get "title" }} + <div class="card-header border-0 bg-white pl-3 text-{{ $style }}"> + <h3>{{.}}</h3> + </div> + {{ end }} + <div class="card-body pt-1"> + {{ print .Inner | markdownify }} + </div> + </div> +</div> |