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

github.com/thegeeklab/hugo-geekdoc.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:14:24 +0300
committerGitHub <noreply@github.com>2022-06-27 10:14:24 +0300
commitaa15025ba0e8de1641a3977ac1fded9fe999c84c (patch)
tree8f019f5baa4cd40418d3c0d6be167454793ecc12
parent7286ce085e6b5432ee8d65175e867c7a469be240 (diff)
fix button class handling (#444)
-rw-r--r--layouts/shortcodes/button.html10
1 files changed, 6 insertions, 4 deletions
diff --git a/layouts/shortcodes/button.html b/layouts/shortcodes/button.html
index fb87840..7c000a3 100644
--- a/layouts/shortcodes/button.html
+++ b/layouts/shortcodes/button.html
@@ -1,5 +1,5 @@
{{- $ref := "" }}
-{{- $target := "" }}
+{{- $class := "" }}
{{- $size := default "regular" (.Get "size" | lower) }}
{{- if not (in (slice "regular" "large") $size) }}
@@ -8,19 +8,21 @@
{{- with .Get "href" }}
{{- $ref = . }}
- {{- $target = "_blank" }}
{{- end }}
{{- with .Get "relref" }}
{{- $ref = relref $ . }}
{{- end }}
+{{- with .Get "class" }}
+ {{- $class = . }}
+{{- end }}
+
-<span class="gdoc-button gdoc-button--{{ $size }}{{ with .Get "class" }}{{ . }}{{ end }}">
+<span class="gdoc-button gdoc-button--{{ $size }}{{ with $class }}{{ printf " %s" . }}{{ end }}">
<a
class="gdoc-button__link"
{{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }}
- {{- with $target }}{{ printf " target=\"%s\"" . | safeHTMLAttr }}{{ end }}
>
{{ $.Inner }}
</a>