aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-04-19 09:17:42 -0700
committerJames Campos <james.r.campos@gmail.com>2020-04-19 09:17:42 -0700
commit4c47c95d8823ae04197f5c3d036180cee9a962d5 (patch)
tree23b49306b45ef00f23b2b127e041307e2953b61f
parent8c47c3e1cf59065eaf0d8e832d33255fab77bfe6 (diff)
downloadbk-4c47c95d8823ae04197f5c3d036180cee9a962d5.tar.gz
header descendants
-rw-r--r--src/main.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 1edece5..fabdafe 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -130,13 +130,7 @@ impl Bk {
let mut chapter = Vec::new();
for n in doc.descendants() {
match n.tag_name().name() {
- "h1" | "h2" | "h3" | "h4" | "h5" | "h6" => {
- let text = n.descendants().find(|n| n.is_text()).unwrap();
- chapter.push(format!("# {}", text.text().unwrap()));
- chapter.push(String::from(""));
- }
- //"div" => chapter.push(String::from("")),
- "p" => {
+ "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" => {
chapter.push(n.descendants()
.filter(|n| n.is_text())
.map(|n| n.text().unwrap())