From 29674b8426a564a13f2edc691e442ed8cc48069b Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 15 Feb 2021 21:08:44 +0200 Subject: [PATCH] Simplify bugify.html (#33063) * use `in` instead of `strings.Contains` since the latter is not documented * use `cond` --- site/layouts/partials/bugify.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/site/layouts/partials/bugify.html b/site/layouts/partials/bugify.html index 7edacb5d61..845cdf7a33 100644 --- a/site/layouts/partials/bugify.html +++ b/site/layouts/partials/bugify.html @@ -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") -}} Normalize #{{ $bug_id }} {{- end -}} - {{- if (eq $separator true) }}, {{ end -}} + {{- if $has_separator }}, {{ end -}} {{- else -}} {{- $word -}}