diff --git a/doordesk/Cargo.lock b/doordesk/Cargo.lock index b960265..71e6b9f 100644 --- a/doordesk/Cargo.lock +++ b/doordesk/Cargo.lock @@ -89,6 +89,7 @@ dependencies = [ "leptos_router", "serde", "thiserror", + "toml 0.8.8", ] [[package]] diff --git a/doordesk/app/Cargo.toml b/doordesk/app/Cargo.toml index 3f94440..fd9b63b 100644 --- a/doordesk/app/Cargo.toml +++ b/doordesk/app/Cargo.toml @@ -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 = [] diff --git a/doordesk/app/src/components/slingshot.rs b/doordesk/app/src/components/slingshot.rs index 78022fc..508cce4 100644 --- a/doordesk/app/src/components/slingshot.rs +++ b/doordesk/app/src/components/slingshot.rs @@ -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, ServerFnError> { @@ -18,12 +27,17 @@ pub async fn slingshot(path: String) -> Result, 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, }) } diff --git a/doordesk/public/static/blog/000000000-swim.md b/doordesk/public/static/blog/20220207-swim.md similarity index 99% rename from doordesk/public/static/blog/000000000-swim.md rename to doordesk/public/static/blog/20220207-swim.md index e4b9e9c..5836b46 100644 --- a/doordesk/public/static/blog/000000000-swim.md +++ b/doordesk/public/static/blog/20220207-swim.md @@ -1,6 +1,8 @@ -Content_Type: blog -Title: Hume -Date: 2022 2 7 +```toml +content_type = "blog" +title = "Hume" +date = "2022 2 7" +```

April 22, 1958
diff --git a/doordesk/public/static/blog/20220506-change.md b/doordesk/public/static/blog/20220506-change.md index cf42db6..63f8934 100644 --- a/doordesk/public/static/blog/20220506-change.md +++ b/doordesk/public/static/blog/20220506-change.md @@ -1,6 +1,8 @@ -Content_Type: blog -Title: Change -Date: 2022 5 6 +```toml +content_type = "blog" +title = "Change" +date = "2022 5 6" +```

"Life should not be a journey to the grave with the intention of arriving safely in @@ -10,6 +12,7 @@ Date: 2022 5 6
(Hunter S.Thompson)

+ 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 diff --git a/doordesk/public/static/blog/20220520-nvidia.md b/doordesk/public/static/blog/20220520-nvidia.md index 43b826e..e6b8006 100644 --- a/doordesk/public/static/blog/20220520-nvidia.md +++ b/doordesk/public/static/blog/20220520-nvidia.md @@ -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 diff --git a/doordesk/public/static/blog/20220602-back.md b/doordesk/public/static/blog/20220602-back.md index ad5dfe6..38ae3ca 100644 --- a/doordesk/public/static/blog/20220602-back.md +++ b/doordesk/public/static/blog/20220602-back.md @@ -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 diff --git a/doordesk/public/static/blog/20220701-progress.md b/doordesk/public/static/blog/20220701-progress.md index 3d2d91f..692cc0b 100644 --- a/doordesk/public/static/blog/20220701-progress.md +++ b/doordesk/public/static/blog/20220701-progress.md @@ -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 diff --git a/doordesk/public/static/games/adam.md b/doordesk/public/static/games/adam.md index 7cdb775..2963722 100644 --- a/doordesk/public/static/games/adam.md +++ b/doordesk/public/static/games/adam.md @@ -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). diff --git a/doordesk/public/static/games/balls.md b/doordesk/public/static/games/balls.md index 6c6b9f2..e19f109 100644 --- a/doordesk/public/static/games/balls.md +++ b/doordesk/public/static/games/balls.md @@ -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/). diff --git a/doordesk/public/static/games/fps.md b/doordesk/public/static/games/fps.md index 11f045f..4642d91 100644 --- a/doordesk/public/static/games/fps.md +++ b/doordesk/public/static/games/fps.md @@ -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! diff --git a/doordesk/public/static/games/snek.md b/doordesk/public/static/games/snek.md index c55fc4d..9b6186a 100644 --- a/doordesk/public/static/games/snek.md +++ b/doordesk/public/static/games/snek.md @@ -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. diff --git a/doordesk/public/static/projects/20220529-housing.md b/doordesk/public/static/projects/20220529-housing.md index af80aac..385879a 100644 --- a/doordesk/public/static/projects/20220529-housing.md +++ b/doordesk/public/static/projects/20220529-housing.md @@ -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. diff --git a/doordesk/public/static/projects/20220614-reddit.md b/doordesk/public/static/projects/20220614-reddit.md index 586a9ed..92bcc7d 100644 --- a/doordesk/public/static/projects/20220614-reddit.md +++ b/doordesk/public/static/projects/20220614-reddit.md @@ -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 diff --git a/doordesk/public/static/projects/20221020-cartman.md b/doordesk/public/static/projects/20221020-cartman.md index ca124ca..4ed09af 100644 --- a/doordesk/public/static/projects/20221020-cartman.md +++ b/doordesk/public/static/projects/20221020-cartman.md @@ -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) diff --git a/doordesk/public/static/projects/20230427-lightning.md b/doordesk/public/static/projects/20230427-lightning.md index bc9b114..8b2f2e1 100644 --- a/doordesk/public/static/projects/20230427-lightning.md +++ b/doordesk/public/static/projects/20230427-lightning.md @@ -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