HTML: implement nested ingredients list

This commit is contained in:
Théophile Bastian 2021-01-18 19:18:34 +01:00
parent 10e886d7b6
commit 6c37d85ff6
4 changed files with 34 additions and 13 deletions

View file

@ -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>

View file

@ -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>

View file

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

View file

@ -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; }