Start style

This commit is contained in:
Sam Ireland 2020-12-30 23:51:41 +00:00
parent 92d25dc356
commit 6f55b74c26
5 changed files with 23 additions and 15 deletions

View File

@ -1,10 +1,11 @@
<html> <html>
<head> <head>
<title>Saved Posts</title> <title>Saved Posts</title>
</head> <style></style>
</head>
<body> <body>
<h1>Saved Posts</h1> <h1>Saved Posts</h1>
<!--posts--> <!--posts-->
</body> </body>
</html> </html>

3
html/style.css Normal file
View File

@ -0,0 +1,3 @@
a {
display: block;
}

View File

@ -1,10 +1,11 @@
<html> <html>
<head> <head>
<title>Upvoted Posts</title> <title>Upvoted Posts</title>
</head> <style></style>
</head>
<body> <body>
<h1>Upvoted Posts</h1> <h1>Upvoted Posts</h1>
<!--posts--> <!--posts-->
</body> </body>
</html> </html>

View File

@ -34,6 +34,9 @@ for post in get_posts(client):
with open(os.path.join("html", html_file)) as f: with open(os.path.join("html", html_file)) as f:
html = f.read() html = f.read()
with open(os.path.join("html", "style.css")) as f:
html = html.replace("<style></style>", f"<style>\n{f.read()}\n</style>")
html = html.replace("<!--posts-->", "\n".join(posts_html)) html = html.replace("<!--posts-->", "\n".join(posts_html))
with open(os.path.join(location, html_file), "w") as f: with open(os.path.join(location, html_file), "w") as f:

View File

@ -15,7 +15,7 @@ def make_client():
def get_saved_posts(client): def get_saved_posts(client):
for saved in client.user.me().saved(limit=None): for saved in client.user.me().saved(limit=10):
if saved.__class__.__name__ == "Submission": if saved.__class__.__name__ == "Submission":
yield saved yield saved