templates: use inheritance
This commit is contained in:
parent
3d3f0b0012
commit
f813ae5ac3
3 changed files with 33 additions and 34 deletions
11
templates/base.html
Normal file
11
templates/base.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>{% block title %}{% endblock %}</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block body %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,14 +1,8 @@
|
||||||
<!DOCTYPE html>
|
{% extends "base.html" %}
|
||||||
<html lang="en">
|
{%block title%}Recipes{%endblock%}
|
||||||
<head>
|
{%block body %}
|
||||||
<title>Recipes</title>
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
|
||||||
<meta charset="utf-8">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Recipes</h1>
|
<h1>Recipes</h1>
|
||||||
{% for recipe in recipes %}
|
{% for recipe in recipes %}
|
||||||
<li><a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
|
<li><a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</body>
|
{%endblock%}
|
||||||
</html>
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
{% macro ingredientpart(ing) -%}
|
{% macro ingredientpart(ing) -%}
|
||||||
{{ing.amount}} {{ing.unit.name}} {{ ing.name }}
|
{{ing.amount}} {{ing.unit.name}} {{ ing.name }}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
@ -9,27 +10,20 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
<!DOCTYPE html>
|
{%block title%}{{recipe.title}}{%endblock%}
|
||||||
<html lang="en">
|
{%block body %}
|
||||||
<head>
|
<a href="index.html">back</a>
|
||||||
<title>{{recipe.title}}</title>
|
<h1>{{recipe.title}}</h1>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
{% for part in recipe.parts %}
|
||||||
<meta charset="utf-8">
|
<h2>{{part.title}}</h2>
|
||||||
</head>
|
<h3>Ingredients</h3>
|
||||||
<body>
|
{% for ing in part.ingredients %}
|
||||||
<a href="index.html">back</a>
|
<li>{{ingredient(ing)}}</li>
|
||||||
<h1>{{recipe.title}}</h1>
|
{% endfor %}
|
||||||
{% for part in recipe.parts %}
|
<h3>Steps</h3>
|
||||||
<h2>{{part.title}}</h2>
|
{% for step in part.steps %}
|
||||||
<h3>Ingredients</h3>
|
<li>{{ step }}</li>
|
||||||
{% for ing in part.ingredients %}
|
{% endfor %}
|
||||||
<li>{{ingredient(ing)}}</li>
|
<hr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h3>Steps</h3>
|
{%endblock%}
|
||||||
{% for step in part.steps %}
|
|
||||||
<li>{{ step }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
<hr>
|
|
||||||
{% endfor %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Add table
Add a link
Reference in a new issue