From ce2e48d7a39fecf0e5c3ea0e16a4fa2de535518b Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 13 Jul 2020 21:37:05 -0700 Subject: inline styles --- src/epub.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/epub.rs') diff --git a/src/epub.rs b/src/epub.rs index b5510c8..fb0445a 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -141,9 +141,23 @@ fn render(n: Node, buf: &mut String, attrs: &mut Attrs) { for c in n.children() { render(c, buf, attrs); } - attrs.push((buf.len(), Attribute::Reset)); + attrs.push((buf.len(), Attribute::NoBold)); buf.push('\n'); } + "em" => { + attrs.push((buf.len(), Attribute::Italic)); + for c in n.children() { + render(c, buf, attrs); + } + attrs.push((buf.len(), Attribute::NoItalic)); + } + "strong" => { + attrs.push((buf.len(), Attribute::Bold)); + for c in n.children() { + render(c, buf, attrs); + } + attrs.push((buf.len(), Attribute::NoBold)); + } "blockquote" | "p" | "tr" => { buf.push('\n'); for c in n.children() { -- cgit v1.2.3