fix button class handling (#444)

This commit is contained in:
Robert Kaussow 2022-06-27 09:14:24 +02:00 committed by GitHub
parent 7286ce085e
commit aa15025ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
{{- $ref := "" }} {{- $ref := "" }}
{{- $target := "" }} {{- $class := "" }}
{{- $size := default "regular" (.Get "size" | lower) }} {{- $size := default "regular" (.Get "size" | lower) }}
{{- if not (in (slice "regular" "large") $size) }} {{- if not (in (slice "regular" "large") $size) }}
@ -8,19 +8,21 @@
{{- with .Get "href" }} {{- with .Get "href" }}
{{- $ref = . }} {{- $ref = . }}
{{- $target = "_blank" }}
{{- end }} {{- end }}
{{- with .Get "relref" }} {{- with .Get "relref" }}
{{- $ref = relref $ . }} {{- $ref = relref $ . }}
{{- end }} {{- 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 <a
class="gdoc-button__link" class="gdoc-button__link"
{{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }} {{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }}
{{- with $target }}{{ printf " target=\"%s\"" . | safeHTMLAttr }}{{ end }}
> >
{{ $.Inner }} {{ $.Inner }}
</a> </a>