Add render phase to tables.

This commit is contained in:
Tom Alexander
2023-10-31 20:29:37 -04:00
parent 386af57ce6
commit b654ca4859
5 changed files with 117 additions and 3 deletions

View File

@@ -6,11 +6,37 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ITable;
use super::macros::rnoop;
use super::macros::render;
use super::table_row::RenderTableRow;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "table")]
pub(crate) struct RenderTable {}
pub(crate) struct RenderTable {
children: Vec<RenderTableRow>,
}
rnoop!(RenderTable, ITable);
render!(
RenderTable,
ITable,
original,
config,
output_directory,
output_file,
{
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(RenderTableRow::new(
config,
output_directory,
output_file,
obj,
)?);
}
ret
};
Ok(RenderTable { children })
}
);