Improve HTML Rendering

This commit is contained in:
L3D 2021-08-08 23:35:54 +02:00
parent 4fdc74717f
commit 20b9271cee
Signed by: l3d
GPG key ID: CD08445BFF4313D1
8 changed files with 89 additions and 45 deletions

View file

@ -2,10 +2,7 @@ title: klassischer Waffelteig
--- ---
author: L3D author: L3D
--- ---
body: body:
Der klassischer Waffelteig ist zu finden auf:
[rezept.yaml](rezept.yaml)
--- ---
pub_date: 2021-07-19 pub_date: 2021-07-19
--- ---

View file

@ -56,8 +56,12 @@ notes:
##### flow_notes ##### ##### flow_notes #####
note: Statt Eier sollte man, wenn möglich, Vollei verwenden note: Statt Eier sollte man, wenn möglich, Vollei verwenden
-----
html:
##### flow_notes ##### ##### flow_notes #####
note: Eier nicht im Orginalkaton lagern note: Eier möglichst nicht im Orginalkaton lagern
-----
html:
---- ----
substitutions: substitutions:
#### flow_ingredients #### #### flow_ingredients ####
@ -82,6 +86,8 @@ notes:
##### flow_notes ##### ##### flow_notes #####
note: 1l Vollei entspricht 20 Eiern note: 1l Vollei entspricht 20 Eiern
-----
html:
---- ----
substitutions: substitutions:
#### flow_ingredients #### #### flow_ingredients ####
@ -176,6 +182,8 @@ notes:
note: note:
Backpulver vergrößert das Volumen des Teigs Backpulver vergrößert das Volumen des Teigs
-----
html: yes
---- ----
substitutions: substitutions:
#### flow_ingredients #### #### flow_ingredients ####
@ -200,6 +208,8 @@ notes:
##### flow_notes ##### ##### flow_notes #####
note: Wenn möglich Frischmilch verwenden note: Wenn möglich Frischmilch verwenden
-----
html: no
---- ----
substitutions: substitutions:
#### flow_ingredients #### #### flow_ingredients ####
@ -267,6 +277,8 @@ notes:
###### flow_notes ###### ###### flow_notes ######
note: Alternativ zu Sprudel kann auch fast jedes andere Kohlensäurehaltige Getränk verwendet werden. note: Alternativ zu Sprudel kann auch fast jedes andere Kohlensäurehaltige Getränk verwendet werden.
------
html:
#### flow_ingredients #### #### flow_ingredients ####
ingredient: Rum ingredient: Rum
---- ----
@ -280,6 +292,8 @@ notes:
##### flow_notes ##### ##### flow_notes #####
note: optional note: optional
-----
html: yes
---- ----
substitutions: substitutions:
#### flow_ingredients #### #### flow_ingredients ####
@ -382,3 +396,5 @@ notes:
##### flow_notes ##### ##### flow_notes #####
note: Waffeln optional zB. mit Puderzucker und Apfelmus verzieren. note: Waffeln optional zB. mit Puderzucker und Apfelmus verzieren.
-----
html:

View file

@ -3,5 +3,11 @@ name = Notizen und Details
button_label = Notizen und Details button_label = Notizen und Details
[fields.note] [fields.note]
label = Notiz label = Notiz zur Zutat
type = string type = string
width = 3/4
[fields.html]
type = boolean
width = 1/4
label = hide in HTML version

View file

@ -26,11 +26,12 @@ width = 1/2
[fields.orf] [fields.orf]
label = Render from Open Recepie Format label = Render from Open Recepie Format
description = Render recepie with data from the ORF childpage description = Render recepie with data from the ORF childpage. (create/open childpage and follow instruction for more)
type = boolean type = boolean
[fields.body] [fields.body]
label = Body label = Rezept Body
description = Freitextfeld für weitere Angaben zum Rezept
type = markdown type = markdown
[fields.weight] [fields.weight]

View file

@ -1,18 +1,5 @@
{%- macro render_rezept_post(post, from_index=false, section_class='-odd') -%} {%- macro render_rezept_post(post, from_index=false, section_class='-odd') -%}
{{- '\n ' -}} <section class="content {{ section_class }}"> {{- '\n ' -}} <section class="content {{ section_class }}">
{{- '\n ' -}} <div class="content__box -heading">
{{- '\n ' -}} <div class="content__inner_box">
{%- if from_index -%}
{{- '\n ' -}} <h2><a class="content__blog_link {{ section_class }}" href="{{ post|url }}">{{ post.title }}</a></h2>
{%- else -%}
{{- '\n ' -}} <h2>{{ post.title }}</h2>
{% endif %}
{{- '\n ' -}} <hr class="{{ section_class }}">
{{- '\n ' -}} <p class="content__meta">
{{- '\n ' -}} <i>Ein Waffelrezept von {{ post.author }}</i>
{{- '\n ' -}} </p>
{{- '\n ' -}} </div>
{{- '\n ' -}} </div>
{%- if post.orf | default(false) -%} {%- if post.orf | default(false) -%}
{#- {#-
Render recepie based on open recipe format Render recepie based on open recipe format
@ -29,11 +16,9 @@
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
{%- include "macros/rezept_body.html" -%}
{%- else -%}
{%- include "macros/rezept_body.html" -%}
{%- endif %} {%- endif %}
{{- '\n ' -}} <div class="content__box">
{{- '\n ' -}} <div class="content__inner_box">
{{- '\n ' -}} {{- post.body -}}
{{- '\n ' -}} </div>
{{- '\n ' -}} </div>
{{- '\n ' -}} </section> {{- '\n ' -}} </section>
{%- endmacro -%} {%- endmacro -%}

View file

@ -0,0 +1,10 @@
{#-
Render post.body
-#}
{%- if post.body is defined and post.body != "" -%}
{{- '\n ' -}} <div class="content__box">
{{- '\n ' -}} <div class="content__inner_box">
{{- '\n ' -}} {{- post.body -}}
{{- '\n ' -}} </div>
{{- '\n ' -}} </div>
{%- endif -%}

View file

@ -1,18 +1,18 @@
{% extends "header_slim.html" %} {%- extends "header_slim.html" -%}
{% from "macros/rezept.html" import render_rezept_post %} {%- from "macros/rezept.html" import render_rezept_post -%}
{%- block title -%}{{ this.title }}{%- endblock -%} {%- block title -%}{{ this.title }}{%- endblock -%}
{%- block meta_description -%} {%- block meta_description -%}
{%- if this.meta_description is defined and this.meta_description != "" -%} {%- if this.meta_description is defined and this.meta_description != "" -%}
{{ this.meta_description }} {{- this.meta_description -}}
{%- else -%} {%- else -%}
C3WOC C3WOC
{%- endif -%} {%- endif -%}
{%- endblock -%} {%- endblock -%}
{% block body %} {%- block body -%}
<div class="content__box -heading">
<div class="content__inner_box"> {{- render_rezept_post(this) -}}
<h1>{{ this.title }}</h1>
</div> {#-
</div> LINK zu Gesundheitsamt / Hygienehinweise...
{{ render_rezept_post(this) }} -#}
{% endblock %} {%- endblock -%}

View file

@ -36,16 +36,45 @@
{%- if ing.notes is defined and ing.notes != "" -%} {%- if ing.notes is defined and ing.notes != "" -%}
{%- if ing.notes.blocks != [] -%} {%- if ing.notes.blocks != [] -%}
{%- for nde in ing.notes.blocks -%} {%- for nde in ing.notes.blocks -%}
{%- if loop.index == 1 -%} {%- if not nde.html | default(False) -%}
{{- '\n ' -}} <h3 id="note_{{- ing.ingredient | string -}}">Notiz zu {{ ing.ingredient }}:</h3> {%- if loop.index == 1 -%}
{{- '\n ' -}} <ul> {{- '\n ' -}} <h3 id="note_{{- ing.ingredient | string -}}">Notiz zu {{ ing.ingredient }}:</h3>
{{- '\n ' -}} <ul>
{%- endif -%}
{{- '\n ' -}} <li>
{{- '\n ' -}}
<span class="ingredientnote">{{ nde.note }}</span>
{{- '\n ' -}} </li>
{%- if loop.index == loop.length -%}
{{- '\n ' -}} </ul>
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%}
{%- if ing.substitutions is defined and ing.substitutions != "" -%}
{%- if ing.substitutions.blocks != [] -%}
{%- for alt in ing.substitutions.blocks -%}
{%- if alt.notes is defined and alt.notes != "" -%}
{%- if alt.notes.blocks != [] -%}
{%- for ntz in alt.notes.blocks -%}
{%- if not ntz.html | default(False) -%}
{%- if loop.index == 1 -%}
{{- '\n ' -}} <h3 id="note_{{- alt.ingredient | string -}}">Notiz zu {{ alt.ingredient }}:</h3>
{{- '\n ' -}} <ul>
{%- endif -%}
{{- '\n ' -}} <li>
{{- '\n ' -}}
<span class="ingredientnote">{{ ntz.note }}</span>
{{- '\n ' -}} </li>
{%- if loop.index == loop.length -%}
{{- '\n ' -}} </ul>
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%} {%- endif -%}
{{- '\n ' -}} <li>
{{- '\n ' -}}
<span class="ingredientnote">{{ nde.note }}</span>
{{- '\n ' -}} </li>
{%- endfor -%} {%- endfor -%}
{{- '\n ' -}} </ul>
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}