Also output a 'normal' recipe block
This commit is contained in:
parent
dd9f0f80d3
commit
38a181652a
@ -1,4 +1,4 @@
|
||||
from anytree import LevelOrderGroupIter
|
||||
from anytree import LevelOrderIter, LevelOrderGroupIter
|
||||
from anytree.importer import JsonImporter
|
||||
from sys import argv
|
||||
|
||||
@ -20,7 +20,7 @@ def build_rows_depth_first(node, rows, leaf_count=0):
|
||||
rows[cur_row].append(f'<th>{node.name}</th>')
|
||||
|
||||
if colspan > 1:
|
||||
rows[cur_row].append(f'<td colspan="{colspan-1}"></td>')
|
||||
rows[cur_row].append(f'<td colspan="{colspan-1}" class="filler"></td>')
|
||||
|
||||
leaf_count += 1
|
||||
|
||||
@ -46,6 +46,23 @@ for i in range(len(root.leaves)):
|
||||
|
||||
build_rows_depth_first(root, output_rows)
|
||||
|
||||
print("<h2>Ingredients</h2>")
|
||||
print("<ul>")
|
||||
|
||||
for ingredient in root.leaves:
|
||||
print(f" <li>{ingredient.name}</li>")
|
||||
|
||||
print("</ul>")
|
||||
|
||||
print("<h2>Steps</h2>")
|
||||
print("<ol>")
|
||||
|
||||
tasks = [node for node in LevelOrderIter(root) if not node.is_leaf]
|
||||
for task in reversed(tasks):
|
||||
print(f"<li>{task.description}</li>")
|
||||
|
||||
print("</ol>")
|
||||
|
||||
print("<table cellspacing='0'>")
|
||||
|
||||
for row in output_rows:
|
||||
|
Loading…
x
Reference in New Issue
Block a user