aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2021-10-27 23:59:59 -0700
committerJames Campos <james.r.campos@gmail.com>2021-10-27 23:59:59 -0700
commit61beded518e759884d72732a068744935c11ea6f (patch)
tree0078f7bb3bb7e52331903fcc292085b907c3623b
parent4d1af5f00d0aa5bf41b9a24a818f2aab1a4db26c (diff)
downloadbk-61beded518e759884d72732a068744935c11ea6f.tar.gz
pre tags
Co-authored-by: jonseitz <mail@jonathanseitz.com>
-rw-r--r--src/epub.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/epub.rs b/src/epub.rs
index a52c9d0..f70964c 100644
--- a/src/epub.rs
+++ b/src/epub.rs
@@ -225,6 +225,15 @@ fn render(n: Node, c: &mut Chapter) {
c.render_text(n);
c.text.push('\n');
}
+ "pre" => {
+ c.text.push_str("\n ");
+ n
+ .descendants()
+ .filter(Node::is_text)
+ .map(|n| n.text().unwrap().replace('\n', "\n "))
+ .for_each(|s| c.text.push_str(&s));
+ c.text.push('\n');
+ }
_ => c.render_text(n),
}
}