Compare commits
No commits in common. "aa6da0069bac8497590403647b06ecec16ae34f7" and "cf28b65d16712a1bc3eb59e8a16f25c3da1856ec" have entirely different histories.
aa6da0069b
...
cf28b65d16
|
@ -26,10 +26,9 @@
|
||||||
{% if let Some(mods) = speedrun.mods %}
|
{% if let Some(mods) = speedrun.mods %}
|
||||||
<h2>Mods</h2>
|
<h2>Mods</h2>
|
||||||
<ul>
|
<ul>
|
||||||
{% for id in mods %}
|
{% for (name, id) in mods %}
|
||||||
{% let (mod_link, mod_title) = id|drg_mod %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ mod_link }}" target="_blank">{{ mod_title }}</a>
|
<a href="https://drg.mod.io/{{ id }}" target="_blank">{{ name }}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -2,19 +2,6 @@
|
||||||
Filters for Askama templates.
|
Filters for Askama templates.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
Get the DRG mod link and title from a given ID.
|
|
||||||
*/
|
|
||||||
pub fn drg_mod(mod_id: &str) -> askama::Result<(String, &str)> {
|
|
||||||
let mods = std::collections::HashMap::<_, _>::from_iter([
|
|
||||||
("drglib", "DRGLib"),
|
|
||||||
("simplemissiontimer", "SimpleMissionTimer"),
|
|
||||||
]);
|
|
||||||
|
|
||||||
let mod_title = mods.get(mod_id).unwrap();
|
|
||||||
Ok((format!("https://drg.mod.io/{mod_id}"), mod_title))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Turn a timestamp with format `mm:ss` into its total seconds.
|
Turn a timestamp with format `mm:ss` into its total seconds.
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub struct SpeedrunData {
|
||||||
pub chapters: Option<Vec<(String, String)>>,
|
pub chapters: Option<Vec<(String, String)>>,
|
||||||
pub entry: String,
|
pub entry: String,
|
||||||
pub leaderboard: String,
|
pub leaderboard: String,
|
||||||
pub mods: Option<Vec<String>>,
|
pub mods: Option<Vec<(String, String)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_all(public_dir: &Path) -> Result<()> {
|
pub fn write_all(public_dir: &Path) -> Result<()> {
|
||||||
|
@ -39,15 +39,9 @@ pub fn write_all(public_dir: &Path) -> Result<()> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_contents = fs::read_to_string(&file_path)?;
|
let file_contents = fs::read_to_string(file_path)?;
|
||||||
let (video_data, markdown) =
|
let (video_data, markdown) =
|
||||||
match toml_frontmatter::parse::<VideoData>(&file_contents) {
|
toml_frontmatter::parse::<VideoData>(&file_contents).unwrap();
|
||||||
Ok(parsed) => parsed,
|
|
||||||
Err(error) => {
|
|
||||||
println!("{:?} {}", file_path.file_name().unwrap(), error);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
data.push((video_data, markdown.to_string()));
|
data.push((video_data, markdown.to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue