aboutsummaryrefslogtreecommitdiffstats
path: root/code/frontpage/layouts/shortcodes
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2023-02-25 13:15:44 +0100
committerivarlovlie <git@ivarlovlie.no>2023-02-25 13:15:44 +0100
commit900bb5e845c3ad44defbd427cae3d44a4a43321f (patch)
treedf3d96a93771884add571e82336c29fc3d9c7a1c /code/frontpage/layouts/shortcodes
downloadgreatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.tar.xz
greatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.zip
feat: Initial commit
Diffstat (limited to 'code/frontpage/layouts/shortcodes')
-rw-r--r--code/frontpage/layouts/shortcodes/alert.html12
-rw-r--r--code/frontpage/layouts/shortcodes/details.html4
-rw-r--r--code/frontpage/layouts/shortcodes/email.html1
-rw-r--r--code/frontpage/layouts/shortcodes/mermaid.html8
-rw-r--r--code/frontpage/layouts/shortcodes/video.html11
5 files changed, 36 insertions, 0 deletions
diff --git a/code/frontpage/layouts/shortcodes/alert.html b/code/frontpage/layouts/shortcodes/alert.html
new file mode 100644
index 0000000..e2abe8e
--- /dev/null
+++ b/code/frontpage/layouts/shortcodes/alert.html
@@ -0,0 +1,12 @@
+<div class="alert alert-{{ with .Get "context" }}{{.}}{{ else }}doks{{ end }} d-flex" role="alert">
+ <div class="flex-shrink-1 alert-icon">{{ with .Get "icon" }}{{.}} {{ end }}</div>
+ {{ with .Get "text"}}
+ <div class="w-100">{{ . | safeHTML }} </div>
+ {{ else }}
+ {{ with .Inner}}
+ <div class="w-100"> {{ . | markdownify}}</div>
+ {{ else }}
+ {{ errorf "No valid text variable or Inner content given"}}
+ {{ end }}
+ {{ end}}
+</div>
diff --git a/code/frontpage/layouts/shortcodes/details.html b/code/frontpage/layouts/shortcodes/details.html
new file mode 100644
index 0000000..61a7183
--- /dev/null
+++ b/code/frontpage/layouts/shortcodes/details.html
@@ -0,0 +1,4 @@
+<details{{ with .Get 1 }} {{ . | safeHTML }}{{ end -}}>
+ <summary>{{ with .Get 0 -}}{{ . | safeHTML }}{{ else -}}{{ errorf "No summary provided"}}{{ end -}}</summary>
+ {{ with .Inner -}}{{ . | markdownify}}{{ else -}}{{ errorf "No details provided"}}{{ end -}}
+</details> \ No newline at end of file
diff --git a/code/frontpage/layouts/shortcodes/email.html b/code/frontpage/layouts/shortcodes/email.html
new file mode 100644
index 0000000..88674fc
--- /dev/null
+++ b/code/frontpage/layouts/shortcodes/email.html
@@ -0,0 +1 @@
+<script type="text/javascript" nonce="dXNlcj0iaGVsbG8iLGRvbWFpbj0iaGVua3ZlcmxpbmRlLmNvbSIsZG9jdW1lbnQud3JpdGUodXNlcisiQCIrZG9tYWluKTs=">user="{{ with .Get "user" }}{{.}}{{ end }}",domain="{{ with .Get "domain" }}{{.}}{{ end }}",document.write(user+"@"+domain);</script><noscript>{{ with .Get "user" }}{{.}}{{ end }} at {{ with .Get "domain" }}{{.}}{{ end }}</noscript> \ No newline at end of file
diff --git a/code/frontpage/layouts/shortcodes/mermaid.html b/code/frontpage/layouts/shortcodes/mermaid.html
new file mode 100644
index 0000000..aeecad5
--- /dev/null
+++ b/code/frontpage/layouts/shortcodes/mermaid.html
@@ -0,0 +1,8 @@
+{{ if .Page.Params.mermaid -}}
+ <div class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
+ {{ $data := replaceRE "(^\\s+```)" "" .Inner -}}
+ {{ replaceRE "(```\\s+$)" "" $data -}}
+ </div>
+{{ else -}}
+ {{ errorf "Failed to process mermaid shortcode: %s. Set mermaid to true in page front matter." .Position }}
+{{ end -}}
diff --git a/code/frontpage/layouts/shortcodes/video.html b/code/frontpage/layouts/shortcodes/video.html
new file mode 100644
index 0000000..784c3a7
--- /dev/null
+++ b/code/frontpage/layouts/shortcodes/video.html
@@ -0,0 +1,11 @@
+<div class="ratio ratio-{{ with .Get "ratio" }}{{.}}{{ end }}">
+ <video{{ with .Get "attributes" }} {{ . | safeHTMLAttr }}{{ end }}>
+ {{ with .Get "webm-src" -}}
+ <source src="{{ . | relURL }}" type="video/webm">
+ {{ end -}}
+ {{ with .Get "mp4-src" -}}
+ <source src="{{ . | relURL }}" type="video/mp4">
+ {{ end -}}
+ Sorry, your browser doesn't support embedded videos.
+ </video>
+</div>