From 9eac5fdb1d4931d3fb776b289883aacc436affbf Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 25 Apr 2020 16:10:50 -0700 Subject: li --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 68f3b46..7b9c21b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -196,6 +196,7 @@ impl Bk { rows: rows as usize, }; bk.get_chapter(chapter_idx); + bk.pos = pos; Ok(bk) } fn get_chapter(&mut self, idx: usize) { @@ -228,6 +229,15 @@ impl Bk { ); chapter.push(String::from("")); } + "li" => { + chapter.push( + n.descendants() + .filter(|n| n.is_text()) + .map(|n| format!("- {}", n.text().unwrap())) + .collect(), + ); + chapter.push(String::from("")); + } _ => (), } } @@ -306,7 +316,7 @@ impl Bk { Event::Key(e) => match e.code { KeyCode::Esc | KeyCode::Char('q') => return false, KeyCode::Tab => self.start_nav(), - KeyCode::Char('?') => self.mode = Mode::Help, + KeyCode::F(1) | KeyCode::Char('?') => self.mode = Mode::Help, KeyCode::Char('p') => { if self.chapter_idx > 0 { self.get_chapter(self.chapter_idx - 1); @@ -404,7 +414,7 @@ impl Bk { fn render_help(&self) { let text = r#" Esc q Quit - ? Help + F1 ? Help Tab Table of Contents PageDown Right Space f l Page Down PageUp Left b h Page Up -- cgit v1.2.3