X-Git-Url: http://git.scottworley.com/tablify/blobdiff_plain/722ea29747d6e820490db0bf988cda86c3341565..529cbaa2f61a4318ea6e6982f7ff08c44cbcf1ab:/src/lib.rs?ds=inline diff --git a/src/lib.rs b/src/lib.rs index e11f08b..fbadb2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,6 +18,7 @@ const HEADER: &str = r#" /* h/t https://wabain.github.io/2019/10/13/css-rotated-table-header.html */ th, td { white-space: nowrap; } th { text-align: left; font-weight: normal; } + th.spacer_row { height: .3em; } table { border-collapse: collapse } tr.key > th { height: 10em; vertical-align: bottom; line-height: 1 } tr.key > th > div { width: 1em; } @@ -138,7 +139,7 @@ impl>> Iterator for Reader InputLine::Blank if self.row.is_some() => { return Ok(std::mem::take(&mut self.row).map(Rowlike::Row)).transpose() } - InputLine::Blank => {} + InputLine::Blank => return Some(Ok(Rowlike::Spacer)), InputLine::Entry(col, instance) => match &mut self.row { None => { return Some(Err(std::io::Error::other(format!( @@ -265,7 +266,7 @@ fn render_all_leftovers(row: &Row) -> HTML { fn render_row(columns: &[String], rowlike: &mut Rowlike) -> HTML { match rowlike { - Rowlike::Spacer => HTML::from(" "), + Rowlike::Spacer => HTML::from("\n"), Rowlike::Row(row) => { let row_label = HTML::escape(row.label.as_ref()); let cells = columns @@ -419,6 +420,7 @@ mod tests { label: "foo".to_owned(), entries: HashMap::new(), }), + Rowlike::Spacer, Rowlike::Row(Row { label: "bar".to_owned(), entries: HashMap::new(),