aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-09-23 17:54:10 -0700
committerJames Campos <james.r.campos@gmail.com>2020-09-23 17:54:10 -0700
commit139c3d96fc7ee8cd29f2c704913e8f57ea84f867 (patch)
treeb4cc5e4ae448f304837ab261a15f62d0bdd0999f /src
parent0b267abb97922fd6e9f07f63e77b5b066cdaaa9a (diff)
downloadbk-139c3d96fc7ee8cd29f2c704913e8f57ea84f867.tar.gz
check all non-text nodes for ids
Diffstat (limited to 'src')
-rw-r--r--src/epub.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/epub.rs b/src/epub.rs
index 2df924c..25d4cd6 100644
--- a/src/epub.rs
+++ b/src/epub.rs
@@ -176,6 +176,10 @@ fn render(n: Node, c: &mut Chapter) {
return;
}
+ if let Some(id) = n.attribute("id") {
+ c.frag.push((id.to_string(), c.text.len()));
+ }
+
match n.tag_name().name() {
"br" => c.text.push('\n'),
"hr" => c.text.push_str("\n* * *\n"),
@@ -185,8 +189,6 @@ fn render(n: Node, c: &mut Chapter) {
let start = c.text.len();
c.render(n, Attribute::Underlined, Attribute::NoUnderline);
c.links.push((start, c.text.len(), url.to_string()));
- } else if let Some(id) = n.attribute("id") {
- c.frag.push((id.to_string(), c.text.len()));
}
}
"em" => c.render(n, Attribute::Italic, Attribute::NoItalic),