WIP pages
This commit is contained in:
parent
0b7c8ca989
commit
7678b74b2e
4 changed files with 18 additions and 2 deletions
|
@ -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)
|
||||
|
|
2
doc/templates/entry.html.jinja
vendored
2
doc/templates/entry.html.jinja
vendored
|
@ -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>
|
8
doc/templates/pages/abstract/Page.html.jinja
vendored
Normal file
8
doc/templates/pages/abstract/Page.html.jinja
vendored
Normal 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 />
|
6
doc/templates/pages/abstract/PageWithTitle.html.jinja
vendored
Normal file
6
doc/templates/pages/abstract/PageWithTitle.html.jinja
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{% extends "pages/abstract/Page.html.jinja" %}
|
||||
{% block body %}
|
||||
{% if page.title is not none %}
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
Loading…
Reference in a new issue