HTML: implement nested ingredients list

This commit is contained in:
Théophile Bastian 2021-01-18 19:18:34 +01:00
rodzic 10e886d7b6
commit 6c37d85ff6
4 zmienionych plików z 34 dodań i 13 usunięć

Wyświetl plik

@ -10,18 +10,8 @@
</div>
{{- end }}
<ul>
{{ range $.Param "ingredients" }}
<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 }}
</ul>
{{ with $.Param "ingredients" -}}
{{ partial "ingredients_ul.html" . }}
{{- end }}
</div>
</div>

Wyświetl plik

@ -0,0 +1,23 @@
<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>

Wyświetl plik

@ -89,6 +89,11 @@ body {
font-weight: bold;
}
h2 {
font-size: 1em;
font-weight: bold;
}
.ingred-portions {
text-align: right;
font-style: italic;

Wyświetl plik

@ -66,6 +66,9 @@ body {
#ingredients .ingred-title {
font-size: 1.3em;
font-weight: bold; }
#ingredients h2 {
font-size: 1em;
font-weight: bold; }
#ingredients .ingred-portions {
text-align: right;
font-style: italic; }