Fix tutorial page template format to match docs pattern

This commit is contained in:
rob 2026-01-01 05:25:37 -04:00
parent 427dfcb669
commit 6acbafc061
1 changed files with 16 additions and 1 deletions

View File

@ -529,13 +529,28 @@ def tutorials():
@web_bp.route("/tutorials/<path:path>", endpoint="tutorials_path") @web_bp.route("/tutorials/<path:path>", endpoint="tutorials_path")
def tutorials_path(path: str): def tutorials_path(path: str):
from .docs_content import get_doc, get_toc from .docs_content import get_doc, get_toc
doc = get_doc(path) doc = get_doc(path)
if doc: if doc:
# Convert (id, title) tuples to objects with id, text, level attributes
headings = [
SimpleNamespace(id=h[0], text=h[1], level=2)
for h in doc.get("headings", [])
]
page = SimpleNamespace(
title=doc["title"],
description=doc["description"],
content_html=Markup(doc["content"]),
headings=headings,
parent=doc.get("parent"),
)
return render_template( return render_template(
"pages/docs.html", "pages/docs.html",
page=doc, page=page,
toc=get_toc(), toc=get_toc(),
current_path=path, current_path=path,
prev_page=None,
next_page=None,
) )
return render_template( return render_template(
"pages/content.html", "pages/content.html",