aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--poetry/agosto.md15
-rw-r--r--poetry/bay-leaves.md16
-rw-r--r--poetry/missed.md21
-rw-r--r--poetry/unstable-bedroom.md21
-rw-r--r--poetry/untitled-2023-07-14.md9
-rw-r--r--poetry/will.md16
-rw-r--r--src/main.rs17
-rw-r--r--src/poetry.rs18
-rw-r--r--src/posts/note.rs7
-rw-r--r--src/templates.rs15
-rw-r--r--static/style.css45
-rw-r--r--templates/poem-panel.html10
-rw-r--r--templates/poem.html9
-rw-r--r--templates/poetry.html13
14 files changed, 216 insertions, 16 deletions
diff --git a/poetry/agosto.md b/poetry/agosto.md
new file mode 100644
index 0000000..7a5c3ad
--- /dev/null
+++ b/poetry/agosto.md
@@ -0,0 +1,15 @@
++++
+title = "agosto"
+created_at = "2023-08-09T12:00:00+0000"
+published_at = "2024-01-31T20:07:10+0000"
++++
+
+august flows too quickly
+i fear i already missed it
+meu coracao foi
+cheio demais esse dia de saudade
+mergulhei na onda sozinha
+i couldn't see through it
+nem sabia
+i missed you when you are still there,
+vem amanha
diff --git a/poetry/bay-leaves.md b/poetry/bay-leaves.md
new file mode 100644
index 0000000..0e4ec39
--- /dev/null
+++ b/poetry/bay-leaves.md
@@ -0,0 +1,16 @@
++++
+title = "bay leaves"
+created_at = "2023-12-22T17:37:00+0000"
+published_at = "2024-01-31T20:07:10+0000"
++++
+
+the leaves in the little jar of bay leaves are running out.
+there is only one left,
+it is the last because it was smaller than the others.
+
+they left in small groups of three or four,
+i made sure to tear them apart as you showed me.
+
+soon only the drawing on the lid will remain.
+i will have to decide—
+if i will keep it or throw it away.
diff --git a/poetry/missed.md b/poetry/missed.md
new file mode 100644
index 0000000..e3cadc8
--- /dev/null
+++ b/poetry/missed.md
@@ -0,0 +1,21 @@
++++
+title = "missed"
+created_at = "2023-08-04T12:00:00+0000"
+published_at = "2024-01-31T20:07:10+0000"
++++
+
+how am i? alive now
+twenty years old maybe
+things are getting better, you know.
+finally ready for high school
+sorry i couldn't help you.
+didn't work out at eighteen
+maybe next year...
+
+not even a teen
+but died a few times already
+maybe i'm finally a teen but
+now i just want to get on any train
+out of here
+would they have been missed?
+...oops!
diff --git a/poetry/unstable-bedroom.md b/poetry/unstable-bedroom.md
new file mode 100644
index 0000000..4d404f9
--- /dev/null
+++ b/poetry/unstable-bedroom.md
@@ -0,0 +1,21 @@
++++
+title = "unstable bedroom"
+created_at = "2023-07-05T12:00:00+0000"
+published_at = "2024-01-31T20:07:10+0000"
++++
+
+little shark
+unstable bedroom
+dead plant plant alive
+desk not mine
+
+bunny plushie follow me
+come with me from screen
+to screen
+
+sisyphean task laundry elude me
+
+candle burn away: cup for pens
+keyboard wake facing a bed
+
+what will be left here when i leave
diff --git a/poetry/untitled-2023-07-14.md b/poetry/untitled-2023-07-14.md
new file mode 100644
index 0000000..36e2462
--- /dev/null
+++ b/poetry/untitled-2023-07-14.md
@@ -0,0 +1,9 @@
++++
+title = "untitled-2023-07-14"
+created_at = "2023-07-14T12:00:00+0000"
+published_at = "2024-01-31T20:07:10+0000"
++++
+
+borrowed time
+borrowed
+
diff --git a/poetry/will.md b/poetry/will.md
new file mode 100644
index 0000000..2077cf0
--- /dev/null
+++ b/poetry/will.md
@@ -0,0 +1,16 @@
++++
+title = "will"
+created_at = "2023-09-12T12:00:00+0000"
+published_at = "2024-01-31T20:07:10+0000"
++++
+
+into the earth
+not a flowering plant
+watching the sky
+intermittent rain
+forms the water of my tears
+to feel from my eyes
+will this year a blossom
+from that rot bloom
+standing in rain
+only to fall soon
diff --git a/src/main.rs b/src/main.rs
index 4f8ec55..5ee3b2a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -33,6 +33,7 @@ use tracing_subscriber::FmtSubscriber;
use crate::article::Article;
use crate::blog::Blogpost;
+use crate::poetry::Poem;
use crate::posts::Post;
type Result<T> = std::result::Result<T, BlossomError>;
@@ -123,6 +124,20 @@ async fn plants() -> Result<()> {
Err(BlossomError::Unimplemented)
}
+#[handler]
+async fn get_poem(Path(poem): Path<String>) -> Result<templates::Poem> {
+ let poem = Poem::get_article(&poem).await?;
+ Ok(templates::Poem { poem, jiggle: 4 })
+}
+
+#[handler]
+async fn get_poetry() -> Result<templates::Poetry> {
+ let mut poems = Poem::get_articles().await?;
+ poems.sort_by_key(|poem| poem.created_at);
+ poems.reverse();
+ Ok(templates::Poetry { poems, jiggle: 16 })
+}
+
async fn custom_error(err: poem::Error) -> impl IntoResponse {
templates::Error {
status: err.status(),
@@ -143,6 +158,8 @@ async fn main() -> std::result::Result<(), std::io::Error> {
.at("/", get(home))
.at("/blog", get(get_blog))
.at("/blog/:blogpost", get(blogpost))
+ .at("/poetry", get(get_poetry))
+ .at("/poetry/:poem", get(get_poem))
.at("/feed", get(feed))
.at("/contact", get(contact))
.at("/plants", get(plants))
diff --git a/src/poetry.rs b/src/poetry.rs
index 6429bd3..ef168e8 100644
--- a/src/poetry.rs
+++ b/src/poetry.rs
@@ -7,14 +7,14 @@ use crate::{article::Article, posts::Post};
static DIRECTORY: &str = "./poetry";
pub struct Poem {
- file_name: String,
- title: Option<String>,
- created_at: DateTime<Utc>,
- published_at: DateTime<Utc>,
- updated_at: Option<DateTime<Utc>>,
- content: String,
+ pub file_name: String,
+ pub title: Option<String>,
+ pub created_at: DateTime<Utc>,
+ pub published_at: DateTime<Utc>,
+ pub updated_at: Option<DateTime<Utc>>,
+ pub content: String,
// TODO: localisation (get lang from file names)
- lang: String,
+ pub lang: String,
}
#[derive(Deserialize)]
@@ -78,10 +78,10 @@ impl Post for Poem {
}
fn post_type(&self) -> crate::posts::PostType {
- todo!()
+ crate::posts::PostType::Article
}
fn content(&self) -> &str {
- todo!()
+ &self.content
}
}
diff --git a/src/posts/note.rs b/src/posts/note.rs
deleted file mode 100644
index d7fa6c9..0000000
--- a/src/posts/note.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-enum TextFormat {
- Markdown,
- Plaintext,
- Html,
-}
-
-struct Note {}
diff --git a/src/templates.rs b/src/templates.rs
index 861930f..8eafd98 100644
--- a/src/templates.rs
+++ b/src/templates.rs
@@ -4,6 +4,7 @@ use askama::Template;
use poem::http::StatusCode;
use rand::{thread_rng, Rng};
+use crate::poetry;
use crate::posts::Post;
use crate::{blog, scrobbles::NowPlayingData};
@@ -44,6 +45,20 @@ pub struct Blog {
}
#[derive(Template)]
+#[template(path = "poem.html")]
+pub struct Poem {
+ pub poem: poetry::Poem,
+ pub jiggle: isize,
+}
+
+#[derive(Template)]
+#[template(path = "poetry.html")]
+pub struct Poetry {
+ pub poems: Vec<poetry::Poem>,
+ pub jiggle: isize,
+}
+
+#[derive(Template)]
#[template(path = "contact.html")]
pub struct Contact;
diff --git a/static/style.css b/static/style.css
index e4e3ebd..cef4a10 100644
--- a/static/style.css
+++ b/static/style.css
@@ -433,6 +433,51 @@ iframe {
list-style-type: initial;
}
+#poems {
+ margin: 16vw 0;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: space-around;
+ gap: 32vw;
+}
+
+#poems .poem {
+ margin: 0;
+ position: relative;
+}
+
+#poem {
+ display: flex;
+ align-items: center;
+ margin: 2vw;
+}
+
+.poem {
+ margin: auto;
+ max-width: 50em;
+}
+
+.poem .title {
+ font-family: 'Louise';
+ font-size: 4em;
+ margin: 0.5em 0 0;
+}
+
+.poem .created-at {
+ font-family: 'Steps Mono';
+ font-size: 1em;
+ margin: 0 0 1em;
+}
+
+.poem .created-at a {
+ padding: 0;
+ margin: 0;
+ background-color: transparent;
+ color: #b52f6a;
+ text-decoration: underline;
+}
+
/* filter-tags */
#filter-tags {
font-family: 'Go Mono';
diff --git a/templates/poem-panel.html b/templates/poem-panel.html
new file mode 100644
index 0000000..3359578
--- /dev/null
+++ b/templates/poem-panel.html
@@ -0,0 +1,10 @@
+<div
+ style="top: {{ self::thread_rng().gen_range(-jiggle..=jiggle) }}vw; left: {{ self::thread_rng().gen_range(-4..=4) }}vw"
+ class="panel content poem">
+ {% if let Some(title) = poem.title %}<h1 class="title">{{ title }}</h1>{% endif %}
+ <h2 class="created-at">{{ poem.created_at.date_naive() }} <a href="/poetry/{{ poem.file_name }}">permalink</a>
+ </h2>
+ <div class="poem-content">
+ {{ poem.content|safe }}
+ </div>
+</div>
diff --git a/templates/poem.html b/templates/poem.html
new file mode 100644
index 0000000..589a6e4
--- /dev/null
+++ b/templates/poem.html
@@ -0,0 +1,9 @@
+{% extends "base.html" %}
+
+{% block content %}
+
+<div id="poem">
+ {% include "poem-panel.html" %}
+</div>
+
+{% endblock content %} \ No newline at end of file
diff --git a/templates/poetry.html b/templates/poetry.html
new file mode 100644
index 0000000..8c51cff
--- /dev/null
+++ b/templates/poetry.html
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+
+{% block nav_poetry %}active{% endblock %}
+
+{% block content %}
+
+<div id="poems">
+ {% for poem in poems %}
+ {% include "poem-panel.html" %}
+ {% endfor %}
+</div>
+
+{% endblock content %} \ No newline at end of file