{{ $ingrRoot := 0 }}
{{- range . }}
{{ if isset . "percent" }}
{{ with .qt }}
{{ $ingrRoot := (int .) }}
{{ end }}
{{ end }}
{{ end -}}
{{- range . }}
{{ if isset . "catname" }}
{{ .catname | markdownify }}
{{- $prevIngrRoot := $ingrRoot -}}
{{ partial "ingredients_ul.html" .ingredients }}
{{- $ingrRot := $prevIngrRoot -}}
{{ else }}
-
{{ with .qt }}{{ . | markdownify }}{{ end }}
{{ with .article -}}
{{ . | markdownify -}}
{{- if substr . -1 1 | eq "'" -}}{{ else }} {{ end -}}
{{/* ^^^ No space only if article ends with an apostrophe */}}
{{- end -}}
{{ .name | markdownify }}
{{ if not eq $ingrRoot.percent 0 -}}
{{ with .qt }}
{{ if not eq . "QS" }}
{{ mul 100 (div . $ingrRoot.percent) }} %
{{ end }}
{{ end }}
{{- end }}
{{ end }}
{{ end -}}