Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thegeeklab/hugo-geekblog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Kaussow <mail@thegeeklab.de>2022-06-27 10:17:27 +0300
committerGitHub <noreply@github.com>2022-06-27 10:17:27 +0300
commit3333560056f3857b24fb45df5c750467e7772018 (patch)
tree194583eae2cfc8fb281078cbff7ab6290f206698 /layouts
parent3b5c9a3a65737a723bf5526cf7d4b79d0937d952 (diff)
fix: fix broken rendering of nested buttons (#266)
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/button.html38
1 files changed, 21 insertions, 17 deletions
diff --git a/layouts/shortcodes/button.html b/layouts/shortcodes/button.html
index db200a4..ff907a0 100644
--- a/layouts/shortcodes/button.html
+++ b/layouts/shortcodes/button.html
@@ -1,25 +1,29 @@
-{{ $ref := "" }}
-{{ $size := default "regular" (.Get "size" | lower) }}
+{{- $ref := "" }}
+{{- $class := "" }}
+{{- $size := default "regular" (.Get "size" | lower) }}
-{{ if not (in (slice "regular" "large") $size) }}
- {{ $size = "regular" }}
-{{ end }}
+{{- if not (in (slice "regular" "large") $size) }}
+ {{- $size = "regular" }}
+{{- end }}
-{{ with .Get "href" }}
- {{ $ref = . }}
-{{ end }}
+{{- with .Get "href" }}
+ {{- $ref = . }}
+{{- end }}
-{{ with .Get "relref" }}
- {{ $ref = relref $ . }}
-{{ end }}
+{{- with .Get "relref" }}
+ {{- $ref = relref $ . }}
+{{- end }}
+{{- with .Get "class" }}
+ {{- $class = . }}
+{{- end }}
-<span
- class="gblog-button gblog-button--{{ $size }}{{ with .Get "class" }}
- {{ printf " %s" . }}
- {{ end }}"
->
- <a {{ with $ref }}href="{{ . }}"{{ end }} class="gblog-button__link">
+
+<span class="gblog-button gblog-button--{{ $size }}{{ with $class }}{{ printf " %s" . }}{{ end }}">
+ <a
+ class="gblog-button__link"
+ {{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }}
+ >
{{ $.Inner }}
</a>
</span>