1
Fork 0

Compare commits

..

No commits in common. "aa6da0069bac8497590403647b06ecec16ae34f7" and "cf28b65d16712a1bc3eb59e8a16f25c3da1856ec" have entirely different histories.

3 changed files with 5 additions and 25 deletions

View File

@ -26,10 +26,9 @@
{% if let Some(mods) = speedrun.mods %}
<h2>Mods</h2>
<ul>
{% for id in mods %}
{% let (mod_link, mod_title) = id|drg_mod %}
{% for (name, id) in mods %}
<li>
<a href="{{ mod_link }}" target="_blank">{{ mod_title }}</a>
<a href="https://drg.mod.io/{{ id }}" target="_blank">{{ name }}</a>
</li>
{% endfor %}
</ul>

View File

@ -2,19 +2,6 @@
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.

View File

@ -25,7 +25,7 @@ pub struct SpeedrunData {
pub chapters: Option<Vec<(String, String)>>,
pub entry: String,
pub leaderboard: String,
pub mods: Option<Vec<String>>,
pub mods: Option<Vec<(String, String)>>,
}
pub fn write_all(public_dir: &Path) -> Result<()> {
@ -39,15 +39,9 @@ pub fn write_all(public_dir: &Path) -> Result<()> {
continue;
}
let file_contents = fs::read_to_string(&file_path)?;
let file_contents = fs::read_to_string(file_path)?;
let (video_data, markdown) =
match toml_frontmatter::parse::<VideoData>(&file_contents) {
Ok(parsed) => parsed,
Err(error) => {
println!("{:?} {}", file_path.file_name().unwrap(), error);
continue;
}
};
toml_frontmatter::parse::<VideoData>(&file_contents).unwrap();
data.push((video_data, markdown.to_string()));
}
}