]> git.scottworley.com Git - tablify/blobdiff - src/lib.rs
Double blank lines in the input generate spacer rows
[tablify] / src / lib.rs
index e11f08b7f623f921b4df1ead0f429d318c7f6219..744dc66d5dd9d478ddb73fb7e9b88af01ba32129 100644 (file)
@@ -138,7 +138,7 @@ impl<Input: Iterator<Item = Result<String, std::io::Error>>> Iterator for Reader
                     InputLine::Blank if self.row.is_some() => {
                         return Ok(std::mem::take(&mut self.row).map(Rowlike::Row)).transpose()
                     }
                     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!(
                     InputLine::Entry(col, instance) => match &mut self.row {
                         None => {
                             return Some(Err(std::io::Error::other(format!(
@@ -419,6 +419,7 @@ mod tests {
                     label: "foo".to_owned(),
                     entries: HashMap::new(),
                 }),
                     label: "foo".to_owned(),
                     entries: HashMap::new(),
                 }),
+                Rowlike::Spacer,
                 Rowlike::Row(Row {
                     label: "bar".to_owned(),
                     entries: HashMap::new(),
                 Rowlike::Row(Row {
                     label: "bar".to_owned(),
                     entries: HashMap::new(),