1
Fork 0

Add a seperate DRG section to frontmatter data.

This commit is contained in:
Bauke 2023-01-30 12:44:16 +01:00
parent 3beb305cdf
commit 9e64b06c12
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 16 additions and 0 deletions

View File

@ -2,6 +2,9 @@
id = "_9xtYCGWtn4"
page_title = "No HUD Hazard 5 Mining Expedition"
tags = ["Deep Rock Galactic", "No HUD"]
[drg]
mods = ["brighter-objects"]
---
## Description

View File

@ -11,6 +11,9 @@ mod filters;
#[derive(Debug, Template)]
#[template(path = "video.html")]
pub struct VideoTemplate {
/// Deep Rock Galactic data.
pub drg: Option<DeepRockGalacticData>,
/// The title of the page.
pub page_title: String,
@ -26,6 +29,9 @@ pub struct VideoTemplate {
#[derive(Debug, Deserialize)]
pub struct VideoData {
/// Deep Rock Galactic data.
pub drg: Option<DeepRockGalacticData>,
/// The YouTube video ID.
pub id: String,
@ -55,6 +61,12 @@ pub struct SpeedrunData {
pub mods: Option<Vec<String>>,
}
#[derive(Debug, Deserialize)]
pub struct DeepRockGalacticData {
/// Deep Rock Galactic mods used in the run.
pub mods: Option<Vec<String>>,
}
pub fn write_all(public_dir: &Path) -> Result<()> {
let video_datas = {
let mut data = vec![];
@ -90,6 +102,7 @@ pub fn write_all(public_dir: &Path) -> Result<()> {
fs::create_dir_all(&video_dir)?;
let template = VideoTemplate {
drg: video_data.drg,
page_title: video_data.page_title,
rendered_markdown: comrak::markdown_to_html(
&markdown,