aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/shortcodes')
-rw-r--r--themes/default/layouts/shortcodes/abbr.html2
-rw-r--r--themes/default/layouts/shortcodes/attach.html29
-rw-r--r--themes/default/layouts/shortcodes/disclose.html7
-rw-r--r--themes/default/layouts/shortcodes/gist.html9
-rw-r--r--themes/default/layouts/shortcodes/kbd.html1
-rw-r--r--themes/default/layouts/shortcodes/mark.html10
-rw-r--r--themes/default/layouts/shortcodes/react.html4
-rw-r--r--themes/default/layouts/shortcodes/reddit.html29
-rw-r--r--themes/default/layouts/shortcodes/spoiler.html2
-rw-r--r--themes/default/layouts/shortcodes/version.html8
-rw-r--r--themes/default/layouts/shortcodes/video-ascii.html (renamed from themes/default/layouts/shortcodes/asciicast.html)0
-rw-r--r--themes/default/layouts/shortcodes/video-imgur.html (renamed from themes/default/layouts/shortcodes/imgur-video.html)0
-rw-r--r--themes/default/layouts/shortcodes/video.rss.xml4
-rw-r--r--themes/default/layouts/shortcodes/vimeo.html12
14 files changed, 39 insertions, 78 deletions
diff --git a/themes/default/layouts/shortcodes/abbr.html b/themes/default/layouts/shortcodes/abbr.html
index 2a87233..61a2e32 100644
--- a/themes/default/layouts/shortcodes/abbr.html
+++ b/themes/default/layouts/shortcodes/abbr.html
@@ -1,6 +1,6 @@
{{- $abbr := default "TL;DR:" (.Get "abbr" | default (.Get 0)) -}}
{{- $title := default "Too long, didn't read" (.Get "title" | default (.Get 1)) -}}
-{{- $hash := print (truncate 8 "" (sha256 $abbr)) .Ordinal -}}
+{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $abbr)) .Ordinal -}}
<input hidden="" type="checkbox" id="abbr-{{ $hash }}" />
{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/shortcodes/attach.html b/themes/default/layouts/shortcodes/attach.html
index f453da5..55b5744 100644
--- a/themes/default/layouts/shortcodes/attach.html
+++ b/themes/default/layouts/shortcodes/attach.html
@@ -1,37 +1,38 @@
-{{- $url := default "https://www.gutenberg.org/files/98/old/2city12p.pdf" (.Get "url" | default (.Get 0)) -}}
+{{- $url := default "/canory/media/2city12p.pdf" (.Get "url" | default (.Get 0)) -}}
{{- $title := default "Attachment" (.Get "title" | default (.Get 1)) -}}
{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}}
{{- $remote := default "" (.Get "remote" | default (.Get 3)) -}}
{{- $data := "" -}}
{{- $cache := "" -}}
-{{- $type := "application/octet-stream" -}}
{{- $author := .Page.Section -}}
-{{- $immutable := print $url | anchorize -}}
{{- $extension := path.Ext $url -}}
-{{- $fileCache := print $author "/media/" $immutable $extension -}}
-{{- $notCached := not (fileExists (path.Join "public/" $fileCache)) -}}
+{{- $immutable := print $url | anchorize -}}
+{{- $localFile := path.Join "public/" $url -}}
+{{- $type := "application/octet-stream" -}}
+{{- $storage := print $author "/media/" $immutable $extension -}}
+{{- $cached := fileExists (path.Join "public/" $storage) -}}
-{{- if $notCached -}}
+{{- if not $cached -}}
{{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $url) -}}
{{- with .Err -}}
- {{- warnf "Attachment fetch %s" . -}}
- {{- if not (fileExists $fileCache) -}}
+ {{- if not (fileExists $localFile) -}}
{{- $caption = "No local attachment data found for source" -}}
+ {{- warnf "Attachment local fetch error: %s" $url -}}
{{- end -}}
{{- else -}}
- {{- $type = .MediaType -}}
- {{- $cache = . | resources.Copy $fileCache -}}
+ {{- $type = $remote.MediaType -}}
+ {{- $cache = $remote | resources.Copy $storage -}}
{{- $cache = $cache.Permalink -}}
{{- end -}}
{{- else -}}
{{- $caption = "Unable to load remote source data" -}}
+ {{- warnf "Attachment remote fetch error: %s" $url -}}
{{- end -}}
{{- else -}}
- {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}}
+ {{- with $cache = resources.Get (path.Join "public/" $storage) -}}
{{- $type = .MediaType -}}
- {{- $cache = $cache.Content | resources.FromString $fileCache -}}
- {{- $cache = $cache.Permalink -}}
+ {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}}
{{- end -}}
{{- end -}}
@@ -45,7 +46,7 @@
<object type="{{ $type }}" data="{{ $data }}">
<p>
Your browser does not support the <code>{{ $type }}</code> plugin. Here's a
- <a href="{{ $data }}">link to the file</a> instead.
+ <a rel="canonical" href="{{ $data }}">link to the file</a> instead.
</p>
</object>
<footer>
diff --git a/themes/default/layouts/shortcodes/disclose.html b/themes/default/layouts/shortcodes/disclose.html
index 2cc99c7..231561b 100644
--- a/themes/default/layouts/shortcodes/disclose.html
+++ b/themes/default/layouts/shortcodes/disclose.html
@@ -1,10 +1,13 @@
{{- $text := default "Content Warning: " (.Get "text" | default (.Get 0)) -}}
+{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}}
{{- if gt (len .Inner) 1 -}}
{{- $text = .Inner -}}
{{- end -}}
-<details data-disclosure>
- <summary>{{ (or $.Page.Params.title $text) | markdownify }}</summary>
+<details id="disclosure-{{ $hash }}" data-disclosure="">
+ <summary>
+ {{- (or $.Page.Params.title $text) | markdownify }}
+ </summary>
</details>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/shortcodes/gist.html b/themes/default/layouts/shortcodes/gist.html
deleted file mode 100644
index c475672..0000000
--- a/themes/default/layouts/shortcodes/gist.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{{- $user := default "gdb" (.Get "user" | default (.Get 0)) -}}
-{{- $gist := default "b6365e79be6052e7531e7ba6ea8caf23" (.Get "gist" | default (.Get 1)) -}}
-{{- $file := default "" (.Get "file" | default (.Get 2)) -}}
-
-<github-gist>
- <script
- src="https://gist.github.com/{{ $user }}/{{ $gist }}.js?file={{ $file }}">
- </script>
-</github-gist>
diff --git a/themes/default/layouts/shortcodes/kbd.html b/themes/default/layouts/shortcodes/kbd.html
index b24fd9d..63af975 100644
--- a/themes/default/layouts/shortcodes/kbd.html
+++ b/themes/default/layouts/shortcodes/kbd.html
@@ -1,3 +1,4 @@
{{- $key := default "Ctrl" (.Get "key" | default (.Get 0)) -}}
<kbd title="{{ $key }}">{{ $key | markdownify }}</kbd>
+{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/shortcodes/mark.html b/themes/default/layouts/shortcodes/mark.html
index 122a521..1b9ef3d 100644
--- a/themes/default/layouts/shortcodes/mark.html
+++ b/themes/default/layouts/shortcodes/mark.html
@@ -1,9 +1,15 @@
{{- $text := default "mark" (.Get "text" | default (.Get 0)) -}}
{{- $title := default "highlighted text" (.Get "title" | default (.Get 1)) -}}
+{{- $id := default "" (.Get "id" | default (.Get 2)) -}}
{{- if gt (len .Inner) 1 -}}
- {{- $text = .Inner -}}
+ {{- $text = trim .Inner "\n" -}}
{{- end -}}
-<mark title="{{- $title -}}">{{- $text -}}</mark>
+{{- if $id -}}
+ {{- $id = print "mark:" (truncate 30 "" $text | anchorize | replaceRE `\d` "") -}}
+ {{- $id = printf `id=%q` $id -}}
+{{- end -}}
+
+<mark {{ $id | safeHTMLAttr }} title="{{- $title -}}"><span>{{- $text | markdownify -}}</span></mark>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/shortcodes/react.html b/themes/default/layouts/shortcodes/react.html
index 344bd2d..ea96101 100644
--- a/themes/default/layouts/shortcodes/react.html
+++ b/themes/default/layouts/shortcodes/react.html
@@ -16,7 +16,7 @@
)
-}}
-<reaction-tip title="{{ $title }}">
+<tool-tip data-type="reaction" title="{{ $title }}">
{{ $text | markdownify }}
<a href="{{ $image.Permalink }}">
<img
@@ -27,4 +27,4 @@
src="{{ $image.Permalink }}"
/>
</a>
-</reaction-tip>
+</tool-tip>
diff --git a/themes/default/layouts/shortcodes/reddit.html b/themes/default/layouts/shortcodes/reddit.html
deleted file mode 100644
index 10ef0b9..0000000
--- a/themes/default/layouts/shortcodes/reddit.html
+++ /dev/null
@@ -1,29 +0,0 @@
-{{- $path := default "linux/comments/aeufh6/vlc_has_now_reached_3_billions_downloads_and/edsvibz" (.Get "path" | default (.Get 0)) -}}
-{{- $depth := default "2" (.Get "depth" | default (.Get 1)) -}}
-{{- $context := default "1" (.Get "context" | default (.Get 2)) -}}
-{{- $theme := default "light" (.Get "theme" | default (.Get 3)) -}}
-{{- $showtitle := default "true" (.Get "showtitle" | default (.Get 4)) -}}
-{{- $showedits := default "false" (.Get "showedits" | default (.Get 5)) -}}
-{{- $showmedia := default "false" (.Get "showmedia" | default (.Get 6)) -}}
-{{- $showmore := default "false" (.Get "showmore" | default (.Get 7)) -}}
-
-<reddit-comment>
- <iframe loading="lazy"
- id="reddit-embed"
- src="https://www.redditmedia.com/r/{{ trim $path "/" }}/
-?depth={{ $depth }}
-&amp;embed=true
-&amp;showmore={{ $showmore }}
-&amp;showtitle={{ $showtitle }}
-&amp;context={{ $context }}
-&amp;showmedia={{ $showmedia }}
-&amp;theme={{ $theme }}
-&amp;showedits={{ $showedits }}
-&amp;created={{ now.Format "2006-01-02T15:04:05Z" }}"
- sandbox="allow-scripts allow-same-origin allow-popups"
- style="border: none;"
- height="452"
- width="640"
- scrolling="no"
- ></iframe>
-</reddit-comment>
diff --git a/themes/default/layouts/shortcodes/spoiler.html b/themes/default/layouts/shortcodes/spoiler.html
index 5a9462d..9c5e59a 100644
--- a/themes/default/layouts/shortcodes/spoiler.html
+++ b/themes/default/layouts/shortcodes/spoiler.html
@@ -1,6 +1,6 @@
{{- $text := default "This is a spoiler." (.Get "text" | default (.Get 0)) -}}
{{- $title := default "Click to show/hide text." (.Get "title" | default (.Get 1)) -}}
-{{- $hash := print (truncate 8 "" (sha256 $text)) .Ordinal -}}
+{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}}
{{- if gt (len .Inner) 1 -}}
{{- $text = .Inner -}}
diff --git a/themes/default/layouts/shortcodes/version.html b/themes/default/layouts/shortcodes/version.html
index 11e7685..2e3eda8 100644
--- a/themes/default/layouts/shortcodes/version.html
+++ b/themes/default/layouts/shortcodes/version.html
@@ -1,12 +1,12 @@
-{{- $theme := "0.11.11" -}}
-{{- $generator := "0.108.0" -}}
+{{- $version := "0.11.12" -}}
+{{- $generator := "0.110.0" -}}
{{- $number := default false (.Get "number" | default (.Get 0)) -}}
{{- $clone := default false (.Get "clone" | default (.Get 1)) -}}
{{- $hugo := default false (.Get "hugo" | default (.Get 2)) -}}
{{- if $number -}}
- {{ $theme }}
+ {{ $version }}
{{- end -}}
{{- if $hugo -}}
@@ -15,6 +15,6 @@
{{- if $clone -}}
```shell
-git clone --branch {{ $theme }} https://www.thedroneely.com/git/thedroneely/canory
+git clone --branch {{ $version }} https://www.thedroneely.com/git/thedroneely/canory
```
{{- end -}}
diff --git a/themes/default/layouts/shortcodes/asciicast.html b/themes/default/layouts/shortcodes/video-ascii.html
index 10da091..10da091 100644
--- a/themes/default/layouts/shortcodes/asciicast.html
+++ b/themes/default/layouts/shortcodes/video-ascii.html
diff --git a/themes/default/layouts/shortcodes/imgur-video.html b/themes/default/layouts/shortcodes/video-imgur.html
index 2edb9a4..2edb9a4 100644
--- a/themes/default/layouts/shortcodes/imgur-video.html
+++ b/themes/default/layouts/shortcodes/video-imgur.html
diff --git a/themes/default/layouts/shortcodes/video.rss.xml b/themes/default/layouts/shortcodes/video.rss.xml
index cff5974..be262e7 100644
--- a/themes/default/layouts/shortcodes/video.rss.xml
+++ b/themes/default/layouts/shortcodes/video.rss.xml
@@ -21,9 +21,9 @@
title="{{ $title }}"
href="{{ $source }}"
>
- {{- $caption -}}
+ Video: {{ $caption -}}
</a>
</b>
<br>
- <span>{{ $caption }}</span>
+ <span>Title: {{ $title }}</span>
</p>
diff --git a/themes/default/layouts/shortcodes/vimeo.html b/themes/default/layouts/shortcodes/vimeo.html
deleted file mode 100644
index 009ebb0..0000000
--- a/themes/default/layouts/shortcodes/vimeo.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{{- $id := default "1084537" (.Get "id" | default (.Get 0)) -}}
-{{- $title := default "Vimeo Video" (.Get "title" | default (.Get 1)) -}}
-
-<vimeo-video>
- <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
- <iframe loading="lazy"
- src="https://player.vimeo.com/video/{{ $id }}?dnt=1"
- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;"
- title="{{ $title }}" webkitallowfullscreen mozallowfullscreen allowfullscreen>
- </iframe>
- </div>
-</vimeo-video>