]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Simplify bugify.html (#33063)
authorXhmikosR <xhmikosr@gmail.com>
Mon, 15 Feb 2021 19:08:44 +0000 (21:08 +0200)
committerGitHub <noreply@github.com>
Mon, 15 Feb 2021 19:08:44 +0000 (21:08 +0200)
* use `in` instead of `strings.Contains` since the latter is not documented
* use `cond`

site/layouts/partials/bugify.html

index 7edacb5d612d8cf34fd29c75e22462828ea11ddd..845cdf7a335f5a635afd49bf265e9c541126b0dc 100644 (file)
@@ -1,12 +1,8 @@
-{{- $words := (split . " ") -}}
+{{- $words := split . " " -}}
 
 {{- range $word := $words -}}
-  {{- if (strings.Contains $word "#") -}}
-    {{- $separator := false -}}
-
-    {{- if (strings.Contains $word ",") -}}
-      {{- $separator = true -}}
-    {{- end -}}
+  {{- if (in $word "#") -}}
+    {{- $has_separator := cond (in $word ",") true false -}}
 
     {{- $data := split $word "#" -}}
     {{- $bug_cat := replace (index $data 0) "\n" "" -}}
@@ -32,7 +28,7 @@
     {{- else if (eq $bug_cat "Normalize") -}}
       <a href="https://github.com/necolas/normalize.css/issues/{{ $bug_id }}">Normalize #{{ $bug_id }}</a>
     {{- end -}}
-    {{- if (eq $separator true) }}, {{ end -}}
+    {{- if $has_separator }}, {{ end -}}
 
   {{- else -}}
     {{- $word -}}