diff --git a/src/export/html.rs b/src/export/html.rs
index 3348885..ab953a5 100644
--- a/src/export/html.rs
+++ b/src/export/html.rs
@@ -12,7 +12,7 @@ use crate::objects::Cookie;
pub trait HtmlHandler {
fn handle_headline_beg(&mut self, w: &mut W, hdl: Headline) -> Result<()> {
let level = if hdl.level <= 6 { hdl.level } else { 6 };
- write!(w, "{1}", level, hdl.title)
+ write!(w, "{1}", level, Escape(hdl.title))
}
fn handle_headline_end(&mut self, w: &mut W) -> Result<()> {
Ok(())
@@ -51,13 +51,13 @@ pub trait HtmlHandler {
Ok(())
}
fn handle_example_block(&mut self, w: &mut W, cont: &str, args: Option<&str>) -> Result<()> {
- write!(w, "{}
", cont)
+ write!(w, "{}
", Escape(cont))
}
fn handle_export_block(&mut self, w: &mut W, cont: &str, args: Option<&str>) -> Result<()> {
Ok(())
}
fn handle_src_block(&mut self, w: &mut W, cont: &str, args: Option<&str>) -> Result<()> {
- write!(w, "{}
", cont)
+ write!(w, "{}
", Escape(cont))
}
fn handle_verse_block(&mut self, w: &mut W, cont: &str, args: Option<&str>) -> Result<()> {
Ok(())
@@ -69,10 +69,18 @@ pub trait HtmlHandler {
Ok(())
}
fn handle_list_beg(&mut self, w: &mut W, ordered: bool) -> Result<()> {
- write!(w, "{}", if ordered { "" } else { "" })
+ if ordered {
+ write!(w, "")
+ } else {
+ write!(w, "")
+ }
}
fn handle_list_end(&mut self, w: &mut W, ordered: bool) -> Result<()> {
- write!(w, "{}", if ordered { "
" } else { "
" })
+ if ordered {
+ write!(w, "
")
+ } else {
+ write!(w, "")
+ }
}
fn handle_list_beg_item(&mut self, w: &mut W, bullet: &str) -> Result<()> {
write!(w, "")
@@ -90,7 +98,7 @@ pub trait HtmlHandler {
Ok(())
}
fn handle_fixed_width(&mut self, w: &mut W, cont: &str) -> Result<()> {
- write!(w, "{}
", cont)
+ write!(w, "{}
", Escape(cont))
}
fn handle_table_start(&mut self, w: &mut W) -> Result<()> {
Ok(())
@@ -136,13 +144,13 @@ pub trait HtmlHandler {
option: Option<&str>,
body: &str,
) -> Result<()> {
- write!(w, "{}
", body)
+ write!(w, "{}
", Escape(body))
}
fn handle_link(&mut self, w: &mut W, path: &str, desc: Option<&str>) -> Result<()> {
if let Some(desc) = desc {
- write!(w, r#"{}"#, path, desc)
+ write!(w, r#"{}"#, Escape(path), Escape(desc))
} else {
- write!(w, r#"{0}"#, path)
+ write!(w, r#"{0}"#, Escape(path))
}
}
fn handle_macros(&mut self, w: &mut W, name: &str, args: Option<&str>) -> Result<()> {
@@ -186,13 +194,13 @@ pub trait HtmlHandler {
write!(w, "")
}
fn handle_verbatim(&mut self, w: &mut W, cont: &str) -> Result<()> {
- write!(w, "{}
", cont)
+ write!(w, "{}
", Escape(cont))
}
fn handle_code(&mut self, w: &mut W, cont: &str) -> Result<()> {
- write!(w, "{}
", cont)
+ write!(w, "{}
", Escape(cont))
}
fn handle_text(&mut self, w: &mut W, cont: &str) -> Result<()> {
- write!(w, "{}", Escape(&cont))
+ write!(w, "{}", Escape(cont))
}
}