From 1f7dadf19ecc3f7f8072eb7bb692584b8fbf529c Mon Sep 17 00:00:00 2001 From: tdro Date: Fri, 8 Mar 2024 14:01:03 -0500 Subject: themes/default/layouts/partials: Merge menu --- .../default/layouts/partials/card-meta-header.html | 10 ++--- themes/default/layouts/partials/menu-datetime.html | 22 ++++++++++ themes/default/layouts/partials/menu-embed.html | 8 ++++ themes/default/layouts/partials/menu-markdown.html | 13 ++++++ .../default/layouts/partials/menu-permalink.html | 11 +++++ themes/default/layouts/partials/menu-plain.html | 9 ++++ .../layouts/partials/meta-context-menu.html | 50 ---------------------- .../default/layouts/partials/meta-date-time.html | 14 ------ themes/default/layouts/partials/meta-datetime.html | 14 ++++++ .../default/layouts/partials/meta-expiry-date.html | 20 --------- .../default/layouts/partials/meta-expirydate.html | 20 +++++++++ themes/default/layouts/partials/meta-markdown.html | 13 ------ themes/default/layouts/partials/meta-menu.html | 23 ++++++++++ .../default/layouts/partials/meta-permalink.html | 11 ----- .../default/layouts/partials/meta-read-time.html | 12 ------ themes/default/layouts/partials/meta-readtime.html | 12 ++++++ .../default/layouts/partials/meta-word-count.html | 33 -------------- .../default/layouts/partials/meta-wordcount.html | 33 ++++++++++++++ 18 files changed, 170 insertions(+), 158 deletions(-) create mode 100644 themes/default/layouts/partials/menu-datetime.html create mode 100644 themes/default/layouts/partials/menu-embed.html create mode 100644 themes/default/layouts/partials/menu-markdown.html create mode 100644 themes/default/layouts/partials/menu-permalink.html create mode 100644 themes/default/layouts/partials/menu-plain.html delete mode 100644 themes/default/layouts/partials/meta-context-menu.html delete mode 100644 themes/default/layouts/partials/meta-date-time.html create mode 100644 themes/default/layouts/partials/meta-datetime.html delete mode 100644 themes/default/layouts/partials/meta-expiry-date.html create mode 100644 themes/default/layouts/partials/meta-expirydate.html delete mode 100644 themes/default/layouts/partials/meta-markdown.html create mode 100644 themes/default/layouts/partials/meta-menu.html delete mode 100644 themes/default/layouts/partials/meta-permalink.html delete mode 100644 themes/default/layouts/partials/meta-read-time.html create mode 100644 themes/default/layouts/partials/meta-readtime.html delete mode 100644 themes/default/layouts/partials/meta-word-count.html create mode 100644 themes/default/layouts/partials/meta-wordcount.html (limited to 'themes/default/layouts') diff --git a/themes/default/layouts/partials/card-meta-header.html b/themes/default/layouts/partials/card-meta-header.html index 3fcd670..5672972 100644 --- a/themes/default/layouts/partials/card-meta-header.html +++ b/themes/default/layouts/partials/card-meta-header.html @@ -10,16 +10,16 @@ {{- partial "meta-handle.html" . -}} - {{- partial "meta-date-time.html" . -}} + {{- partial "meta-datetime.html" . -}} {{- partial "meta-view.html" . -}} - {{- partial "meta-context-menu.html" . -}} + {{- partial "meta-menu.html" . -}} - {{- partial "meta-word-count.html" . -}} + {{- partial "meta-wordcount.html" . -}} - {{- partial "meta-read-time.html" . -}} + {{- partial "meta-readtime.html" . -}} - {{- partial "meta-expiry-date.html" . -}} + {{- partial "meta-expirydate.html" . -}} diff --git a/themes/default/layouts/partials/menu-datetime.html b/themes/default/layouts/partials/menu-datetime.html new file mode 100644 index 0000000..5b2acf1 --- /dev/null +++ b/themes/default/layouts/partials/menu-datetime.html @@ -0,0 +1,22 @@ +{{- $href := print .Permalink -}} + + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} + + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/clock.svg")) -}} + + + diff --git a/themes/default/layouts/partials/menu-embed.html b/themes/default/layouts/partials/menu-embed.html new file mode 100644 index 0000000..7890102 --- /dev/null +++ b/themes/default/layouts/partials/menu-embed.html @@ -0,0 +1,8 @@ +{{- $href := print .Permalink -}} + + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/code.svg")) -}} + Embed + + diff --git a/themes/default/layouts/partials/menu-markdown.html b/themes/default/layouts/partials/menu-markdown.html new file mode 100644 index 0000000..7098fa5 --- /dev/null +++ b/themes/default/layouts/partials/menu-markdown.html @@ -0,0 +1,13 @@ +{{- if not .ExpiryDate -}} + {{- $relURL := strings.TrimPrefix .Page.Site.BaseURL .Page.Permalink -}} + {{- $source := print (path.Dir $relURL) ".md" -}} + {{- $href := print .Site.BaseURL "/" (partial "function-paths.html").markdown $source -}} + {{- $title := .File.LogicalName -}} + + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/square-letter-m.svg")) -}} + Markdown + + +{{- end -}} diff --git a/themes/default/layouts/partials/menu-permalink.html b/themes/default/layouts/partials/menu-permalink.html new file mode 100644 index 0000000..2af4e8a --- /dev/null +++ b/themes/default/layouts/partials/menu-permalink.html @@ -0,0 +1,11 @@ +{{- $href := print .Permalink "#" (partial "card-id.html" .) -}} + + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/link.svg")) -}} + Permalink +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/menu-plain.html b/themes/default/layouts/partials/menu-plain.html new file mode 100644 index 0000000..3886945 --- /dev/null +++ b/themes/default/layouts/partials/menu-plain.html @@ -0,0 +1,9 @@ +{{- $href := print .Permalink -}} +{{- $plain := print $href "index.txt" -}} + + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/notes.svg")) -}} + Plaintext + + diff --git a/themes/default/layouts/partials/meta-context-menu.html b/themes/default/layouts/partials/meta-context-menu.html deleted file mode 100644 index 89f88d2..0000000 --- a/themes/default/layouts/partials/meta-context-menu.html +++ /dev/null @@ -1,50 +0,0 @@ -{{- $id := partial "card-id.html" . -}} -{{- $href := print .Permalink -}} -{{- $plain := print $href "index.txt" -}} - - - - - - - {{- partial "meta-markdown.html" . -}} - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/notes.svg")) -}} - Plaintext - - - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/code.svg")) -}} - Embed - - - {{- partial "meta-permalink.html" . -}} - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} - - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/clock.svg")) -}} - - - - - - -{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-date-time.html b/themes/default/layouts/partials/meta-date-time.html deleted file mode 100644 index 1dc50f3..0000000 --- a/themes/default/layouts/partials/meta-date-time.html +++ /dev/null @@ -1,14 +0,0 @@ - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} - {{ if .Lastmod.After .Date }} - (edited) - {{- end -}} -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-datetime.html b/themes/default/layouts/partials/meta-datetime.html new file mode 100644 index 0000000..1dc50f3 --- /dev/null +++ b/themes/default/layouts/partials/meta-datetime.html @@ -0,0 +1,14 @@ + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} + {{ if .Lastmod.After .Date }} + (edited) + {{- end -}} +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-expiry-date.html b/themes/default/layouts/partials/meta-expiry-date.html deleted file mode 100644 index 6eef09e..0000000 --- a/themes/default/layouts/partials/meta-expiry-date.html +++ /dev/null @@ -1,20 +0,0 @@ -{{- if .ExpiryDate -}} - {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} - {{- $diff := now.Sub .ExpiryDate -}} - {{- $duration := lang.FormatNumberCustom 0 (math.Round (mul (div $diff.Hours 24) -1)) -}} - {{- $date := .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} - {{- $title := print "Self destructs within" " " $duration " " "days" " " "(" $date ")" -}} - {{- if $expired -}} - {{- $title = print "Self destructed" " " $date -}} - {{- end -}} - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/trash-2.svg")) -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- end -}} diff --git a/themes/default/layouts/partials/meta-expirydate.html b/themes/default/layouts/partials/meta-expirydate.html new file mode 100644 index 0000000..6eef09e --- /dev/null +++ b/themes/default/layouts/partials/meta-expirydate.html @@ -0,0 +1,20 @@ +{{- if .ExpiryDate -}} + {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} + {{- $diff := now.Sub .ExpiryDate -}} + {{- $duration := lang.FormatNumberCustom 0 (math.Round (mul (div $diff.Hours 24) -1)) -}} + {{- $date := .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + {{- $title := print "Self destructs within" " " $duration " " "days" " " "(" $date ")" -}} + {{- if $expired -}} + {{- $title = print "Self destructed" " " $date -}} + {{- end -}} + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/trash-2.svg")) -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- end -}} diff --git a/themes/default/layouts/partials/meta-markdown.html b/themes/default/layouts/partials/meta-markdown.html deleted file mode 100644 index 7098fa5..0000000 --- a/themes/default/layouts/partials/meta-markdown.html +++ /dev/null @@ -1,13 +0,0 @@ -{{- if not .ExpiryDate -}} - {{- $relURL := strings.TrimPrefix .Page.Site.BaseURL .Page.Permalink -}} - {{- $source := print (path.Dir $relURL) ".md" -}} - {{- $href := print .Site.BaseURL "/" (partial "function-paths.html").markdown $source -}} - {{- $title := .File.LogicalName -}} - - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/square-letter-m.svg")) -}} - Markdown - - -{{- end -}} diff --git a/themes/default/layouts/partials/meta-menu.html b/themes/default/layouts/partials/meta-menu.html new file mode 100644 index 0000000..f5e127d --- /dev/null +++ b/themes/default/layouts/partials/meta-menu.html @@ -0,0 +1,23 @@ +{{- $id := partial "card-id.html" . -}} + + +
  • + +
  • +
  • + + + + {{- partial "menu-markdown.html" . -}} + {{- partial "menu-plain.html" . -}} + {{- partial "menu-embed.html" . -}} + {{- partial "menu-permalink.html" . -}} + {{- partial "menu-datetime.html" . -}} + + +
  • +
    +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-permalink.html b/themes/default/layouts/partials/meta-permalink.html deleted file mode 100644 index 2af4e8a..0000000 --- a/themes/default/layouts/partials/meta-permalink.html +++ /dev/null @@ -1,11 +0,0 @@ -{{- $href := print .Permalink "#" (partial "card-id.html" .) -}} - - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/link.svg")) -}} - Permalink -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-read-time.html b/themes/default/layouts/partials/meta-read-time.html deleted file mode 100644 index 1af03e7..0000000 --- a/themes/default/layouts/partials/meta-read-time.html +++ /dev/null @@ -1,12 +0,0 @@ -{{- $seconds := mul (div .WordCount 180.0) 60.0 -}} -{{- $seconds = printf "%.0f" $seconds -}} -{{- if eq $seconds "0" -}} - {{- $seconds = "1" -}} -{{- end -}} - - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/eye.svg")) }} - {{ $seconds }}s read -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-readtime.html b/themes/default/layouts/partials/meta-readtime.html new file mode 100644 index 0000000..1af03e7 --- /dev/null +++ b/themes/default/layouts/partials/meta-readtime.html @@ -0,0 +1,12 @@ +{{- $seconds := mul (div .WordCount 180.0) 60.0 -}} +{{- $seconds = printf "%.0f" $seconds -}} +{{- if eq $seconds "0" -}} + {{- $seconds = "1" -}} +{{- end -}} + + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/eye.svg")) }} + {{ $seconds }}s read +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-word-count.html b/themes/default/layouts/partials/meta-word-count.html deleted file mode 100644 index 5fd5451..0000000 --- a/themes/default/layouts/partials/meta-word-count.html +++ /dev/null @@ -1,33 +0,0 @@ -{{- $author := partial "function-authors-data.html" . -}} -{{- $limit := $author.wordlimit -}} -{{- $wordLimit := gt .WordCount $limit -}} -{{- $overLimit := sub .WordCount $limit -}} -{{- $bitCount := lang.FormatNumberCustom 0 (len .Content) -}} - - -{{- /* This comment removes trailing newlines and white spaces. */ -}} - - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/notes.svg")) -}} - - {{- if $wordLimit -}} - {{ .WordCount }} - {{- else -}} - {{ .WordCount }} - {{- end -}} - /{{ $limit }} words -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} - -{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-wordcount.html b/themes/default/layouts/partials/meta-wordcount.html new file mode 100644 index 0000000..5fd5451 --- /dev/null +++ b/themes/default/layouts/partials/meta-wordcount.html @@ -0,0 +1,33 @@ +{{- $author := partial "function-authors-data.html" . -}} +{{- $limit := $author.wordlimit -}} +{{- $wordLimit := gt .WordCount $limit -}} +{{- $overLimit := sub .WordCount $limit -}} +{{- $bitCount := lang.FormatNumberCustom 0 (len .Content) -}} + + +{{- /* This comment removes trailing newlines and white spaces. */ -}} + + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/notes.svg")) -}} + + {{- if $wordLimit -}} + {{ .WordCount }} + {{- else -}} + {{ .WordCount }} + {{- end -}} + /{{ $limit }} words +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} -- cgit v1.2.3