implemented main
parent
7fce2ee0e4
commit
39434803fc
|
@ -0,0 +1,37 @@
|
|||
pub mod distro;
|
||||
|
||||
use tera::{Tera, Context};
|
||||
use distro::{DistroList, Distro};
|
||||
|
||||
fn main() {
|
||||
let tera = match Tera::new("templates/**/*.html") {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
println!("Parsing error: {}", e);
|
||||
panic!("parsing error");
|
||||
}
|
||||
};
|
||||
let distro = Distro {
|
||||
name: "fedora".to_owned(),
|
||||
summary: "AAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaa".to_string(),
|
||||
icon_url: "assets/distro-icon-fedora.png".to_owned(),
|
||||
wiki: "".to_owned(), download: "".to_owned(), website: "".to_owned(),
|
||||
freedom_positives: vec!["a".to_string(), "b".to_string(), "c".to_string()],
|
||||
freedom_negatives: vec!["a".to_string(), "b".to_string(), "c".to_string()],
|
||||
freedom_stars: 2,
|
||||
usability_positives: vec!["a".to_string(), "b".to_string(), "c".to_string()],
|
||||
usability_negatives: vec!["a".to_string(), "b".to_string(), "c".to_string()],
|
||||
usability_stars: 3,
|
||||
privacy_positives: vec!["a".to_string(), "b".to_string(), "c".to_string()],
|
||||
privacy_negatives: vec!["a".to_string(), "b".to_string(), "c".to_string()],
|
||||
privacy_stars: 3,
|
||||
};
|
||||
let distros: DistroList = DistroList {
|
||||
distros: vec![distro.to_owned(), distro.to_owned()]
|
||||
};
|
||||
|
||||
let context = Context::from_serialize(distros).unwrap();
|
||||
|
||||
let html = tera.render("index.html", &context).unwrap();
|
||||
println!("{}", html);
|
||||
}
|
Loading…
Reference in New Issue