2024-03-31 05:38:30 +00:00
|
|
|
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">
|
2024-03-31 10:46:53 +00:00
|
|
|
<nav>
|
2024-03-31 05:38:30 +00:00
|
|
|
<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
|