From 138bea089abdbfbf9f8e5814d6c3f8aab2e6d541 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 31 Jul 2021 18:48:28 +0200 Subject: [PATCH] parts for templates --- .../rezept/klassisch/rezept.yaml/contents.lr | 2 +- templates/macros/rezept.html | 343 +----------------- templates/zutaten.yaml | 149 +------- templates/zutaten/ingredients.yaml | 87 +++++ templates/zutaten/oven.yaml | 28 ++ templates/zutaten/rezept.html | 115 ++++++ templates/zutaten/steps.yaml | 30 ++ templates/zutaten/yields.yaml | 11 + templates/zutaten/zutaten.html | 225 ++++++++++++ 9 files changed, 512 insertions(+), 478 deletions(-) create mode 100644 templates/zutaten/ingredients.yaml create mode 100644 templates/zutaten/oven.yaml create mode 100644 templates/zutaten/rezept.html create mode 100644 templates/zutaten/steps.yaml create mode 100644 templates/zutaten/yields.yaml create mode 100644 templates/zutaten/zutaten.html diff --git a/content/rezept/klassisch/rezept.yaml/contents.lr b/content/rezept/klassisch/rezept.yaml/contents.lr index d743238..37c22c1 100644 --- a/content/rezept/klassisch/rezept.yaml/contents.lr +++ b/content/rezept/klassisch/rezept.yaml/contents.lr @@ -311,7 +311,7 @@ oven_fan: Off --- oven_time: 100s --- -oven_type: waffle iron +oven_type: Waffeleisen --- steps: diff --git a/templates/macros/rezept.html b/templates/macros/rezept.html index ea636a2..ad8171f 100644 --- a/templates/macros/rezept.html +++ b/templates/macros/rezept.html @@ -13,348 +13,21 @@ {{- '\n ' -}}

{{- '\n ' -}} {{- '\n ' -}} - {%- if from_index -%} + {%- if post.orf | default(false) -%} + {#- + Render recepie based on open recipe format + defined in zutaten.yml + -#} {%- for child in post.children -%} {%- if child._template == 'zutaten.yaml' -%} - {{ '\n ' -}}
  • {{ child.recipe_name }}
  • - {%- endif -%} - {%- endfor -%} - {%- else -%} - {%- for child in post.children -%} - {%- if child._template == 'zutaten.yaml' -%} - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {{- '\n ' -}} - {%- if child.recipe_uuid is defined and child.recipe_uuid != "" -%} -

    + {%- if from_index -%} + {{ '\n ' -}}

    {{ child.recipe_name }}

    {%- else -%} -

    - {%- endif -%} - {%- if child.recipe_name and child.recipe_name != "" -%} - {{ child.recipe_name }}

    - {%- else -%} - {{ child.title }} - {%- endif -%} - {%- if child.servings is defined and child.servings != "" -%} - {%- if child.servings.blocks != [] -%} - {%- for prt in child.servings.blocks -%} - {{- '\n ' -}} -

    Portionsgröße: Für {{ prt.serving_number | default('1') }} - {{- ' ' -}} - {%- if prt.serving_units is defined and prt.serving_units != "" -%} - {{- prt.serving_units -}} - {%- else -%} - Stück - {%- endif -%} -

    - {%- set prt_loop = loop.index -%} - {%- if child.ingredients is defined and child.ingredients != "" %} - {%- if child.ingredients.blocks != [] -%} - {{- '\n ' -}}
      - {%- for ing in child.ingredients.blocks %} - {%- if ing.ingredient is defined and ing.ingredient != "" -%} - {%- if ing.amounts is defined and ing.amounts != "" and ing.amounts.blocks is defined and ing.amounts.blocks != "" -%} - {%- if ing.amounts.blocks != [] -%} - {%- 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' -%} - {{- '\n ' -}}
    • - {{- '\n ' -}} - {%- if ing.processing is defined and ing.processing != "" and ing.processing.blocks is defined and ing.processing.blocks != "" -%} - {%- if ing.processing.blocks != [] -%} - {{- ' | ' -}} - Verarbeitungshinweis #{{- ingredient_counter | string -}} - {%- endif -%} - {%- endif -%} - {%- if ing.notes is defined and ing.notes != "" and ing.notes.blocks is defined and ing.notes.blocks != "" -%} - {%- if ing.notes.blocks != [] -%} - {{- ' | ' -}} - Notiz #{{- ingredient_counter | string -}} - {{- '\n ' -}} - {%- endif -%} - {%- endif -%} - {%- if ing.substitutions is defined and ing.substitutions != "" -%} - {%- if ing.substitutions.blocks is defined and ing.substitutions.blocks != "" -%} - {%- if ing.substitutions.blocks != [] -%} - {{- '\n ' -}}
        - {{- '\n ' -}}
      • - {{- '\n ' -}} Ausweichmöglichkeit: - {{- '\n ' -}}
          - {%- 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' -%} - {{- '\n ' -}}
        • - {{- '\n ' -}} - {%- if sst.processing is defined and sst.processing != "" and sst.processing.blocks is defined and sst.processing.blocks != "" -%} - {%- if sst.processing.blocks != [] -%} - {{- '\n ' -}}
            - {{- '\n ' -}}
          • - {{- '\n ' -}} - Verarbeitungshinweis - {%- for tmp_prc2 in sst.processing.blocks -%} - {%- if loop.index == 2 -%} - {{- 'e' -}} - {%- endif -%} - {%- endfor -%} - : - {{- '\n ' -}} -
              - {%- for prc2 in sst.processing.blocks -%} - {{- '\n ' -}}
            • - {{- '\n ' -}} - {{ prc2.process }} - {{- '\n ' -}}
            • - {%- endfor -%} - {{- '\n ' -}}
            - {{- '\n ' -}}
          • - {{- '\n ' -}}
          - {%- endif -%} - {%- endif -%} - {%- if sst.notes is defined and sst.notes != "" and sst.notes.blocks is defined and sst.notes.blocks != "" -%} - {%- if ing.notes.blocks != [] -%} - {{- '\n ' -}}
            - {{- '\n ' -}}
          • - {{- '\n ' -}} - Notiz - {%- for tmp_nde1 in sst.notes.blocks -%} - {%- if loop.index == 2 -%} - {{- 'en' -}} - {%- endif -%} - {%- endfor -%} - : - {{- '\n ' -}} -
              - {%- for nde2 in sst.notes.blocks -%} - {{- '\n ' -}}
            • - {{- '\n ' -}} - {{ nde2.note }} - {{- '\n ' -}}
            • - {%- endfor -%} - {{- '\n ' -}}
            - {{- '\n ' -}}
          • - {{- '\n ' -}}
          - {%- endif -%} - {%- endif -%} - {{- '\n ' -}}
        • - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {{- '\n ' -}}
        - {{- '\n ' -}}
      • - {{- '\n ' -}}
      - {%- endif -%} - {%- endif -%} - {%- endif -%} - {{- '\n ' -}}
    • - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {{- '\n ' -}}
    - {%- else -%} - {{- '\n ' -}}
      - {{- '\n ' -}} Keine Zutaten definiert - {{- '\n ' -}}
    - {%- endif -%} - {%- else -%} - {{- '\n ' -}}
      - {{- '\n ' -}} Keine Zutaten definiert - {{- '\n ' -}}
    - {%- endif -%} + {%- include "zutaten/rezept.html" -%} - - - {%- if child.ingredients is defined and child.ingredients != "" %} - {%- if child.ingredients.blocks != [] -%} - {{- '\n ' -}}
      - {%- 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 ' -}}
      - {{- '\n ' -}}
    • - {{- '\n ' -}} - Notiz - {%- for tmp_nde in ing1.notes.blocks -%} - {%- if loop.index == 2 -%} - {{- 'en' -}} - {%- endif -%} - {%- endfor -%} - {{- ' #' -}} {{- ingredient_counter | string -}}: - {{- '\n ' -}} -
        - {%- for nde in ing1.notes.blocks -%} - {{- '\n ' -}}
      • - {{- '\n ' -}} - {{ nde.note }} - {{- '\n ' -}}
      • - {%- endfor -%} - {{- '\n ' -}}
      - {{- '\n ' -}}
    • - {{- '\n ' -}}
    - {%- endif -%} - {%- endif -%} - {{- '\n ' -}} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {{- '\n ' -}} - {%- else -%} - {{- '\n ' -}}
      - {{- '\n ' -}} Keine Zutaten definiert - {{- '\n ' -}}
    - {%- endif -%} - {%- else -%} - {{- '\n ' -}}
      - {{- '\n ' -}} Keine Zutaten definiert - {{- '\n ' -}}
    - {%- endif -%} - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {%- endif -%} - {#- - - Rezept Schritte... - - -#} - {%- if child.steps is defined and child.steps.blocks is defined and child.steps != "" -%} - {%- if child.steps.blocks is defined and child.steps.blocks != "" and child.steps.blocks != [] -%} - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {{- '\n ' -}}

    Zubereitung

    - {{- '\n ' -}}
      - {%- for stp in child.steps.blocks -%} - {%- if stp.step is defined and stp.step != "" -%} - {{- '\n ' -}}
    • - {{- '\n ' -}} {{ stp.step }} - {%- if stp.haccp_type is defined and stp.haccp_type != "" and stp.haccp_string is defined and stp.haccp_string != "" -%} - {{- '\n ' -}}
        - {{- '\n ' -}}
      • - {{- '\n ' -}}{{ stp.haccp_string }} - {{- '\n ' -}}
      • - {{- '\n ' -}}
      - {%- endif %} - {%- if stp.notes is defined and stp.notes != "" and stp.notes.blocks is defined %} - {%- if stp.notes.blocks != [] -%} - {{- '\n ' -}}
        - {%- for nde in stp.notes.blocks -%} - {{- '\n ' -}}
      • - {{- '\n ' -}} {{- nde.note -}} - {{- '\n ' -}}
      • - {%- endfor -%} - {{- '\n ' -}}
      - {%- endif -%} - {%- endif -%} - {{- '\n ' -}}
    • - {%- endif %} - {%- endfor -%} - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {%- endif -%} - {%- endif -%} - - {%- if child.oven is defined and child.oven != "" and child.oven.blocks or - child.oven_type is defined and child.oven_type != "" or - child.oven_time is defined and child.oven_time != "" -%} - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {{- '\n ' -}}

    Backhinweise

    - {{- '\n ' -}}
      - {%- if child.oven is defined and child.oven != "" and child.oven.blocks is defined and child.oven.blocks != "" -%} - {% if child.oven.blocks is defined and child.oven.blocks != [] -%} - {%- for ovn in child.oven.blocks -%} - {%- if ovn.amount is defined and ovn.amount != "" -%} - {{- '\n ' -}}
    • - {{- '\n ' -}} Ofentemperatur: {{ ovn.amount }} {{ ovn.unit | default('C') }} - {{- '\n ' -}}
    • - {%- endif -%} - {%- endfor -%} {%- endif -%} {%- endif -%} - {%- if child.oven_type is defined and child.oven_type != "" -%} - {{- '\n ' -}}
    • - {{- '\n ' -}} Ofentype: {{ child.oven_type }} - {{- '\n ' -}}
    • - {%- endif -%} - {%- if child.oven_time is defined and child.oven_time != "" -%} - {{- '\n ' -}}
    • - {{- '\n ' -}} Backzeit: {{ child.oven_time }} - {{- '\n ' -}}
    • - {%- endif -%} - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {{- '\n ' -}}
    - {%- endif -%} - - {#- - {%- if child.source_authors is defined and child.source_authors != "" -%} - {{ '\n \n source_authors:'}} "{{ child.source_authors }}" - {%- endif -%} - {%- if child.x_license is defined and child.x_license != "" -%} - {{ '\n X-License:' }} "{{ child.x_license }}" - {%- endif -%} - {{ '\n source_url:' }} "{{ '../'|url(external=true) }}" - -#} - {#- source: "https://open-recipe-format.readthedocs.io/en/latest/topics/tutorials/walkthrough.html" -#} - {%- endfor -%} {%- endif %} {{- '\n ' -}}
    diff --git a/templates/zutaten.yaml b/templates/zutaten.yaml index e6335e9..b924372 100644 --- a/templates/zutaten.yaml +++ b/templates/zutaten.yaml @@ -17,151 +17,16 @@ usda_lookup: "https://fdc.nal.usda.gov/fdc-app.html" -#} {%- else -%} recipe_name: "{{ this.title }}" {%- endif -%} -{%- if this.recipe_uuid is defined and this.recipe_uuid != "" -%} - {{ '\nrecipe_uuid:' }} "{{ this.recipe_uuid }}" -{%- endif -%} -{%- if this.servings is defined and this.servings != "" -%} - {%- for prt in this.servings.blocks -%} - {%- if loop.index == 1 -%} - {{ '\nyields:' }} - {%- endif -%} - {{ '\n - servings:' }} {{ prt.serving_number | default('1') }} - {%- endfor -%} -{%- endif -%} -{%- if this.ingredients is defined and this.ingredients != "" %} - {{ '\ningredients:' }} - {%- for ing in this.ingredients.blocks %} - {%- if ing.ingredient is defined and ing.ingredient != "" -%} - {{ '\n -' }} "{{ ing.ingredient | lower }}": - {%- if ing.amounts is defined and ing.amounts != "" and ing.amounts.blocks is defined and ing.amounts.blocks != "" -%} - {{ '\n amounts:' }} - {%- if ing.amounts.blocks == [] -%} - {{ ' []' }} - {%- else -%} - {%- for amt in ing.amounts.blocks -%} - {{ '\n - amount:' }} "{{ amt.amount }}" - {{- '\n unit:' }} "{{ amt.unit | default('each') }}" - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {%- if ing.processing is defined and ing.processing != "" and ing.processing.blocks is defined and ing.processing.blocks != "" -%} - {%- for prc in ing.processing.blocks -%} - {%- if loop.index == 1 -%} - {{ '\n processing:' }} - {%- endif -%} - {{ '\n -' }} "{{ prc.process }}" - {%- endfor -%} - {%- endif -%} - {%- if ing.notes is defined and ing.notes != "" and ing.notes.blocks is defined and ing.notes.blocks != "" -%} - {%- for nde in ing.notes.blocks -%} - {%- if loop.index == 1 -%} - {{ '\n notes:' }} - {%- endif -%} - {{ '\n -' }} "{{ nde.note }}" - {%- endfor -%} - {%- endif -%} - {%- if ing.usda_num is defined and ing.usda_num != "" -%} - {{ '\n usda_num:' }} {{ ing.usda_num }} - {%- 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 loop.index == 1 -%} - {{ '\n substitutions:' }} - {%- endif -%} - {{ '\n -' }} "{{ sst.ingredient | lower }}" - {%- if sst.amounts is defined and sst.amounts != "" and sst.amounts.blocks is defined and sst.amounts.blocks != "" -%} - {{ '\n amounts:' }} - {%- if sst.amounts.blocks == [] -%} - {{ ' []' }} - {%- else -%} - {%- for amt2 in sst.amounts.blocks -%} - {{ '\n - amount:' }} "{{ amt2.amount }}" - {{- '\n unit:' }} "{{ amt2.unit | default('each') }}" - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {%- if sst.usda_num is defined and sst.usda_num != "" -%} - {{ '\n usda_num:' }} {{ sst.usda_num }} - {%- endif -%} - {%- if sst.processing is defined and sst.processing != "" and sst.processing.blocks is defined and sst.processing.blocks != "" -%} - {%- for prc2 in sst.processing.blocks -%} - {%- if loop.index == 1 -%} - {{ '\n processing:' }} - {%- endif -%} - {{ '\n -' }} "{{ prc2.process }}" - {%- endfor -%} - {%- endif -%} - {%- if sst.notes is defined and sst.notes != "" and sst.notes.blocks is defined and sst.notes.blocks != "" -%} - {%- for nde2 in sst.notes.blocks -%} - {%- if loop.index == 1 -%} - {{ '\n notes:' }} - {%- endif -%} - {{ '\n -' }} "{{ nde2.note }}" - {%- endfor -%} - {%- endif -%} - {%- endfor -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} -{%- else -%} - {{ '\ningredients: []' }} -{%- endif -%} +{{- '\nrecipe_uuid: ' -}} "{{ this._gid }}" -{%- if this.steps is defined and this.steps.blocks is defined and this.steps != "" -%} - {%- if this.steps.blocks is defined and this.steps.blocks != "" and this.steps.blocks != [] -%} - {{ '\n\nsteps:' }} - {%- for stp in this.steps.blocks -%} - {%- if stp.step is defined and stp.step != "" -%} - {{ '\n - step:' }} "{{ stp.step }}" - {%- if stp.haccp_type is defined and stp.haccp_type != "" and stp.haccp_string is defined and stp.haccp_string != "" -%} - {{ '\n haccp:' }} - {{- '\n '}}{{ stp.haccp_type|lower }}: "{{ stp.haccp_string }}" - {%- endif %} - {%- if stp.notes is defined and stp.notes != "" and stp.notes.blocks is defined %} - {%- for nde in stp.notes.blocks %} - {%- if loop.index == 1 -%} - {{ '\n notes:' }} - {%- endif -%} - {{ '\n -' }} "{{ nde.note }}" - {%- endfor %} - {%- endif %} - {%- endif %} - {%- endfor -%} - {{ '\n' }} - {%- else -%} - {{ '\nsteps: []' }} - {%- endif -%} -{%- else -%} - {{ '\n\nsteps: []' }} -{%- endif -%} +{%- include "zutaten/yields.yaml" -%} -{%- if this.oven is defined and this.oven != "" and this.oven.blocks is defined and this.oven.blocks != "" -%} - {% if this.oven.blocks is defined and this.oven.blocks != [] -%} - {%- for ovn in this.oven.blocks -%} - {%- if ovn.amount is defined and ovn.amount != "" -%} - {%- if loop.index == 1 -%} - {{ '\noven_temp:' }} - {%- endif -%} - {{ '\n - amount:' }} {{ ovn.amount }} - {{- '\n unit:' }} {{ ovn.unit | default('C') }} - {%- endif -%} - {%- endfor -%} - {%- endif -%} -{%- endif -%} -{%- if this.oven_type is defined and this.oven_type != "" -%} - {{ '\nX-oven_type:' }} "{{ this.oven_type }}" -{%- endif -%} -{%- if this.oven_time is defined and this.oven_time != "" -%} - {{ '\noven_time:' }} "{{ this.oven_time }}" -{%- endif -%} -{%- if this.oven_fan is defined and this.oven_fan != "" -%} - {{ '\noven_fan:' }} "{{ this.oven_fan | default('Off') }}" -{%- endif -%} +{%- include "zutaten/ingredients.yaml" -%} + +{%- include "zutaten/steps.yaml" -%} + +{%- include "zutaten/oven.yaml" -%} {%- if this.source_authors is defined and this.source_authors != "" -%} {{ '\n\nsource_authors:'}} "{{ this.source_authors }}" diff --git a/templates/zutaten/ingredients.yaml b/templates/zutaten/ingredients.yaml new file mode 100644 index 0000000..4ef858b --- /dev/null +++ b/templates/zutaten/ingredients.yaml @@ -0,0 +1,87 @@ +{#- + Recepie incredient collection / for loop +-#} + +{%- if this.ingredients is defined and this.ingredients != "" %} + {{- '\ningredients:' -}} + {%- for ing in this.ingredients.blocks | default('[]') %} + {%- if ing.ingredient is defined and ing.ingredient != "" -%} + {{- '\n - ' -}} "{{- ing.ingredient | lower -}}": + {%- if ing.amounts is defined and ing.amounts != "" and ing.amounts.blocks is defined and ing.amounts.blocks != "" -%} + {{- '\n amounts:' -}} + {%- if ing.amounts.blocks == [] -%} + {{- ' []' -}} + {%- else -%} + {%- for amt in ing.amounts.blocks -%} + {{- '\n - amount: ' -}} "{{ amt.amount }}" + {{- '\n unit: ' -}} "{{ amt.unit | default('each') }}" + {%- endfor -%} + {%- endif -%} + {%- endif -%} + {%- if ing.processing is defined and ing.processing != "" and ing.processing.blocks is defined and ing.processing.blocks != "" -%} + {%- for prc in ing.processing.blocks -%} + {%- if loop.index == 1 -%} + {{- '\n processing:' -}} + {%- endif -%} + {{- '\n - ' -}} "{{ prc.process }}" + {%- endfor -%} + {%- endif -%} + {%- if ing.notes is defined and ing.notes != "" and ing.notes.blocks is defined and ing.notes.blocks != "" -%} + {%- for nde in ing.notes.blocks -%} + {%- if loop.index == 1 -%} + {{- '\n notes:' -}} + {%- endif -%} + {{- '\n - ' -}} "{{ nde.note }}" + {%- endfor -%} + {%- endif -%} + {%- if ing.usda_num is defined and ing.usda_num != "" -%} + {{- '\n usda_num: ' -}} {{- ing.usda_num -}} + {%- 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 loop.index == 1 -%} + {{- '\n substitutions:' -}} + {%- endif -%} + {{- '\n - ' -}} "{{- sst.ingredient | lower -}}" + {%- if sst.amounts is defined and sst.amounts != "" and sst.amounts.blocks is defined and sst.amounts.blocks != "" -%} + {{- '\n amounts:' -}} + {%- if sst.amounts.blocks == [] -%} + {{- ' []' -}} + {%- else -%} + {%- for amt2 in sst.amounts.blocks -%} + {{- '\n - amount:' -}} "{{ amt2.amount }}" + {{- '\n unit:' -}} "{{ amt2.unit | default('each') }}" + {%- endfor -%} + {%- endif -%} + {%- endif -%} + {%- if sst.usda_num is defined and sst.usda_num != "" -%} + {{- '\n usda_num: ' -}} {{- sst.usda_num -}} + {%- endif -%} + {%- if sst.processing is defined and sst.processing != "" and sst.processing.blocks is defined and sst.processing.blocks != "" -%} + {%- for prc2 in sst.processing.blocks -%} + {%- if loop.index == 1 -%} + {{- '\n processing:' -}} + {%- endif -%} + {{- '\n - ' -}} "{{ prc2.process }}" + {%- endfor -%} + {%- endif -%} + {%- if sst.notes is defined and sst.notes != "" and sst.notes.blocks is defined and sst.notes.blocks != "" -%} + {%- for nde2 in sst.notes.blocks -%} + {%- if loop.index == 1 -%} + {{- '\n notes:' -}} + {%- endif -%} + {{- '\n - ' -}} "{{ nde2.note }}" + {%- endfor -%} + {%- endif -%} + {%- endfor -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} +{%- else -%} + {{- '\ningredients: []' -}} +{%- endif -%} + diff --git a/templates/zutaten/oven.yaml b/templates/zutaten/oven.yaml new file mode 100644 index 0000000..1b03646 --- /dev/null +++ b/templates/zutaten/oven.yaml @@ -0,0 +1,28 @@ +{#- + Oven informations +-#} +{%- if this.oven is defined and this.oven != "" and this.oven.blocks is defined and this.oven.blocks != "" -%} + {% if this.oven.blocks is defined and this.oven.blocks != [] -%} + {%- for ovn in this.oven.blocks -%} + {%- if ovn.amount is defined and ovn.amount != "" -%} + {%- if loop.index == 1 -%} + {{- '\noven_temp:' -}} + {%- endif -%} + {{- '\n - amount: ' -}} '{{- ovn.amount -}}' + {{- '\n unit: ' -}} {{- ovn.unit | default('C') -}} + {%- endif -%} + {%- endfor -%} + {%- endif -%} +{%- endif -%} + +{%- if this.oven_type is defined and this.oven_type != "" -%} + {{- '\nX-oven_type: ' -}} "{{- this.oven_type -}}" +{%- endif -%} + +{%- if this.oven_time is defined and this.oven_time != "" -%} + {{- '\noven_time: ' -}} "{{- this.oven_time -}}" +{%- endif -%} + +{%- if this.oven_fan is defined and this.oven_fan != "" -%} + {{- '\noven_fan: ' -}} "{{- this.oven_fan | default('Off') -}}" +{%- endif -%} diff --git a/templates/zutaten/rezept.html b/templates/zutaten/rezept.html new file mode 100644 index 0000000..c4c20c8 --- /dev/null +++ b/templates/zutaten/rezept.html @@ -0,0 +1,115 @@ +{#- + HTML Rendering des Rezept aus dem zutaten.yaml template + für die Detailseite des Rezepts. +-#} + +{%- for child in post.children -%} + {%- if child._template == 'zutaten.yaml' -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {{- '\n ' -}} + {%- if child.recipe_uuid is defined and child.recipe_uuid != "" -%} +

    + {%- else -%} +

    + {%- endif -%} + {%- if child.recipe_name and child.recipe_name != "" -%} + {{ child.recipe_name }}

    + {%- else -%} + {{ child.title }} + {%- endif -%} + {%- if child.servings is defined and child.servings != "" -%} + {%- if child.servings.blocks != [] -%} + {%- include "zutaten/zutaten.html" -%} + {%- endif -%} + {%- endif -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {%- endif -%} +{#- + + Rezept Schritte... + +-#} +{%- if child.steps is defined and child.steps.blocks is defined and child.steps != "" -%} + {%- if child.steps.blocks is defined and child.steps.blocks != "" and child.steps.blocks != [] -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {{- '\n ' -}}

    Zubereitung

    + {{- '\n ' -}}
      + {%- for stp in child.steps.blocks -%} + {%- if stp.step is defined and stp.step != "" -%} + {{- '\n ' -}}
    • + {{- '\n ' -}} {{ stp.step }} + {%- if stp.haccp_type is defined and stp.haccp_type != "" and stp.haccp_string is defined and stp.haccp_string != "" -%} + {{- '\n ' -}}
        + {{- '\n ' -}}
      • + {{- '\n ' -}}{{ stp.haccp_string }} + {{- '\n ' -}}
      • + {{- '\n ' -}}
      + {%- endif %} + {%- if stp.notes is defined and stp.notes != "" and stp.notes.blocks is defined %} + {%- if stp.notes.blocks != [] -%} + {{- '\n ' -}}
        + {%- for nde in stp.notes.blocks -%} + {{- '\n ' -}}
      • + {{- '\n ' -}} {{- nde.note -}} + {{- '\n ' -}}
      • + {%- endfor -%} + {{- '\n ' -}}
      + {%- endif -%} + {%- endif -%} + {{- '\n ' -}}
    • + {%- endif %} + {%- endfor -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {%- endif -%} +{%- endif -%} + +{%- if child.oven is defined and child.oven != "" and child.oven.blocks or + child.oven_type is defined and child.oven_type != "" or + child.oven_time is defined and child.oven_time != "" -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {{- '\n ' -}}

    Backhinweise

    + {{- '\n ' -}}
      + {%- if child.oven is defined and child.oven != "" and child.oven.blocks is defined and child.oven.blocks != "" -%} + {% if child.oven.blocks is defined and child.oven.blocks != [] -%} + {%- for ovn in child.oven.blocks -%} + {%- if ovn.amount is defined and ovn.amount != "" -%} + {{- '\n ' -}}
    • + {{- '\n ' -}} Ofentemperatur: {{ ovn.amount }} {{ ovn.unit | default('C') }} + {{- '\n ' -}}
    • + {%- endif -%} + {%- endfor -%} + {%- endif -%} + {%- endif -%} + {%- if child.oven_type is defined and child.oven_type != "" -%} + {{- '\n ' -}}
    • + {{- '\n ' -}} Ofentype: {{ child.oven_type }} + {{- '\n ' -}}
    • + {%- endif -%} + {%- if child.oven_time is defined and child.oven_time != "" -%} + {{- '\n ' -}}
    • + {{- '\n ' -}} Backzeit: {{ child.oven_time }} + {{- '\n ' -}}
    • + {%- endif -%} + {{- '\n ' -}}
    + {{- '\n ' -}}
    + {{- '\n ' -}}
    +{%- endif -%} + +{#- + {%- if child.source_authors is defined and child.source_authors != "" -%} + {{ '\n \n source_authors:'}} "{{ child.source_authors }}" + {%- endif -%} + {%- if child.x_license is defined and child.x_license != "" -%} + {{ '\n X-License:' }} "{{ child.x_license }}" + {%- endif -%} + {{ '\n source_url:' }} "{{ '../'|url(external=true) }}" +-#} + {#- source: "https://open-recipe-format.readthedocs.io/en/latest/topics/tutorials/walkthrough.html" -#} + +{%- endfor -%} diff --git a/templates/zutaten/steps.yaml b/templates/zutaten/steps.yaml new file mode 100644 index 0000000..eb80d09 --- /dev/null +++ b/templates/zutaten/steps.yaml @@ -0,0 +1,30 @@ +{#- + Recipe Steps for loop +-#} +{%- if this.steps is defined and this.steps.blocks is defined and this.steps != "" -%} + {%- if this.steps.blocks is defined and this.steps.blocks != "" and this.steps.blocks != [] -%} + {{- '\n\nsteps:' -}} + {%- for stp in this.steps.blocks -%} + {%- if stp.step is defined and stp.step != "" -%} + {{- '\n - step: ' -}} "{{- stp.step -}}" + {%- if stp.haccp_type is defined and stp.haccp_type != "" and stp.haccp_string is defined and stp.haccp_string != "" -%} + {{- '\n haccp:' -}} + {{- '\n ' -}} {{- stp.haccp_type|lower -}}: "{{- stp.haccp_string -}}" + {%- endif %} + {%- if stp.notes is defined and stp.notes != "" and stp.notes.blocks is defined %} + {%- for nde in stp.notes.blocks %} + {%- if loop.index == 1 -%} + {{- '\n notes:' -}} + {%- endif -%} + {{- '\n - ' -}} "{{ nde.note }}" + {%- endfor %} + {%- endif %} + {%- endif %} + {%- endfor -%} + {{- '\n' -}} + {%- else -%} + {{- '\nsteps: []' -}} + {%- endif -%} +{%- else -%} + {{- '\n\nsteps: []' -}} +{%- endif -%} diff --git a/templates/zutaten/yields.yaml b/templates/zutaten/yields.yaml new file mode 100644 index 0000000..dab962f --- /dev/null +++ b/templates/zutaten/yields.yaml @@ -0,0 +1,11 @@ +{#- + Template to collect yields for the recipe,yml +-#} +{%- if this.servings is defined and this.servings != "" -%} + {%- for prt in this.servings.blocks -%} + {%- if loop.index == 1 -%} + {{ '\nyields:' }} + {%- endif -%} + {{ '\n - servings:' }} {{ prt.serving_number | default('1') }} + {%- endfor -%} +{%- endif -%} diff --git a/templates/zutaten/zutaten.html b/templates/zutaten/zutaten.html new file mode 100644 index 0000000..a85f71e --- /dev/null +++ b/templates/zutaten/zutaten.html @@ -0,0 +1,225 @@ +{%- for prt in child.servings.blocks -%} + {{- '\n ' -}} +

    Portionsgröße: Für {{ prt.serving_number | default('1') }} + {{- ' ' -}} + {%- if prt.serving_units is defined and prt.serving_units != "" -%} + {{- prt.serving_units -}} + {%- else -%} + Stück + {%- endif -%} +

    + {%- set prt_loop = loop.index -%} + {%- if child.ingredients is defined and child.ingredients != "" %} + {%- if child.ingredients.blocks != [] -%} + {{- '\n ' -}} + {%- else -%} + {{- '\n ' -}} + {%- endif -%} + {%- else -%} + {{- '\n ' -}} + {%- endif -%} + + + {%- if child.ingredients is defined and child.ingredients != "" %} + {%- if child.ingredients.blocks != [] -%} + {{- '\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 -%} + {%- endif -%} + {%- endfor -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {{- '\n ' -}} + {%- else -%} + {{- '\n ' -}} + {%- endif -%} + {%- else -%} + {{- '\n ' -}} + {%- endif -%} +{%- endfor -%}