diff options
Diffstat (limited to 'src/templates.rs')
-rw-r--r-- | src/templates.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/templates.rs b/src/templates.rs index bb285fa..257c41e 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -1,5 +1,3 @@ -use std::borrow::Cow; - use askama::Template; use crate::state::State; @@ -11,13 +9,20 @@ pub struct Index<'a> { } #[derive(Template)] -#[template(path = "about.html")] -pub struct About<'a> { - pub path: &'a str, - pub readme: Cow<'a, str>, +#[template(path = "repo_folder.html")] +pub struct RepoFolder<'a> { + pub repo: &'a git2::Repository, + pub repo_path: &'a str, + pub title: &'a str, + pub rel_path: &'a str, + pub tree: git2::Tree<'a>, } mod filters { + pub fn from_utf8_lossy(utf8: &[u8]) -> ::askama::Result<String> { + Ok(String::from_utf8_lossy(utf8).into_owned()) + } + pub fn markdown(s: &str) -> ::askama::Result<String> { use pulldown_cmark::{Parser, Options, html}; |