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,
|
||||
ctx: Context,
|
||||
title: str,
|
||||
description: Optional[SafeHTML],
|
||||
source: Optional[SafeHTML],
|
||||
ingredients: List[IngredientInstance],
|
||||
subrecipes: List["Recipe"],
|
||||
|
@ -264,6 +265,7 @@ class Recipe(Element):
|
|||
self.srcpath = ""
|
||||
self.outpath = ""
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.ingredients = ingredients
|
||||
self.subrecipes = subrecipes
|
||||
self.price = price
|
||||
|
@ -328,9 +330,14 @@ class Recipe(Element):
|
|||
if "source" in dct:
|
||||
source = SafeHTML.from_markdown(dct["source"])
|
||||
|
||||
description = None
|
||||
if "description" in dct:
|
||||
description = SafeHTML.from_markdown(dct["description"])
|
||||
|
||||
return cls(
|
||||
ctx=ctx,
|
||||
title=dct["title"],
|
||||
description=description,
|
||||
source=source,
|
||||
ingredients=ingredients,
|
||||
subrecipes=subrecipes,
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"title": { "type": "string" },
|
||||
"description": { "type": "string" },
|
||||
"source": { "type": "string" },
|
||||
"ingredients": {
|
||||
"type": "array",
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
{{getrecipe(subrecipe)}}
|
||||
{% endfor %}
|
||||
<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.ingredients|length != 0 %}
|
||||
<h3>Ingredients</h3>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue