shortcodes: correctly detect empty shortcode content #966
Some checks are pending
docs-build-deployment / Run deploy (push) Waiting to run
docs-build / Run build (push) Waiting to run

This commit is contained in:
Sören Weber 2024-12-09 18:53:02 +01:00
parent 19ea877181
commit bd1f3d3432
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
3 changed files with 3 additions and 3 deletions

View file

@ -8,7 +8,7 @@
{{- $containerclass := .containerclass | default slice | append "box-content" }} {{- $containerclass := .containerclass | default slice | append "box-content" }}
{{- $color := .color | default "" }} {{- $color := .color | default "" }}
{{- $content := trim .content "\n\r\t " }} {{- $content := trim .content "\n\r\t " }}
{{- $hasContent := ne (strings.TrimLeft "<p>" $content) "" }} {{- $hasContent := ne (strings.TrimPrefix "<p>" $content) "" }}
{{- if not (hasPrefix $content "<") }} {{- if not (hasPrefix $content "<") }}
{{- $content = printf "<p>\n%s" $content }} {{- $content = printf "<p>\n%s" $content }}
{{- end }} {{- end }}

View file

@ -17,7 +17,7 @@
{{- with $tab }} {{- with $tab }}
{{- $color := .color | default $color | default "" }} {{- $color := .color | default $color | default "" }}
{{- $content := trim .content "\n\r\t " }} {{- $content := trim .content "\n\r\t " }}
{{- $hasContent := ne (strings.TrimLeft "<p>" $content) "" }} {{- $hasContent := ne (strings.TrimPrefix "<p>" $content) "" }}
{{- if not (hasPrefix $content "<") }} {{- if not (hasPrefix $content "<") }}
{{- $content = printf "<p>\n%s" $content }} {{- $content = printf "<p>\n%s" $content }}
{{- end }} {{- end }}

View file

@ -1 +1 @@
7.2.0+914b5f5a1b1a5c7a7b611276b9c029ee31f1e162 7.2.0+19ea877181e2ca631fdb30e2abf1418d314c25e4