Rename text param to title

This commit is contained in:
mark
2022-12-30 07:28:33 +01:00
parent abb09b91ea
commit 95dba924e3
3 changed files with 14 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
<!--
Displays a button. The shortcode supports the following arguments:
"text" Required text of the button.
"title" Required title of the button.
"href" Required address for the button or hyperlink.
"state" Optional state of the button, either "enabled" (default), "disabled", "active", or "inactive".
"size" Optional size of the button, either "sm", "md" (default), or "lg".
@@ -8,15 +8,15 @@
"danger", "warning", "info", "light", or "dark".
"outline" Optional flag indicating the button should be outlined, either "false" (default) or "true".
"badge" Optional positioned badge to display on top of the button.
"aria-label" Optional label for the badge.
"tooltip" Optional title to display in a tooltip. Ignored for active/inactive buttons.
"aria-label" Optional assistive label for the badge.
"tooltip" Optional text to display in a tooltip. Ignored for active/inactive buttons.
"type" Optional type of the element, either "link" or "button" (default).
"placement" Optional position of the tooltip: "top" (default), "bottom", "left", or "right".
-->
{{ $text := trim .text " \n" -}}
{{ if not $text -}}
{{ errorf "Missing element text" -}}
{{ $title := trim .title " \n" -}}
{{ if not $title -}}
{{ errorf "Missing element title" -}}
{{ end -}}
{{ $state := "enabled" -}}
@@ -81,7 +81,7 @@
{{ if eq $state "active" }}data-bs-toggle="button" aria-pressed="true"{{ end }}
{{ if eq $state "inactive" }}data-bs-toggle="button" aria-pressed="false"{{ end }}
>
{{ $text -}}
{{ $title -}}
{{ with $badge }}
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
{{ . }}

View File

@@ -15,8 +15,8 @@
{{ $error := false }}
{{ $type := "button" -}}
{{ $text := trim .Inner " \n" -}}
{{ if not $text -}}
{{ $title := trim .Inner " \n" -}}
{{ if not $title -}}
{{ errorf "Missing inner element text: %s" .Position -}}
{{ $error = true }}
{{ end -}}
@@ -75,5 +75,5 @@
{{ end -}}
{{ if not $error }}
{{- partial "button.html" (dict "type" $type "text" $text "size" $size "color" $color "outline" $outline "badge" $badge "label" $label "tooltip" $tooltip "href" $href "state" $state "placement" $placement) -}}
{{- partial "button.html" (dict "type" $type "title" $title "size" $size "color" $color "outline" $outline "badge" $badge "label" $label "tooltip" $tooltip "href" $href "state" $state "placement" $placement) -}}
{{ end }}

View File

@@ -2,7 +2,7 @@
Displays a tooltip for a link. The shortcode supports the following arguments:
"color": Optional theme color of the element, either "primary" (default), "secondary", "success",
"danger", "warning", "info", "light", or "dark".
"title" Required title to display in the tooltip.
"title" Required text to display in the tooltip.
"href" Required address for the button or hyperlink.
"placement" Optional position of the tooltip: "top" (default), "bottom", "left", or "right".
-->
@@ -10,8 +10,8 @@
{{ $error := false }}
{{ $type := "link" -}}
{{ $text := trim .Inner " \n" -}}
{{ if not $text -}}
{{ $title := trim .Inner " \n" -}}
{{ if not $title -}}
{{ errorf "Missing inner element text: %s" .Position -}}
{{ $error = true }}
{{ end -}}
@@ -41,5 +41,5 @@
{{ end -}}
{{ if not $error }}
{{- partial "button.html" (dict "type" $type "text" $text "color" $color "tooltip" $tooltip "href" $href "placement" $placement) -}}
{{- partial "button.html" (dict "type" $type "title" $title "color" $color "tooltip" $tooltip "href" $href "placement" $placement) -}}
{{ end }}