fix: fix broken rendering of nested buttons (#266)

This commit is contained in:
Robert Kaussow 2022-06-27 09:17:27 +02:00 committed by GitHub
parent 3b5c9a3a65
commit 3333560056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>