WIP pages

This commit is contained in:
object-Object 2023-07-17 20:31:14 -04:00
parent 0b7c8ca989
commit 7678b74b2e
4 changed files with 18 additions and 2 deletions

View file

@ -38,7 +38,7 @@ def hexdoc_minify(value: str) -> str:
# )
def hexdoc_block(value: Any) -> str:
def hexdoc_block(value: Any, allow_none: bool = False) -> str:
match value:
case LocalizedStr() | str():
lines = str(value).splitlines()
@ -49,5 +49,7 @@ def hexdoc_block(value: Any) -> str:
for child in value.children:
out.write(hexdoc_block(child))
return out.getvalue()
case None if allow_none:
return ""
case _:
raise TypeError(value)

View file

@ -4,7 +4,7 @@
{% call macros.maybe_spoilered(entry) %}
{{ macros.header(entry, "entry-title") }}
{% for page in entry.pages %}
page
{% include "pages/" ~ page.__class__.__name__ ~ ".html.jinja" %}
{% endfor %}
{% endcall %}
</div>

View file

@ -0,0 +1,8 @@
{% if page.anchor %}
<div id="{{ entry.id.path ~ '#' ~ page.anchor }}">
{% block body scoped required %}{% endblock %}
</div>
{% else %}
{% self.body() %}
{% endif %}
<br />

View file

@ -0,0 +1,6 @@
{% extends "pages/abstract/Page.html.jinja" %}
{% block body %}
{% if page.title is not none %}
{% endif %}
{% endblock %}