Fix tutorial page template format to match docs pattern
This commit is contained in:
parent
427dfcb669
commit
6acbafc061
|
|
@ -529,13 +529,28 @@ def tutorials():
|
|||
@web_bp.route("/tutorials/<path:path>", endpoint="tutorials_path")
|
||||
def tutorials_path(path: str):
|
||||
from .docs_content import get_doc, get_toc
|
||||
|
||||
doc = get_doc(path)
|
||||
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(
|
||||
"pages/docs.html",
|
||||
page=doc,
|
||||
page=page,
|
||||
toc=get_toc(),
|
||||
current_path=path,
|
||||
prev_page=None,
|
||||
next_page=None,
|
||||
)
|
||||
return render_template(
|
||||
"pages/content.html",
|
||||
|
|
|
|||
Loading…
Reference in New Issue