diff --git a/templates/zutaten/rezept.html b/templates/zutaten/rezept.html index 0ed4425..24eda36 100644 --- a/templates/zutaten/rezept.html +++ b/templates/zutaten/rezept.html @@ -34,6 +34,16 @@ {%- endif -%} {{- '\n ' -}} {{- '\n ' -}} + {#- + + Render die Notizen und Angaben zur Verarbeitung der Rezepte + + -#} + {%- if child.ingredients is defined and child.ingredients != "" %} + {%- if child.ingredients.blocks != [] -%} + {%- include "zutaten/zutat_notes.html" -%} + {%- endif -%} + {%- endif -%} {#- Nachdem die Zutaten des Rezept nun angegeben sind, diff --git a/templates/zutaten/zutat_einzeln.html b/templates/zutaten/zutat_einzeln.html new file mode 100644 index 0000000..a36c4a4 --- /dev/null +++ b/templates/zutaten/zutat_einzeln.html @@ -0,0 +1,70 @@ +{#- + + Wenn eine Zutat-Menge definiert ist, wird diese im folgenden for loop gerendert. + Sollte es unterschiedliche Teig-Mengen geben, ist die reinfolge der Zutatenmenge relevant. + Wenn also ein Rezept für 2 größen definiert ist, wird für die erste größe die erste Zutat genommen. + Und für die zweite größe die andere. + + ABER, wenn eine der Zutat Null bzw. 0 ist, dann wird diese eine Zutat nicht gerendert. + +-#} +{%- set ingredient_counter = loop.index -%} +{%- for amt in ing.amounts.blocks -%} + {%- if loop.index == prt_loop -%} + {%- if amt.amount is defined and amt.amount != "" and amt.amount != 0 and amt.amount != '0' and amt.amount != 'Null' -%} + {{- '\n ' -}}
  • + {{- '\n ' -}} + {#- + Hier wird eine kurznotiz zur verarbeitung gerendert + oder ein Link zur Verarbeitungsnotiz. + -#} + {%- if ing.processing is defined and ing.processing != "" and ing.processing.blocks is defined and ing.processing.blocks != "" -%} + {%- if ing.processing.blocks != [] -%} + {%- for prc in ing.processing.blocks -%} + {%- if loop.index == 1 -%} + {%- if prc.short|default(False) -%} + {{- ' ' -}} + ({{ prc.process }}) + {%- else -%} + {{- ' ' -}} + (Angaben zur Verarbeitung von {{ ing.ingredient }} beachten) + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- endif -%} + {%- endif -%} + {#- + Render alternativzutat, wenn verfügbar! + -#} + {%- if ing.substitutions is defined and ing.substitutions != "" -%} + {%- if ing.substitutions.blocks is defined and ing.substitutions.blocks != "" -%} + {%- if ing.substitutions.blocks != [] -%} + {%- for sst in ing.substitutions.blocks -%} + {%- if sst.amounts is defined and sst.amounts != "" and sst.amounts.blocks is defined and sst.amounts.blocks != "" -%} + {%- if sst.amounts.blocks != [] -%} + {%- for amt2 in sst.amounts.blocks -%} + {%- if loop.index == prt_loop -%} + {%- if amt2.amount is defined and amt2.amount != "" and amt2.amount != 0 and amt2.amount != '0' -%} + {{- ' ' -}} + {%- endif -%} + {%- endif -%} +{%- endfor -%} + diff --git a/templates/zutaten/zutat_einzeln_ohne_menge.html b/templates/zutaten/zutat_einzeln_ohne_menge.html new file mode 100644 index 0000000..fab1b3d --- /dev/null +++ b/templates/zutaten/zutat_einzeln_ohne_menge.html @@ -0,0 +1,58 @@ +{#- + + Wenn keine Zutat-Menge definiert ist, wird statt dessen + in folgenden Loop nur die Zutat gerendert. + +-#} +{{- '\n ' -}}
  • +{{- '\n ' -}} ({{ prc.process }}) + {%- else -%} + {{- ' ' -}} + (Angaben zur Verarbeitung von {{ ing.ingredient }} beachten) + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- endif -%} +{%- endif -%} +{#- + Render alternativzutat, wenn verfügbar! +-#} +{%- if ing.substitutions is defined and ing.substitutions != "" -%} + {%- if ing.substitutions.blocks is defined and ing.substitutions.blocks != "" -%} + {%- if ing.substitutions.blocks != [] -%} + {%- for sst in ing.substitutions.blocks -%} + {%- if sst.amounts is defined and sst.amounts != "" and sst.amounts.blocks is defined and sst.amounts.blocks != "" -%} + {%- if sst.amounts.blocks != [] -%} + {%- for amt2 in sst.amounts.blocks -%} + {%- if loop.index == prt_loop -%} + {%- if amt2.amount is defined and amt2.amount != "" and amt2.amount != 0 and amt2.amount != '0' -%} + {{- ' ' -}} diff --git a/templates/zutaten/zutat_menge.html b/templates/zutaten/zutat_menge.html index f15fbc6..a62498a 100644 --- a/templates/zutaten/zutat_menge.html +++ b/templates/zutaten/zutat_menge.html @@ -21,68 +21,15 @@ ABER, wenn eine der Zutat Null bzw. 0 ist, dann wird diese eine Zutat nicht gerendert. -#} - {%- set ingredient_counter = loop.index -%} - {%- for amt in ing.amounts.blocks -%} - {%- if loop.index == prt_loop -%} - {%- if amt.amount is defined and amt.amount != "" and amt.amount != 0 and amt.amount != '0' and amt.amount != 'Null' -%} - {{- '\n ' -}}
  • - {{- '\n ' -}} - {#- - Hier wird eine kurznotiz zur verarbeitung gerendert - oder ein Link zur Verarbeitungsnotiz. - -#} - {%- if ing.processing is defined and ing.processing != "" and ing.processing.blocks is defined and ing.processing.blocks != "" -%} - {%- if ing.processing.blocks != [] -%} - {%- for prc in ing.processing.blocks -%} - {%- if loop.index == 1 -%} - {%- if prc.short|default(False) -%} - {{- ' ' -}} - ({{ prc.process }}) - {%- else -%} - {{- ' ' -}} - (Angaben zur Verarbeitung von {{ ing.ingredient }} beachten) - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {%- if ing.substitutions is defined and ing.substitutions != "" -%} - {%- if ing.substitutions.blocks is defined and ing.substitutions.blocks != "" -%} - {%- if ing.substitutions.blocks != [] -%} - {%- for sst in ing.substitutions.blocks -%} - {%- if sst.amounts is defined and sst.amounts != "" and sst.amounts.blocks is defined and sst.amounts.blocks != "" -%} - {%- if sst.amounts.blocks != [] -%} - {%- for amt2 in sst.amounts.blocks -%} - {%- if loop.index == prt_loop -%} - {%- if amt2.amount is defined and amt2.amount != "" and amt2.amount != 0 and amt2.amount != '0' -%} - {{- ' ' -}} - {%- endif -%} - {%- endif -%} - {%- endfor -%} + {%- include "zutaten/zutat_einzeln.html" -%} {%- else -%} {#- - Wenn eine Zutat keine klare Menge hat, wird diese ohne genaue größenangabe gerendert. + Wenn eine Zutat keine klare Menge hat, + wird diese hier ohne genaue größenangabe gerendert. -#} + {%- include "zutaten/zutat_einzeln_ohne_menge.html" -%} {%- endif -%} {%- endif -%} {%- endif -%} diff --git a/templates/zutaten/zutat_notes.html b/templates/zutaten/zutat_notes.html index 8d08df1..26bf02a 100644 --- a/templates/zutaten/zutat_notes.html +++ b/templates/zutaten/zutat_notes.html @@ -1,66 +1,56 @@ - {%- for ing1 in child.ingredients.blocks %} - {%- if ing1.ingredient is defined and ing1.ingredient != "" -%} - {%- if ing1.amounts is defined and ing1.amounts != "" and ing1.amounts.blocks is defined and ing1.amounts.blocks != "" -%} - {%- if ing1.amounts.blocks != [] -%} - {%- set ingredient_counter = loop.index -%} - {%- for amt in ing1.amounts.blocks -%} - {%- if loop.index == prt_loop -%} - {%- if amt.amount is defined and amt.amount != "" and amt.amount != 0 and amt.amount != '0' -%} - {%- if ing1.processing is defined and ing1.processing != "" and ing1.processing.blocks is defined and ing1.processing.blocks != "" -%} - {%- if ing1.processing.blocks != [] -%} - {{- '\n ' -}}
  • - {{- '\n ' -}} - Verarbeitungshinweis - {%- for tmp_prc in ing1.processing.blocks -%} - {%- if loop.index == 2 -%} - {{- 'e' -}} - {%- endif -%} - {%- endfor -%} - {{- ' #' -}} - {{- ingredient_counter | string -}}: - {{- '\n ' -}} -
      - {%- for prc in ing1.processing.blocks -%} - {{- '\n ' -}}
    • - {{- '\n ' -}} - {{ prc.process }} - {{- '\n ' -}}
    • - {%- endfor -%} - {{- '\n ' -}}
    - {{- '\n ' -}}
  • - {{- '\n ' -}} - {%- endif -%} - {%- endif -%} - {%- if ing1.notes is defined and ing1.notes != "" and ing1.notes.blocks is defined and ing1.notes.blocks != "" -%} - {%- if ing1.notes.blocks != [] -%} - {{- '\n ' -}} - {%- endif -%} - {%- endif -%} - {{- '\n ' -}} - {%- endif -%} +{#- + + Render die Notizen und Angaben zur Verarbeitung der Rezepte + +-#} +{%- if child.ingredients is defined and child.ingredients != "" %} + {%- if child.ingredients.blocks != [] -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {{- '\n ' -}}

    Hinweise zu den Zutaten

    + {%- for ing in child.ingredients.blocks %} + {%- if ing.ingredient is defined and ing.ingredient != "" -%} + {#- + Verarbeitungshinweise der Zutat + -#} + {%- if ing.processing is defined and ing.processing != "" -%} + {%- if ing.processing.blocks != [] -%} + {%- for prc in ing.processing.blocks -%} + {%- if not prc.short|default(false) -%} + {%- if loop.index == 1 -%} + {{- '\n ' -}}

    Verarbeitung von {{ ing.ingredient }}:

    + {{- '\n ' -}}
      {%- endif -%} - {%- endfor -%} - {%- endif -%} + {{- '\n ' -}}
    • + {{- '\n ' -}} + {{ prc.process }} + {{- '\n ' -}}
    • + {%- endif -%} + {%- endfor -%} + {{- '\n ' -}}
    {%- endif -%} {%- endif -%} - {%- endfor -%} + {#- + Notiz der Zutat + -#} + {%- if ing.notes is defined and ing.notes != "" -%} + {%- if ing.notes.blocks != [] -%} + {%- for nde in ing.notes.blocks -%} + {%- if loop.index == 1 -%} + {{- '\n ' -}}

    Notiz zu {{ ing.ingredient }}:

    + {{- '\n ' -}}
      + {%- endif -%} + {{- '\n ' -}}
    • + {{- '\n ' -}} + {{ nde.note }} + {{- '\n ' -}}
    • + {%- endfor -%} + {{- '\n ' -}}
    + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {%- endif -%} +{%- endif -%} diff --git a/templates/zutaten/zutaten.html b/templates/zutaten/zutaten.html index 114f50c..99a977f 100644 --- a/templates/zutaten/zutaten.html +++ b/templates/zutaten/zutaten.html @@ -44,24 +44,4 @@ {%- endif -%} - {%- if child.ingredients is defined and child.ingredients != "" %} - {%- if child.ingredients.blocks != [] -%} - {{- '\n ' -}} - {%- else -%} - {{- '\n ' -}} - {%- endif -%} - {%- else -%} - {{- '\n ' -}} - {%- endif -%} {%- endfor -%}