44 lines
690 B
Python
44 lines
690 B
Python
|
import config
|
||
|
|
||
|
_navbar = config.navbar.copy()
|
||
|
_navbar.insert(0, ('<strong>' + config.title + '</strong>', {"href": "/"}))
|
||
|
_navbar.append(("tags", {"href": "/tags.html"}))
|
||
|
|
||
|
_navbar_lis = '\n'.join(f"""<li><a {' '.join(
|
||
|
f'{p}="{v}"' for p, v in e[1].items())}>{e[0]}</a></li>"""
|
||
|
for e in _navbar)
|
||
|
|
||
|
_head = f"""
|
||
|
|
||
|
<div class="container">
|
||
|
<nav class="custom-nav">
|
||
|
<ul>
|
||
|
{_navbar_lis}
|
||
|
</ul>
|
||
|
</nav>
|
||
|
|
||
|
"""
|
||
|
|
||
|
_footer = """
|
||
|
<footer>
|
||
|
<a href="#top">^ Return</a>
|
||
|
</footer>
|
||
|
|
||
|
"""
|
||
|
|
||
|
_tail = """
|
||
|
|
||
|
</div>
|
||
|
|
||
|
"""
|
||
|
|
||
|
def mixin_tag(content: str, tag: str) -> str:
|
||
|
return f"""<{tag}>
|
||
|
|
||
|
{content}</{tag}>
|
||
|
|
||
|
"""
|
||
|
|
||
|
def wrap_page(page: str) -> str:
|
||
|
return _head + mixin_tag(page, "main") + _footer + _tail
|