diff options
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r-- | layouts/shortcodes/admonition.html | 37 | ||||
-rw-r--r-- | layouts/shortcodes/bilibili.html | 23 | ||||
-rw-r--r-- | layouts/shortcodes/center.html | 3 | ||||
-rw-r--r-- | layouts/shortcodes/icons.html | 6 | ||||
-rw-r--r-- | layouts/shortcodes/left.html | 3 | ||||
-rw-r--r-- | layouts/shortcodes/music.html | 62 | ||||
-rw-r--r-- | layouts/shortcodes/right.html | 3 |
7 files changed, 137 insertions, 0 deletions
diff --git a/layouts/shortcodes/admonition.html b/layouts/shortcodes/admonition.html new file mode 100644 index 0000000..fa5aacb --- /dev/null +++ b/layouts/shortcodes/admonition.html @@ -0,0 +1,37 @@ +{{ if .IsNamedParams -}} + + {{ if eq (.Get "details") "true" -}} + +<details class="admonition {{ .Get "type" }}"> + {{- with .Get "title" }}<summary class="admonition-title">{{ . }}</summary>{{ end }} + {{ .Inner }} +</details> + + {{- else -}} + +<div class="admonition {{ .Get "type" }}"> + {{- with .Get "title" }}<p class="admonition-title">{{ . }}</p>{{ end }} + {{ .Inner }} +</div> + + {{- end }} + +{{- else -}} + + {{ if eq (.Get 2) "true" -}} + +<details class="admonition {{ .Get 0 }}"> + {{- with .Get 1 }}<summary class="admonition-title">{{ . }}</summary>{{ end }} + {{ .Inner }} +</details> + + {{- else -}} + +<div class="admonition {{ .Get 0 }}"> + {{- with .Get 1 }}<p class="admonition-title">{{ . }}</p>{{ end }} + {{ .Inner }} +</div> + + {{- end }} + +{{- end }}
\ No newline at end of file diff --git a/layouts/shortcodes/bilibili.html b/layouts/shortcodes/bilibili.html new file mode 100644 index 0000000..005eccb --- /dev/null +++ b/layouts/shortcodes/bilibili.html @@ -0,0 +1,23 @@ + +{{ $videoID := index .Params 0 }} +{{ $pageNum := index .Params 1 | default 1 }} + +{{ if (findRE "^[bB][vV][0-9a-zA-Z]+$" $videoID) }} +<div><iframe id="biliplayer" src="//player.bilibili.com/player.html?bvid={{ $videoID }}&page={{ $pageNum }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" loading="lazy" > </iframe></div> +{{ else }} +<div><iframe id="biliplayer" src="//player.bilibili.com/player.html?aid={{ $videoID }}&page={{ $pageNum }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" loading="lazy" > </iframe></div> +{{ end }} + +<style> +// Embed BiliBili Video +#bilibili { + width: 100%; + height: 550px; +} +@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { + #bilibili { + width: 100%; + height: 250px; + } +} +</style> diff --git a/layouts/shortcodes/center.html b/layouts/shortcodes/center.html new file mode 100644 index 0000000..e9022d0 --- /dev/null +++ b/layouts/shortcodes/center.html @@ -0,0 +1,3 @@ +<div class='align-center'> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/icons.html b/layouts/shortcodes/icons.html new file mode 100644 index 0000000..2279580 --- /dev/null +++ b/layouts/shortcodes/icons.html @@ -0,0 +1,6 @@ +<span class="inline-svg" > + {{- $fname:=print "icons/" ( .Get 0 ) ".svg" -}} + {{- $path:="<path" -}} + {{- $fill:="<path fill=\"currentColor\"" -}} + {{ replace (readFile $fname) $path $fill | safeHTML }} +</span>
\ No newline at end of file diff --git a/layouts/shortcodes/left.html b/layouts/shortcodes/left.html new file mode 100644 index 0000000..c2c5102 --- /dev/null +++ b/layouts/shortcodes/left.html @@ -0,0 +1,3 @@ +<div class='align-left'> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/music.html b/layouts/shortcodes/music.html new file mode 100644 index 0000000..22b2268 --- /dev/null +++ b/layouts/shortcodes/music.html @@ -0,0 +1,62 @@ + {{/* + ## Music 163 + + ### Params: + + - `id` + + required param + you can extract from music url + url format "http://music.163.com/#/song?id=3950552" + + - Fiddle `auto` + + optional param + default value 0 + you can overwrite it with 1 + + ### Examples: + + - Simple + + {{% music "3950552" %}} + {{% music "3950552" "1" %}} + + - Named Params + + {{% music id="3950552" %}} + {{% music id="3950552" auto="1" %}} + + */}} + + {{- /* DEFAULTS */ -}} + {{ $auto := "0" }} + + {{- if .IsNamedParams -}} + + <iframe style="max-width: 100%" + class="music163" + frameborder="no" + border="0" + marginwidth="0" + marginheight="0" + width="330" + height="86" + src="//music.163.com/outchain/player?type=2&id={{ .Get "id" }}&auto={{ or (.Get "auto") $auto }}&height=66"> + </iframe> + + {{- else -}} + + <iframe style="max-width: 100%" + class="music163" + frameborder="no" + border="0" + marginwidth="0" + marginheight="0" + width="330" + height="86" + src="//music.163.com/outchain/player?type=2&id={{ .Get 0 }}&auto={{ if isset .Params 1 }}{{ .Get 1 }}{{ else }}{{ $auto }}{{ end }}&height=66"> + </iframe> + + {{- end -}} +
\ No newline at end of file diff --git a/layouts/shortcodes/right.html b/layouts/shortcodes/right.html new file mode 100644 index 0000000..37a9a33 --- /dev/null +++ b/layouts/shortcodes/right.html @@ -0,0 +1,3 @@ +<div class='align-right'> + {{ .Inner }} +</div>
\ No newline at end of file |