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",
"serde",
"thiserror",
"toml 0.8.8",
]
[[package]]

View file

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

View file

@ -1,5 +1,14 @@
use crate::components::article::ArticleData;
use leptos::*;
use serde::Deserialize;
// Can this merge with ArticleData somehow?
#[derive(Deserialize)]
struct TomlData {
content_type: String,
title: String,
date: String,
}
#[server]
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");
let content = html_from_md.content;
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 {
content_type: String::from("Blog"),
title: String::from("Test article"),
date: String::from("12/21/2022"),
content_type: toml.content_type,
title: toml.title,
date: toml.date,
content,
})
}

View file

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

View file

@ -1,6 +1,8 @@
Content_Type: blog
Title: Change
Date: 2022 5 6
```toml
content_type = "blog"
title = "Change"
date = "2022 5 6"
```
<p style="text-align: center;">
<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 />
(Hunter S.Thompson)
</p>
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
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
Title: It's about time, NVIDIA
Date: 2022 5 20
```toml
content_type = "blog"
title = "It's about time, NVIDIA"
date = "2022 5 20"
```
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

View file

@ -1,22 +1,24 @@
Content_Type: blog
Title: Back to School
Date: 2022 6 2
```toml
content_type = "blog"
title = "Back to School"
date = "2022 6 2"
```
### Where the hell have I been!?
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:
* [Python](https://www.python.org)
* [Pandas](https://pandas.pydata.org)
* [Matplotlib](https://matplotlib.org)
* [Seaborn](https://seaborn.pydata.org)
* [Statsmodels](https://www.statsmodels.org)
* [Scikit-Learn](https://scikit-learn.org)
* [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup)
* [Selenium](https://www.selenium.dev)
* [PRAW](https://github.com/praw-dev/praw)
* Plus the math and background to go with it all!
- [Python](https://www.python.org)
- [Pandas](https://pandas.pydata.org)
- [Matplotlib](https://matplotlib.org)
- [Seaborn](https://seaborn.pydata.org)
- [Statsmodels](https://www.statsmodels.org)
- [Scikit-Learn](https://scikit-learn.org)
- [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup)
- [Selenium](https://www.selenium.dev)
- [PRAW](https://github.com/praw-dev/praw)
- 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
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
Title: It's a post about nothing!
Date: 2022 7 1
```toml
content_type = "blog"
title = "It's a post about nothing!"
date = "2022 7 1"
```
The progress update

View file

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

View file

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

View file

@ -1,6 +1,8 @@
Content_Type: game
Title: fps
Date: 2022 10 9
```toml
content_type = "game"
title = "fps"
date = "2022 10 9"
```
[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!

View file

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

View file

@ -1,6 +1,8 @@
Content_Type: project
Title: Predicting Housing Prices
Date: 2022 5 29
```toml
content_type = "project"
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.

View file

@ -1,6 +1,8 @@
Content_Type: project
Title: What goes into a successful Reddit post?
Date: 2022 6 16
```toml
content_type = "project"
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
classification models to try to determine which features have the highest influence on

View file

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

View file

@ -1,6 +1,8 @@
Content_Type: project
Title: Lightning
Date: 2023 4 27
```toml
content_type = "project"
title = "Lightning"
date = "2023 4 27"
```
[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