From 11d54f44808e905d85b33cfb5e17f61b5bd8b466 Mon Sep 17 00:00:00 2001 From: 0x01fe Date: Mon, 24 Jun 2024 16:05:04 -0500 Subject: [PATCH] more statuses & made posts linkable --- app/app.py | 14 ++++++++++---- app/post.py | 6 +++++- app/resources/status.text | 20 ++++++++++++++++++++ app/templates/writing.html | 3 +++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/app/app.py b/app/app.py index bcc16d9..4036eb5 100644 --- a/app/app.py +++ b/app/app.py @@ -86,9 +86,6 @@ def get_status() -> str: selected_key = keys[random.randint(0, len(keys) - 1)] section: list = statuses[selected_key] - print(selected_key) - print(section) - selected_status = section[random.randint(0, len(section) - 1)] return f'
{markdown.markdown(selected_status)}
' @@ -109,6 +106,16 @@ def index(): return flask.render_template('index.html', posts=post_bodies, status=status) +# Posts +@app.route('/post/') +def post(post_name: str): + + for post in get_posts(): + if post.title.replace(' ', '-') == post_name: + return flask.render_template('index.html', posts=[post.body], status=get_status()) + + flask.abort(404) + # Games Page @app.route('/games/') def games(): @@ -260,7 +267,6 @@ def album_square(user_id, rows : int): if __name__ == "__main__": statuses = read_status_file() - print(statuses) if DEV: app.run(port=PORT) diff --git a/app/post.py b/app/post.py index 1de822a..954fbf2 100644 --- a/app/post.py +++ b/app/post.py @@ -8,6 +8,8 @@ class Post: date : datetime.datetime body : str file : str + title : str + url : str def __init__(self, file_path): self.file = file_path @@ -17,9 +19,11 @@ class Post: self.category = lines[1].split(":")[1].strip() self.author = lines[2].split(":")[1].strip() + self.title = lines[6][2:-1] + self.url = '/post/' + self.title.replace(' ', '-') date = lines[3].split(":")[1].strip() self.date = datetime.datetime.strptime(date, "%d-%m-%Y") - self.body = markdown.markdown(''.join(lines[6:])) + self.body = markdown.markdown(f'# [{self.title}]({self.url})\n' + ''.join(lines[7:])) diff --git a/app/resources/status.text b/app/resources/status.text index bff44eb..0fece64 100644 --- a/app/resources/status.text +++ b/app/resources/status.text @@ -14,7 +14,10 @@ As long as there is delusion, there is hope It's 510. Catchy Right? +## TV / Movie Quotes +# Monogatari +I don't know everything, I only know what I know. ## Song Lyrics @@ -90,3 +93,20 @@ Don't miss a moment of this experiment If you're going to replace me // At least have the audacity to kill me thoroughly What's the color of the electric sheep you see? Maybe we're all cold machines + +# Change by King Gizzard & The Lizard Wizard +We're changing pace // Higher stakes +So called heroes wearing fake capes +Buildings that you know // People come and go // Are a certain way +And then you get the news that obliterates your view // Amputate your truths // The signifiance has changed +Hospital inane // Meaningless and grey // But lie within the walls and the signifiance will change +What would it take for us to change the game? // Maybe our existence is signifiance in vain + +# Candles by King Gizzard & The Lizard Wizard +This little man is too hot to handle // Set the funeral on fire with the candles +Praying to the gods at the top of a mountian // Better throwing all your pennies in a fountian +My little heart, as cold as a morgue // Let the weight of it drop like an iceberg + +# Presumptuous by King Gizzard & The Lizard Wizard +Eggshell, landmine, stepping stones // Kindred spirits at a crossroads +The world we built is on a tilt // Bottled up inside and filled with guilt diff --git a/app/templates/writing.html b/app/templates/writing.html index 09df245..fdbc293 100644 --- a/app/templates/writing.html +++ b/app/templates/writing.html @@ -2,6 +2,9 @@ home +

+ This is just a little page where I post stuff I write. I was kind of unsure if I wanted this stuff out here but I think to those who know me it could serve as an interesting view into some thoughts that I don't often express elsewhere. +



{% for work in works %}