From 631547a75142326a7c71bdf123e1475217a5ad73 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 22 Apr 2026 12:42:56 +0200 Subject: chore: replace with extracted danix.xyz-hacker theme (danix2-hugo-theme) --- layouts/shortcodes/actions.html | 26 ++++++++---- layouts/shortcodes/contact.html | 65 ++++++++++++++++++++++++++++++ layouts/shortcodes/div-close.html | 2 - layouts/shortcodes/div.html | 4 -- layouts/shortcodes/dropcap.html | 15 +------ layouts/shortcodes/em.html | 2 +- layouts/shortcodes/figure.html | 27 ------------- layouts/shortcodes/gal-img.html | 16 -------- layouts/shortcodes/gallery.html | 13 +++++- layouts/shortcodes/gravatar.html | 67 ++++++++----------------------- layouts/shortcodes/image.html | 23 +++++++++++ layouts/shortcodes/img.html | 84 --------------------------------------- layouts/shortcodes/quote.html | 32 +++++++-------- layouts/shortcodes/strike.html | 2 +- layouts/shortcodes/svg.html | 5 --- layouts/shortcodes/video.html | 72 ++++++++++++++++----------------- 16 files changed, 187 insertions(+), 268 deletions(-) create mode 100644 layouts/shortcodes/contact.html delete mode 100644 layouts/shortcodes/div-close.html delete mode 100644 layouts/shortcodes/div.html delete mode 100644 layouts/shortcodes/figure.html delete mode 100644 layouts/shortcodes/gal-img.html create mode 100644 layouts/shortcodes/image.html delete mode 100644 layouts/shortcodes/img.html delete mode 100644 layouts/shortcodes/svg.html (limited to 'layouts/shortcodes') diff --git a/layouts/shortcodes/actions.html b/layouts/shortcodes/actions.html index 296a211..7badab3 100644 --- a/layouts/shortcodes/actions.html +++ b/layouts/shortcodes/actions.html @@ -1,7 +1,19 @@ -{{ $link := .Get "url" }} -{{ $desc := .Get "desc" }} -{{ $outclass := .Get "outclass" }} -{{ $inclass := .Get "inclass" }} - +{{- $url := .Get "url" -}} +{{- $desc := .Get "desc" | default "Download" -}} +{{- $outclass := .Get "outclass" | default "" -}} +{{- $inclass := .Get "inclass" | default "" -}} + +{{- if $url -}} +
+ + + {{ $desc }} + +
+{{- else -}} + {{- errorf "actions shortcode: 'url' parameter is required" -}} +{{- end -}} diff --git a/layouts/shortcodes/contact.html b/layouts/shortcodes/contact.html new file mode 100644 index 0000000..6c5748f --- /dev/null +++ b/layouts/shortcodes/contact.html @@ -0,0 +1,65 @@ +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + +
+ diff --git a/layouts/shortcodes/div-close.html b/layouts/shortcodes/div-close.html deleted file mode 100644 index ea7e47c..0000000 --- a/layouts/shortcodes/div-close.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/layouts/shortcodes/div.html b/layouts/shortcodes/div.html deleted file mode 100644 index 0c0b755..0000000 --- a/layouts/shortcodes/div.html +++ /dev/null @@ -1,4 +0,0 @@ -{{ if .Get "class" }} -
-{{ end }} - diff --git a/layouts/shortcodes/dropcap.html b/layouts/shortcodes/dropcap.html index 80cbefe..6114678 100644 --- a/layouts/shortcodes/dropcap.html +++ b/layouts/shortcodes/dropcap.html @@ -1,14 +1 @@ -{{/* - * The dropcap shortcode: - * - * Usage: - * - * {{< dropcap class="some class" >}} - * your paragraph that will have a drop cap here - * {{< /dropcap >}} - * - */}} - -

- {{ .InnerDeindent }} -

+{{ .Inner }} diff --git a/layouts/shortcodes/em.html b/layouts/shortcodes/em.html index 11f399a..a3a096c 100644 --- a/layouts/shortcodes/em.html +++ b/layouts/shortcodes/em.html @@ -1 +1 @@ -{{ .Inner | markdownify }} +{{ .Inner }} diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html deleted file mode 100644 index 4cf2e7b..0000000 --- a/layouts/shortcodes/figure.html +++ /dev/null @@ -1,27 +0,0 @@ -{{/* - * This version of the figure shortcode needs to be closed and doesn't - * add an image itself, but relies on the img.html shortcode to provide - * a responsive image instead. - */}} - - {{- if .Get "link" -}} - - {{- end -}} - {{.InnerDeindent}} - {{- if .Get "link" }}{{ end -}} - {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} -
- {{ with (.Get "title") -}} -

{{ . }}

- {{- end -}} - {{- if or (.Get "caption") (.Get "attr") -}}

- {{- .Get "caption" | markdownify -}} - {{- with .Get "attrlink" }} - - {{- end -}} - {{- .Get "attr" | markdownify -}} - {{- if .Get "attrlink" }}{{ end }}

- {{- end }} -
- {{- end }} - diff --git a/layouts/shortcodes/gal-img.html b/layouts/shortcodes/gal-img.html deleted file mode 100644 index ae7d23e..0000000 --- a/layouts/shortcodes/gal-img.html +++ /dev/null @@ -1,16 +0,0 @@ -{{- $src := .Get "src" -}} -{{- $source := resources.Get $src -}} -{{- $alt := .Get "alt" -}} -{{- $caption := .Get "caption" -}} -{{- $location := .Get "location" -}} -{{- $fullsize := $source -}} -{{- $thumb := $source.Resize "400x webp" -}} -
- {{ $alt }} - {{ with $caption }}
{{ . }}
{{ end }} -
diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html index f9e546e..b66c327 100644 --- a/layouts/shortcodes/gallery.html +++ b/layouts/shortcodes/gallery.html @@ -1,3 +1,12 @@ -
- {{ .Inner }} +{{- $cols := .Get "cols" | default "2" -}} + +
+ {{- range $line := strings.Split .Inner "\n" -}} + {{- if strings.Contains $line "![" -}} + {{- $image := strings.TrimSpace $line -}} + {{- if $image -}} + {{ $image | markdownify | safeHTML }} + {{- end -}} + {{- end -}} + {{- end -}}
diff --git a/layouts/shortcodes/gravatar.html b/layouts/shortcodes/gravatar.html index 56e2514..3a1ebcc 100644 --- a/layouts/shortcodes/gravatar.html +++ b/layouts/shortcodes/gravatar.html @@ -1,52 +1,17 @@ -{{/* - * The gravatar shortcode: - * All arguments are optional, main ones are mail and size and have a fallback set in place. - * Args: - * mail: [string] The email address. Falls back to .Site.Params.author_email which should be set in your config file. - * size: [int] The size of the fetched image. Defaults to 200 if not set. - * class: [string] The class to give to the figure block. - * link: [string] The address to link the picture to. - * target: [string] Where to open the link. One of "_blank", "_self", "_parent", "_top". - * caption: [string] Caption text to show with the image. Supports Markdown. - * - * Usage: - * {{< gravatar mail="some@address.com" size=150 class="some class" link="https://example.com" target="_blank" rel="author" caption="Here's a picture of a dog." >}} - * - * Output: - *
- * - *
- *

- * Here's a picture of a dog. - *

- *
- *
- * - */}} +{{- $email := .Get "email" -}} +{{- $size := .Get "size" | default "256" | int -}} +{{- $alt := .Get "alt" | default "User avatar" -}} +{{- $class := .Get "class" | default "w-32 h-32 rounded-full" -}} -{{- $mailhash := $.Site.Params.author_email -}} -{{- if .Get "mail" -}}{{- $mailhash = .Get "mail" -}}{{- end -}} -{{- $hash := $mailhash | lower | md5 -}} - - -{{- if .Get "link" -}} - -{{- end }} - {{ with .Get -{{- if .Get "link" -}} - -{{- end }} -{{- if .Get "caption" -}} -
-

- {{- .Get "caption" | markdownify -}} -

-
-{{- end }} - +{{- if $email -}} + {{- $hash := md5 (strings.TrimSpace (strings.ToLower $email)) -}} + {{- $gravatarURL := printf "https://www.gravatar.com/avatar/%s?s=%d&d=identicon" $hash $size -}} + {{ $alt }} +{{- else -}} + {{- errorf "gravatar shortcode: 'email' parameter is required" -}} +{{- end -}} diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html new file mode 100644 index 0000000..84dec3f --- /dev/null +++ b/layouts/shortcodes/image.html @@ -0,0 +1,23 @@ +{{- $src := .Get "src" -}} +{{- $alt := .Get "alt" | default "Image" -}} +{{- $caption := .Get "caption" -}} +{{- $class := .Get "class" | default "w-full h-auto rounded-lg border border-border" -}} +{{- $link := .Get "link" -}} +{{- $figureClass := .Get "figure-class" -}} + +{{- if or $src .Inner -}} +
+ {{- if .Inner -}} + {{- .Inner -}} + {{- else -}} + {{- if $link -}}{{- end -}} + {{ $alt }} + {{- if $link -}}{{- end -}} + {{- end -}} + {{- if $caption -}} +
{{ $caption }}
+ {{- end -}} +
+{{- else -}} + {{- errorf "image shortcode: 'src' parameter or inner content is required" -}} +{{- end -}} diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html deleted file mode 100644 index fbf96c0..0000000 --- a/layouts/shortcodes/img.html +++ /dev/null @@ -1,84 +0,0 @@ -{{/* - Taken from https://www.brycewray.com/posts/2022/06/responsive-optimized-images-hugo/ -*/}} - -{{- $respSizes := .Site.Params.imageSizes -}} -{{- $src := .Get "src" -}} -{{- $source := resources.Get $src -}} -{{- $alt := .Get "alt" -}} -{{- $divClass := .Get "divClass" -}} -{{/* - The styling in $imgClass, below, makes - an image fill the container horizontally - and adjust its height automatically - for that, and then fade in for the LQIP effect. - Feel free to adjust your CSS/SCSS as desired. -*/}} -{{- $imgClass := "animate-fade" -}} -{{- $dataSzes := "(min-width: 1024px) 100vw, 50vw" -}} -{{/* - Now we'll create the 20-pixel-wide LQIP - and turn it into Base64-encoded data, which - is better for performance and caching. -*/}} -{{- $LQIP_img := $source.Resize "20x jpg" -}} -{{- $LQIP_b64 := $LQIP_img.Content | base64Encode -}} -{{/* - $CFPstyle is for use in styling - the div's background, as you'll see shortly. -*/}} -{{- $CFPstyle := printf "%s%s%s%v%s" "background: url(data:image/jpeg;base64," $LQIP_b64 "); background-size: cover; background-repeat: no-repeat; width: " $source.Width "px;" -}} -{{/* - Then, we create a 640-pixel-wide JPG - of the image. This will serve as the - "fallback" image for that tiny percentage - of browsers that don't understand the - HTML `picture` tag. -*/}} -{{- $actualImg := $source.Resize "640x jpg" -}} -
-{{/* - Now we'll build the `picture` which modern - browsers use to decide which image, and - which format thereof, to show. Remember to - put `webp` first, since the browser will use - the first format it **can** use, and WebP files - usually are smaller. After WebP, the fallback - is the universally safe JPG format. -*/}} - - - - - {{ $alt }} - - -
diff --git a/layouts/shortcodes/quote.html b/layouts/shortcodes/quote.html index 05d0c94..1ed5c3c 100644 --- a/layouts/shortcodes/quote.html +++ b/layouts/shortcodes/quote.html @@ -1,19 +1,15 @@ -
-

- {{.Inner}} -

- {{ if .Get "source" }} - - {{ end }} +{{- $source := .Get "source" -}} +{{- $src := .Get "src" -}} + +
+

{{ .Inner }}

+ {{- if $source -}} +
+ {{- if $src -}} + — {{ $source }} + {{- else -}} + — {{ $source }} + {{- end -}} +
+ {{- end -}}
diff --git a/layouts/shortcodes/strike.html b/layouts/shortcodes/strike.html index 415036a..275b7c1 100644 --- a/layouts/shortcodes/strike.html +++ b/layouts/shortcodes/strike.html @@ -1 +1 @@ -{{ .Inner | markdownify }} +{{ .Inner }} diff --git a/layouts/shortcodes/svg.html b/layouts/shortcodes/svg.html deleted file mode 100644 index d042bb0..0000000 --- a/layouts/shortcodes/svg.html +++ /dev/null @@ -1,5 +0,0 @@ - -{{- $fname := print "SVGs/" ( .Get "name" ) ".svg" -}} -{{ $icon := resources.Get $fname }} -{{ $icon.Content | safeHTML }} - diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html index aa30a13..1e2645d 100644 --- a/layouts/shortcodes/video.html +++ b/layouts/shortcodes/video.html @@ -1,37 +1,37 @@ -{{/* - * The video shortcode: - * All arguments are optional, except for src which is where you define your video file - * This shortcode supports webm, mp4, and other HTML5 video formats. - * Args: - * src: [string] Path to video file (required) - * class: [string] The class(es) to give to the video block. - * width: [int] The width of the video - * height: [int] The height of the video - * autoplay: [bool] true or false for autoplay - defaults to false - * loop: [bool] true or false for loop - defaults to false - * muted: [bool] true or false for mute - defaults to false - * - * Usage: - * {{< video src="my-video.mp4" width=600 height=400 autoplay=true loop=true muted=true class="responsive-video" >}} - * - * Output: - * - * - */}} +{{- $src := .Get "src" -}} +{{- $id := .Get "id" -}} +{{- $title := .Get "title" | default "Video" -}} +{{- $class := .Get "class" | default "" -}} -{{ $ext := (.Get "src") | path.Ext }} -{{ $filetype := slicestr $ext 1}} - - - - +{{- if $id -}} +
+ +
+{{- else if $src -}} + {{- $ext := $src | path.Ext -}} + {{- $filetype := slicestr $ext 1 -}} + {{- $videoURL := $src -}} + {{- $resource := .Page.Resources.GetMatch $src -}} + {{- if $resource -}}{{- $videoURL = $resource.RelPermalink -}}{{- end -}} + +{{- else -}} + {{- errorf "video shortcode: either 'src' or 'id' parameter is required" -}} +{{- end -}} -- cgit v1.2.3