<ul> {{- range . }} {{ if isset . "catname" }} </ul> <h2>{{ .catname | markdownify }}</h2> {{ partial "ingredients_ul.html" .ingredients }} <ul> {{ else }} <li> <span class="ingred-qt">{{ with .qt }}{{ . | markdownify }}{{ end }}</span> {{ with .article -}} {{ . | markdownify -}} {{- if substr . -1 1 | eq "'" -}}{{ else }} {{ end -}} {{/* ^^^ No space only if article ends with an apostrophe */}} {{- end -}} <span class="ingred-name">{{ .name | markdownify }}</span> </li> {{ end }} {{ end -}} </ul>