From 61beded518e759884d72732a068744935c11ea6f Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 27 Oct 2021 23:59:59 -0700 Subject: pre tags Co-authored-by: jonseitz --- src/epub.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') 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), } } -- cgit v1.2.3