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
---
body:
Der klassischer Waffelteig ist zu finden auf:
[rezept.yaml](rezept.yaml)
body:
---
pub_date: 2021-07-19
---

View file

@ -56,8 +56,12 @@ notes:
##### flow_notes #####
note: Statt Eier sollte man, wenn möglich, Vollei verwenden
-----
html:
##### flow_notes #####
note: Eier nicht im Orginalkaton lagern
note: Eier möglichst nicht im Orginalkaton lagern
-----
html:
----
substitutions:
#### flow_ingredients ####
@ -82,6 +86,8 @@ notes:
##### flow_notes #####
note: 1l Vollei entspricht 20 Eiern
-----
html:
----
substitutions:
#### flow_ingredients ####
@ -176,6 +182,8 @@ notes:
note:
Backpulver vergrößert das Volumen des Teigs
-----
html: yes
----
substitutions:
#### flow_ingredients ####
@ -200,6 +208,8 @@ notes:
##### flow_notes #####
note: Wenn möglich Frischmilch verwenden
-----
html: no
----
substitutions:
#### flow_ingredients ####
@ -267,6 +277,8 @@ notes:
###### flow_notes ######
note: Alternativ zu Sprudel kann auch fast jedes andere Kohlensäurehaltige Getränk verwendet werden.
------
html:
#### flow_ingredients ####
ingredient: Rum
----
@ -280,6 +292,8 @@ notes:
##### flow_notes #####
note: optional
-----
html: yes
----
substitutions:
#### flow_ingredients ####
@ -382,3 +396,5 @@ notes:
##### flow_notes #####
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
[fields.note]
label = Notiz
label = Notiz zur Zutat
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]
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
[fields.body]
label = Body
label = Rezept Body
description = Freitextfeld für weitere Angaben zum Rezept
type = markdown
[fields.weight]

View file

@ -1,18 +1,5 @@
{%- macro render_rezept_post(post, from_index=false, section_class='-odd') -%}
{{- '\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) -%}
{#-
Render recepie based on open recipe format
@ -29,11 +16,9 @@
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- include "macros/rezept_body.html" -%}
{%- else -%}
{%- include "macros/rezept_body.html" -%}
{%- endif %}
{{- '\n ' -}} <div class="content__box">
{{- '\n ' -}} <div class="content__inner_box">
{{- '\n ' -}} {{- post.body -}}
{{- '\n ' -}} </div>
{{- '\n ' -}} </div>
{{- '\n ' -}} </section>
{%- 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" %}
{% from "macros/rezept.html" import render_rezept_post %}
{%- extends "header_slim.html" -%}
{%- from "macros/rezept.html" import render_rezept_post -%}
{%- block title -%}{{ this.title }}{%- endblock -%}
{%- block meta_description -%}
{%- if this.meta_description is defined and this.meta_description != "" -%}
{{ this.meta_description }}
{{- this.meta_description -}}
{%- else -%}
C3WOC
{%- endif -%}
{%- endblock -%}
{% block body %}
<div class="content__box -heading">
<div class="content__inner_box">
<h1>{{ this.title }}</h1>
</div>
</div>
{{ render_rezept_post(this) }}
{% endblock %}
{%- block body -%}
{{- render_rezept_post(this) -}}
{#-
LINK zu Gesundheitsamt / Hygienehinweise...
-#}
{%- endblock -%}

View file

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