use frontmatter

This commit is contained in:
Adam 2024-01-20 00:49:15 -05:00
parent ee4b2c0ced
commit 109a1c1e84
16 changed files with 96 additions and 53 deletions

1
doordesk/Cargo.lock generated
View file

@ -89,6 +89,7 @@ dependencies = [
"leptos_router", "leptos_router",
"serde", "serde",
"thiserror", "thiserror",
"toml 0.8.8",
] ]
[[package]] [[package]]

View file

@ -16,6 +16,7 @@ cfg-if.workspace = true
thiserror.workspace = true thiserror.workspace = true
serde = "1.0.195" serde = "1.0.195"
femark = { version = "0.1.5", optional = true } femark = { version = "0.1.5", optional = true }
toml = "0.8.8"
[features] [features]
default = [] default = []

View file

@ -1,5 +1,14 @@
use crate::components::article::ArticleData; use crate::components::article::ArticleData;
use leptos::*; use leptos::*;
use serde::Deserialize;
// Can this merge with ArticleData somehow?
#[derive(Deserialize)]
struct TomlData {
content_type: String,
title: String,
date: String,
}
#[server] #[server]
pub async fn slingshot(path: String) -> Result<Vec<ArticleData>, ServerFnError> { pub async fn slingshot(path: String) -> Result<Vec<ArticleData>, ServerFnError> {
@ -18,12 +27,17 @@ pub async fn slingshot(path: String) -> Result<Vec<ArticleData>, ServerFnError>
.expect("Problem processing markdown"); .expect("Problem processing markdown");
let content = html_from_md.content; let content = html_from_md.content;
let _toc = html_from_md.toc; let _toc = html_from_md.toc;
let _frontmatter = html_from_md.frontmatter; let frontmatter = html_from_md
.frontmatter
.expect(&format!("error getting frontmatter for {}", &file).to_string());
let toml: TomlData =
toml::from_str(&frontmatter.code_block.unwrap().source).unwrap();
articles.push(ArticleData { articles.push(ArticleData {
content_type: String::from("Blog"), content_type: toml.content_type,
title: String::from("Test article"), title: toml.title,
date: String::from("12/21/2022"), date: toml.date,
content, content,
}) })
} }

View file

@ -1,6 +1,8 @@
Content_Type: blog ```toml
Title: Hume content_type = "blog"
Date: 2022 2 7 title = "Hume"
date = "2022 2 7"
```
<p style="text-align: right;"> <p style="text-align: right;">
April 22, 1958<br /> April 22, 1958<br />

View file

@ -1,6 +1,8 @@
Content_Type: blog ```toml
Title: Change content_type = "blog"
Date: 2022 5 6 title = "Change"
date = "2022 5 6"
```
<p style="text-align: center;"> <p style="text-align: center;">
<i>"Life should not be a journey to the grave with the intention of arriving safely in <i>"Life should not be a journey to the grave with the intention of arriving safely in
@ -10,6 +12,7 @@ Date: 2022 5 6
<br /> <br />
(Hunter S.Thompson) (Hunter S.Thompson)
</p> </p>
There comes a time in one's life, perhaps multiple, when there There comes a time in one's life, perhaps multiple, when there
is an unquestionable need for change. Maybe you're not sure how, why, or where it came is an unquestionable need for change. Maybe you're not sure how, why, or where it came
from, or where even it is you're headed, or how to get there, but here you are taking from, or where even it is you're headed, or how to get there, but here you are taking

View file

@ -1,6 +1,8 @@
Content_Type: blog ```toml
Title: It's about time, NVIDIA content_type = "blog"
Date: 2022 5 20 title = "It's about time, NVIDIA"
date = "2022 5 20"
```
It's about time... NVIDIA has finally released and is starting to It's about time... NVIDIA has finally released and is starting to
support Open-source software with their new modules released recently for the Linux support Open-source software with their new modules released recently for the Linux

View file

@ -1,22 +1,24 @@
Content_Type: blog ```toml
Title: Back to School content_type = "blog"
Date: 2022 6 2 title = "Back to School"
date = "2022 6 2"
```
### Where the hell have I been!? ### Where the hell have I been!?
Looking back at the past 5 weeks, it's impressive the amount of new things that have Looking back at the past 5 weeks, it's impressive the amount of new things that have
been shoved in my face. A list I'll try to make contains: been shoved in my face. A list I'll try to make contains:
* [Python](https://www.python.org) - [Python](https://www.python.org)
* [Pandas](https://pandas.pydata.org) - [Pandas](https://pandas.pydata.org)
* [Matplotlib](https://matplotlib.org) - [Matplotlib](https://matplotlib.org)
* [Seaborn](https://seaborn.pydata.org) - [Seaborn](https://seaborn.pydata.org)
* [Statsmodels](https://www.statsmodels.org) - [Statsmodels](https://www.statsmodels.org)
* [Scikit-Learn](https://scikit-learn.org) - [Scikit-Learn](https://scikit-learn.org)
* [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup) - [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup)
* [Selenium](https://www.selenium.dev) - [Selenium](https://www.selenium.dev)
* [PRAW](https://github.com/praw-dev/praw) - [PRAW](https://github.com/praw-dev/praw)
* Plus the math and background to go with it all! - Plus the math and background to go with it all!
It doesn't seem like much at the time except chaos, but then about a week later it It doesn't seem like much at the time except chaos, but then about a week later it
finally sets in. After tomorrow we'll be halfway through the course and while I guess finally sets in. After tomorrow we'll be halfway through the course and while I guess

View file

@ -1,6 +1,8 @@
Content_Type: blog ```toml
Title: It's a post about nothing! content_type = "blog"
Date: 2022 7 1 title = "It's a post about nothing!"
date = "2022 7 1"
```
The progress update The progress update

View file

@ -1,6 +1,8 @@
Content_Type: game ```toml
Title: adam content_type = "game"
Date: 2022 9 11 title = "adam"
date = "2022 9 11"
```
[adam](https://old.doordesk.net/games/adam/) is a quick fps demo to test how well WebGL [adam](https://old.doordesk.net/games/adam/) is a quick fps demo to test how well WebGL
performs using [Unity](https://unity.com). performs using [Unity](https://unity.com).

View file

@ -1,6 +1,8 @@
Content_Type: game ```toml
Title: balls content_type = "game"
Date: 2022 9 13 title = "balls"
date = "2022 9 13"
```
[balls](https://old.doordesk.net/games/balls/) is another demo to test WebGL performance. [balls](https://old.doordesk.net/games/balls/) is another demo to test WebGL performance.
This time using [Godot Engine](https://godotengine.org/). This time using [Godot Engine](https://godotengine.org/).

View file

@ -1,6 +1,8 @@
Content_Type: game ```toml
Title: fps content_type = "game"
Date: 2022 10 9 title = "fps"
date = "2022 10 9"
```
[fps](https://old.doordesk.net/games/fps/) is a Godot/WebGL experiment from scratch with [fps](https://old.doordesk.net/games/fps/) is a Godot/WebGL experiment from scratch with
multiplayer using websockets and a master/slave architecture. Invite a friend or open multiple instances! multiplayer using websockets and a master/slave architecture. Invite a friend or open multiple instances!

View file

@ -1,5 +1,7 @@
Content_Type: game ```toml
Title: snek content_type = "game"
Date: 2022 5 20 title = "snek"
date = "2022 5 20"
```
[snek](https://old.doordesk.net/snek) is a simple snake game made with JS/Canvas. [snek](https://old.doordesk.net/snek) is a simple snake game made with JS/Canvas.

View file

@ -1,6 +1,8 @@
Content_Type: project ```toml
Title: Predicting Housing Prices content_type = "project"
Date: 2022 5 29 title = "Predicting Housing Prices"
date = "2022 5 29"
```
A recent project I had for class was to use [scikit-learn](https://scikit-learn.org/stable/index.html) to create a regression model that will predict the price of a house based on some features of that house. A recent project I had for class was to use [scikit-learn](https://scikit-learn.org/stable/index.html) to create a regression model that will predict the price of a house based on some features of that house.

View file

@ -1,6 +1,8 @@
Content_Type: project ```toml
Title: What goes into a successful Reddit post? content_type = "project"
Date: 2022 6 16 title = "What goes into a successful Reddit post?"
date = "2022 6 16"
```
In an attempt to find out what about a Reddit post makes it successful I will use some In an attempt to find out what about a Reddit post makes it successful I will use some
classification models to try to determine which features have the highest influence on classification models to try to determine which features have the highest influence on

View file

@ -1,6 +1,8 @@
Content_Type: project ```toml
Title: Cartman is public! content_type = "project"
Date: 2022 10 20 title = "Cartman is public!"
date = "2022 10 20"
```
[Cartman](https://old.doordesk.net/cartman) is trained by combining Microsoft's [Cartman](https://old.doordesk.net/cartman) is trained by combining Microsoft's
[DialoGPT-medium](https://huggingface.co/microsoft/DialoGPT-medium) [DialoGPT-medium](https://huggingface.co/microsoft/DialoGPT-medium)

View file

@ -1,6 +1,8 @@
Content_Type: project ```toml
Title: Lightning content_type = "project"
Date: 2023 4 27 title = "Lightning"
date = "2023 4 27"
```
[Lightning](https://lightning.doordesk.net) is a mapping/data vis project for finding [Lightning](https://lightning.doordesk.net) is a mapping/data vis project for finding
EV charging stations. It uses [Martin](https://github.com/maplibre/martin) to serve EV charging stations. It uses [Martin](https://github.com/maplibre/martin) to serve