Highlight current module in the sidebar.
This commit is contained in:
@@ -46,6 +46,15 @@ struct ModuleTemplate<'a> {
|
||||
timestamp: String,
|
||||
}
|
||||
|
||||
impl<'a> ModuleTemplate<'a> {
|
||||
pub fn is_current_module(&self, module: &DocLink) -> bool {
|
||||
match module.path.split(".html").next() {
|
||||
None => false,
|
||||
Some(name) => self.module_name == name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "page.html")]
|
||||
struct PageTemplate<'a> {
|
||||
@@ -61,6 +70,12 @@ struct PageTemplate<'a> {
|
||||
timestamp: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> PageTemplate<'a> {
|
||||
pub fn is_current_module(&self, _module: &DocLink) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone)]
|
||||
struct DocLink {
|
||||
name: String,
|
||||
|
||||
Reference in New Issue
Block a user