Bit of a reorganization for output and template files
parent
5f31996982
commit
d06a629aff
10
src/bbs.rs
10
src/bbs.rs
|
@ -4,6 +4,8 @@ use itertools::Itertools;
|
||||||
use rinja::Template;
|
use rinja::Template;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
use crate::create_file;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||||
enum Character {
|
enum Character {
|
||||||
#[serde(alias = "A")]
|
#[serde(alias = "A")]
|
||||||
|
@ -119,7 +121,7 @@ struct Finisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "pages/bbs-commands.html")]
|
#[template(path = "pages/bbs/melding.html")]
|
||||||
struct CommandsTemplate {
|
struct CommandsTemplate {
|
||||||
pub commands: Vec<Command>,
|
pub commands: Vec<Command>,
|
||||||
pub crystals: Vec<String>,
|
pub crystals: Vec<String>,
|
||||||
|
@ -157,8 +159,8 @@ pub fn init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing::info!("Generating the BBS commands table template");
|
tracing::info!("Generating the BBS melding table template");
|
||||||
let template = CommandsTemplate { commands, crystals };
|
let melding_template = CommandsTemplate { commands, crystals };
|
||||||
|
|
||||||
std::fs::write("./out/bbs-commands.html", template.render().unwrap()).unwrap();
|
create_file("./out/bbs", "melding", melding_template.render().unwrap()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ use itertools::Itertools;
|
||||||
use rinja::Template;
|
use rinja::Template;
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
|
|
||||||
|
use crate::create_file;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||||
struct Board {
|
struct Board {
|
||||||
order: u32,
|
order: u32,
|
||||||
|
@ -348,7 +350,7 @@ impl Display for Interaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "pages/ddd-abilities.html")]
|
#[template(path = "pages/ddd/boards.html")]
|
||||||
struct AbilitiesTemplate {
|
struct AbilitiesTemplate {
|
||||||
pub boards: Vec<Board>,
|
pub boards: Vec<Board>,
|
||||||
}
|
}
|
||||||
|
@ -385,7 +387,7 @@ pub fn init() {
|
||||||
boards.sort_by(|a, b| a.order.cmp(&b.order));
|
boards.sort_by(|a, b| a.order.cmp(&b.order));
|
||||||
|
|
||||||
tracing::info!("Generating the DDD ability boards template");
|
tracing::info!("Generating the DDD ability boards template");
|
||||||
let template = AbilitiesTemplate { boards };
|
let boards_template = AbilitiesTemplate { boards };
|
||||||
|
|
||||||
std::fs::write("./out/ddd-abilities.html", template.render().unwrap()).unwrap();
|
create_file("./out/ddd", "boards", boards_template.render().unwrap()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ use std::fmt::Display;
|
||||||
use rinja::Template;
|
use rinja::Template;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
use crate::create_file;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||||
struct Recipes {
|
struct Recipes {
|
||||||
starters: Vec<Recipe>,
|
starters: Vec<Recipe>,
|
||||||
|
@ -55,7 +57,7 @@ impl Display for FoodStats {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "pages/kh3-recipes.html")]
|
#[template(path = "pages/kh3/food-sim.html")]
|
||||||
struct RecipesTemplate {
|
struct RecipesTemplate {
|
||||||
pub recipes: Recipes,
|
pub recipes: Recipes,
|
||||||
}
|
}
|
||||||
|
@ -68,7 +70,7 @@ pub fn init() {
|
||||||
let recipes = toml::from_str::<Recipes>(&recipes_str).unwrap();
|
let recipes = toml::from_str::<Recipes>(&recipes_str).unwrap();
|
||||||
|
|
||||||
tracing::info!("Generating the KH3 recipes template");
|
tracing::info!("Generating the KH3 recipes template");
|
||||||
let template = RecipesTemplate { recipes };
|
let food_template = RecipesTemplate { recipes };
|
||||||
|
|
||||||
std::fs::write("./out/kh3-recipes.html", template.render().unwrap()).unwrap();
|
create_file("./out/kh3", "food-sim", food_template.render().unwrap()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,3 +39,9 @@ fn main() {
|
||||||
#[cfg(feature = "kh3")]
|
#[cfg(feature = "kh3")]
|
||||||
kh3::init();
|
kh3::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_file(dir: &str, file: &str, buf: String) -> std::io::Result<()> {
|
||||||
|
std::fs::create_dir_all(dir)?;
|
||||||
|
std::fs::write(format!("{}/{}.html", dir, file), buf)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
|
@ -9,21 +9,21 @@
|
||||||
{% if cfg!(feature = "bbs") %}
|
{% if cfg!(feature = "bbs") %}
|
||||||
<h1>Kingdom Hearts Birth by Sleep</h1>
|
<h1>Kingdom Hearts Birth by Sleep</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="./bbs-commands.html">Command Melding</a></li>
|
<li><a href="./bbs/melding.html">Command Melding</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if cfg!(feature = "ddd") %}
|
{% if cfg!(feature = "ddd") %}
|
||||||
<h1>Kingdom Hearts Dream Drop Distance</h1>
|
<h1>Kingdom Hearts Dream Drop Distance</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="./ddd-abilities.html">Spirit Boards</a></li>
|
<li><a href="./ddd/boards.html">Spirit Boards</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if cfg!(feature = "kh3") %}
|
{% if cfg!(feature = "kh3") %}
|
||||||
<h1>Kingdom Hearts III</h1>
|
<h1>Kingdom Hearts III</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="./kh3-recipes.html">Food Simulator</a></li>
|
<li><a href="./kh3/food-sim.html">Food Simulator</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue