recipe "description" markdown field
This commit is contained in:
parent
238319b9e1
commit
072aa03a53
3 changed files with 9 additions and 0 deletions
|
@ -254,6 +254,7 @@ class Recipe(Element):
|
||||||
self,
|
self,
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
title: str,
|
title: str,
|
||||||
|
description: Optional[SafeHTML],
|
||||||
source: Optional[SafeHTML],
|
source: Optional[SafeHTML],
|
||||||
ingredients: List[IngredientInstance],
|
ingredients: List[IngredientInstance],
|
||||||
subrecipes: List["Recipe"],
|
subrecipes: List["Recipe"],
|
||||||
|
@ -264,6 +265,7 @@ class Recipe(Element):
|
||||||
self.srcpath = ""
|
self.srcpath = ""
|
||||||
self.outpath = ""
|
self.outpath = ""
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.description = description
|
||||||
self.ingredients = ingredients
|
self.ingredients = ingredients
|
||||||
self.subrecipes = subrecipes
|
self.subrecipes = subrecipes
|
||||||
self.price = price
|
self.price = price
|
||||||
|
@ -328,9 +330,14 @@ class Recipe(Element):
|
||||||
if "source" in dct:
|
if "source" in dct:
|
||||||
source = SafeHTML.from_markdown(dct["source"])
|
source = SafeHTML.from_markdown(dct["source"])
|
||||||
|
|
||||||
|
description = None
|
||||||
|
if "description" in dct:
|
||||||
|
description = SafeHTML.from_markdown(dct["description"])
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
ctx=ctx,
|
ctx=ctx,
|
||||||
title=dct["title"],
|
title=dct["title"],
|
||||||
|
description=description,
|
||||||
source=source,
|
source=source,
|
||||||
ingredients=ingredients,
|
ingredients=ingredients,
|
||||||
subrecipes=subrecipes,
|
subrecipes=subrecipes,
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"title": { "type": "string" },
|
"title": { "type": "string" },
|
||||||
|
"description": { "type": "string" },
|
||||||
"source": { "type": "string" },
|
"source": { "type": "string" },
|
||||||
"ingredients": {
|
"ingredients": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
{{getrecipe(subrecipe)}}
|
{{getrecipe(subrecipe)}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h1>{{rec.title}}</h1>
|
<h1>{{rec.title}}</h1>
|
||||||
|
{% if rec.description != None %}<p>{{rec.description.html|safe}}</p>{%endif%}
|
||||||
{% if rec.source != None %}source: {{rec.source.html|safe}}{%endif%}
|
{% if rec.source != None %}source: {{rec.source.html|safe}}{%endif%}
|
||||||
{% if rec.ingredients|length != 0 %}
|
{% if rec.ingredients|length != 0 %}
|
||||||
<h3>Ingredients</h3>
|
<h3>Ingredients</h3>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue