HTML: implement nested ingredients list
This commit is contained in:
parent
10e886d7b6
commit
6c37d85ff6
4 changed files with 34 additions and 13 deletions
|
@ -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>
|
||||
|
|
23
layouts/partials/ingredients_ul.html
Normal file
23
layouts/partials/ingredients_ul.html
Normal 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>
|
|
@ -89,6 +89,11 @@ body {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ingred-portions {
|
||||
text-align: right;
|
||||
font-style: italic;
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in a new issue