summaryrefslogtreecommitdiff
path: root/themes/terminal/layouts/shortcodes
diff options
context:
space:
mode:
Diffstat (limited to 'themes/terminal/layouts/shortcodes')
-rw-r--r--themes/terminal/layouts/shortcodes/code.html15
-rw-r--r--themes/terminal/layouts/shortcodes/figure.html8
-rw-r--r--themes/terminal/layouts/shortcodes/image.html3
-rw-r--r--themes/terminal/layouts/shortcodes/prismjs.html25
4 files changed, 51 insertions, 0 deletions
diff --git a/themes/terminal/layouts/shortcodes/code.html b/themes/terminal/layouts/shortcodes/code.html
new file mode 100644
index 0000000..8bab825
--- /dev/null
+++ b/themes/terminal/layouts/shortcodes/code.html
@@ -0,0 +1,15 @@
+{{ $id := delimit (shuffle (seq 1 9)) "" }}
+
+{{ if .Get "language" }}
+ <div class="collapsable-code">
+ <input id="{{ .Get "id" | default $id }}" type="checkbox" {{ if ( eq ( .Get "isCollapsed" ) "true" ) -}} checked {{- end }} />
+ <label for="{{ .Get "id" | default $id }}">
+ <span class="collapsable-code__language">{{ .Get "language" }}</span>
+ {{ if .Get "title" }}<span class="collapsable-code__title">{{ .Get "title" | markdownify }}</span>{{ end }}
+ <span class="collapsable-code__toggle" data-label-expand="{{ .Get "expand" | default "△" }}" data-label-collapse="{{ .Get "collapse" | default "▽" }}"></span>
+ </label>
+ <pre {{ if .Get "language" }}class="language-{{ .Get "language" }}" {{ end }}><code>{{ .Inner | string }}</code></pre>
+ </div>
+{{ else }}
+ {{ errorf "If you want to use the \"collapsable code\" shortcode, you need to pass a mandatory \"language\" param. The issue occured in %q (%q)" .Page.File .Page.Permalink }}
+{{ end }}
diff --git a/themes/terminal/layouts/shortcodes/figure.html b/themes/terminal/layouts/shortcodes/figure.html
new file mode 100644
index 0000000..6642c82
--- /dev/null
+++ b/themes/terminal/layouts/shortcodes/figure.html
@@ -0,0 +1,8 @@
+{{ if .Get "src" }}
+ <figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" >
+ <img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} />
+ {{ if .Get "caption" }}
+ <figcaption class="{{ with .Get "captionPosition"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "captionStyle" }} style="{{ . | safeCSS }}" {{ end }}>{{ .Get "caption" | safeHTML }}</figcaption>
+ {{ end }}
+ </figure>
+{{ end }}
diff --git a/themes/terminal/layouts/shortcodes/image.html b/themes/terminal/layouts/shortcodes/image.html
new file mode 100644
index 0000000..6b2a2c0
--- /dev/null
+++ b/themes/terminal/layouts/shortcodes/image.html
@@ -0,0 +1,3 @@
+{{ if .Get "src" }}
+ <img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} />
+{{ end }}
diff --git a/themes/terminal/layouts/shortcodes/prismjs.html b/themes/terminal/layouts/shortcodes/prismjs.html
new file mode 100644
index 0000000..e4acffe
--- /dev/null
+++ b/themes/terminal/layouts/shortcodes/prismjs.html
@@ -0,0 +1,25 @@
+{{ $inner := replaceRE "^\r?\n" "" .Inner | string }}
+{{ if len .Params | eq 0 }}
+ <pre><code>{{ $inner }}</code></pre>
+{{ else }}
+ {{ if .IsNamedParams }}
+ <pre class="
+ {{- if .Get "lang" }}language-{{ .Get "lang" }}{{ end }}
+ {{- if .Get "line-numbers" }} line-numbers{{ end }}
+ {{- if .Get "command-line" }} command-line{{ end }}"
+ {{- /* line highlight plugin */ -}}
+ {{- if .Get "line" }} data-line="{{ .Get "line" }}"{{ end }}
+ {{- /* line number plugin */ -}}
+ {{- if .Get "start" }} data-start="{{ .Get "start" }}"{{ end }}
+ {{- /* command-line plugin */ -}}
+ {{- if .Get "user" }} data-user="{{ .Get "user" }}"{{ end }}
+ {{- if .Get "host" }} data-host="{{ .Get "host" }}"{{ end }}
+ {{- if .Get "prompt" }} data-prompt="{{ .Get "prompt" }}"{{ end }}
+ {{- if .Get "output" }} data-output="{{ .Get "output" }}"{{ end }}
+ ><code {{ if .Get "lang" }}class="language-{{ .Get "lang" }}"{{ end }}
+ >{{ $inner }}</code></pre>
+ {{ else }}
+ <pre class="language-{{ .Get 0 }}">
+ <code class="language-{{ .Get 0 }}">{{ $inner }}</code></pre>
+ {{ end }}
+{{ end }}