summaryrefslogtreecommitdiffstats
path: root/src/view/mod.rs
blob: 3084867a6eec330be7b3f7301ba21f92470cf978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
pub mod blob;
pub mod branch;
pub mod data;
pub mod partials;
pub mod repos;

pub fn setup_handlebars<'r>() -> anyhow::Result<handlebars::Handlebars<'r>> {
    let mut hb = handlebars::Handlebars::new();
    hb.set_strict_mode(true);

    hb.register_partial(crate::templates::partials::branchlist::NAME, std::include_str!("../templates/partials/branchlist.template"))?;
    hb.register_partial(crate::templates::partials::sidebar::NAME, std::include_str!("../templates/partials/sidebar.template"))?;
    hb.register_partial(crate::templates::partials::taglist::NAME, std::include_str!("../templates/partials/taglist.template"))?;
    hb.register_partial(crate::templates::partials::tree::NAME, std::include_str!("../templates/partials/tree.template"))?;

    hb.register_template_string(crate::templates::base::NAME,   std::include_str!("../templates/base.template"))?;
    hb.register_template_string(crate::templates::repos::NAME,  std::include_str!("../templates/repos.template"))?;
    hb.register_template_string(crate::templates::branch::NAME, std::include_str!("../templates/branch.template"))?;
    hb.register_template_string(crate::templates::blob::NAME,   std::include_str!("../templates/blob.template"))?;
    hb.register_template_string(crate::templates::tree::NAME,   std::include_str!("../templates/tree.template"))?;

    Ok(hb)
}