main
Thomas Sileo 2022-07-04 19:02:06 +02:00
parent fbaf40a6ac
commit ed0a780d7e
5 changed files with 136 additions and 0 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
__pycache__/
.mypy_cache/
.pytest_cache/
docs/dist/
requirements.txt

View File

@ -1,6 +1,7 @@
# microblog.pub
[![builds.sr.ht status](https://builds.sr.ht/~tsileo/microblog.pub.svg)](https://builds.sr.ht/~tsileo/microblog.pub?)
[![AGPL 3.0](https://img.shields.io/badge/license-AGPL_3.0-blue.svg?style=flat)](https://git.sr.ht/~tsileo/microblog.pub/tree/v2/item/LICENSE)
This branch is a complete rewrite of the original microblog.pub server.

83
docs/templates/layout.html vendored 100644
View File

@ -0,0 +1,83 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>microblog.pub - A self-hosted, single-user, ActivityPub powered microblog.</title>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
body {
font-family: Helvetica, sans-serif;
font-size: 20px;
line-height: 32px;
color: #111;
background: #ddd;
}
nav.flexbox {
margin: 30px 0;
}
nav.flexbox ul {
display: flex;
flex-wrap: wrap;
align-items: center;
list-style-type: none;
padding: 0;
}
nav.flexbox ul li {
margin-right: 20px;
}
nav.flexbox ul li:last-child {
margin-right: 0px;
}
h1 {
font-weight: normal;
text-align: center;
margin: 30px auto;
color: #111;
}
h1 span {
color: #1d781d;
}
header p {
text-align:center;
}
a {
text-decoration: none;
}
nav a, main a, header p a {
color: #1d781d;
}
nav a:hover, main a:hover, header p a:hover {
color: #781D78;
}
#main {
width: 95%;
max-width: 960px;
margin: 50px auto;
}
</style>
</head>
<body>
<div id="main">
<header>
<a href="/"><h1>microblog<span>.pub</span></h1></a>
<p>A self-hosted, single-user, <a href="https://activitypub.rocks/">ActivityPub</a> powered microblog.</p>
</header>
<nav class="flexbox">
<ul>
<li><a href="/">Home</a>
<li><a href="https://sr.ht/~tsileo/microblog.pub/">Source code</a>
<li><a href="https://todo.sr.ht/~tsileo/microblog.pub">Bug tracker</a>
<li><a href="https://sr.ht/~tsileo/microblog.pub/lists">Mailing list</a>
</ul>
</nav>
<main>
{{ content | safe }}
</main>
</div>
</body>
</html>

View File

@ -0,0 +1,28 @@
from pathlib import Path
from jinja2 import Environment
from jinja2 import FileSystemLoader
from jinja2 import select_autoescape
from markdown import markdown
def markdownify(content: str) -> str:
return markdown(content, extensions=["mdx_linkify"])
def main() -> None:
# Setup Jinja
loader = FileSystemLoader("docs/templates")
env = Environment(loader=loader, autoescape=select_autoescape())
template = env.get_template("layout.html")
Path("docs/dist").mkdir(exist_ok=True)
readme = Path("README.md")
template.stream(
content=markdownify(readme.read_text().removeprefix("# microblog.pub"))
).dump("docs/dist/index.html")
if __name__ == "__main__":
main()

View File

@ -73,6 +73,28 @@ def tests(ctx, k=None):
)
@task
def generate_requirements_txt(ctx, where="requirements.txt"):
# type: (Context, str) -> None
run(
f"poetry export -f requirements.txt --without-hashes > {where}",
pty=True,
echo=True,
)
@task(generate_requirements_txt)
def build_configuration_wizard_image(ctx):
# type: (Context) -> None
run("docker build -t testmpw -f configuration_wizard.dockerfile .")
@task
def build_docs(ctx):
# type: (Context) -> None
run("poetry run python scripts/generate_docs.py", pty=True, echo=True)
@task
def download_twemoji(ctx):
# type: (Context) -> None