aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/epub.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/epub.rs b/src/epub.rs
index 5551e3e..9c53551 100644
--- a/src/epub.rs
+++ b/src/epub.rs
@@ -193,15 +193,14 @@ fn render(n: Node, c: &mut Chapter) {
"hr" => c.text.push_str("\n* * *\n"),
"img" => c.text.push_str("\n[IMG]\n"),
"a" => {
- if let Some(url) = n.attribute("href") {
- if url.starts_with("http") {
- // TODO open in browser
- c.render_text(n)
- } else {
+ match n.attribute("href") {
+ // TODO open external urls in browser
+ Some(url) if !url.starts_with("http") => {
let start = c.text.len();
c.render(n, Attribute::Underlined, Attribute::NoUnderline);
c.links.push((start, c.text.len(), url.to_string()));
}
+ _ => c.render_text(n)
}
}
"em" => c.render(n, Attribute::Italic, Attribute::NoItalic),