feat: fixed width areas

This commit is contained in:
PoiScript 2019-01-21 23:04:35 +08:00
parent 918b14de52
commit 19f7bacf55
5 changed files with 17 additions and 1 deletions

View file

@ -90,6 +90,9 @@ impl<W: Write> Handler<W> for HtmlHandler {
fn handle_comment(&mut self, w: &mut W, cont: &str) -> Result<()> {
Ok(())
}
fn handle_fixed_width(&mut self, w: &mut W, cont: &str) -> Result<()> {
write!(w, "<pre>{}</pre>", cont)
}
fn handle_table_start(&mut self, w: &mut W) -> Result<()> {
Ok(())
}

View file

@ -35,6 +35,7 @@ pub trait Handler<W: Write> {
fn handle_call(&mut self, w: &mut W) -> Result<()>;
fn handle_clock(&mut self, w: &mut W) -> Result<()>;
fn handle_comment(&mut self, w: &mut W, cont: &str) -> Result<()>;
fn handle_fixed_width(&mut self, w: &mut W, cont: &str) -> Result<()>;
fn handle_table_start(&mut self, w: &mut W) -> Result<()>;
fn handle_table_end(&mut self, w: &mut W) -> Result<()>;
fn handle_table_cell(&mut self, w: &mut W) -> Result<()>;
@ -118,6 +119,7 @@ impl<'a, W: Write, H: Handler<W>> Render<'a, W, H> {
Call => h.handle_call(w)?,
Clock => h.handle_clock(w)?,
Comment(c) => h.handle_comment(w, c)?,
FixedWidth(f) => h.handle_fixed_width(w, f)?,
TableStart => h.handle_table_start(w)?,
TableEnd => h.handle_table_end(w)?,
TableCell => h.handle_table_cell(w)?,