Add intermediate stage for tables.

This commit is contained in:
Tom Alexander 2023-10-31 20:26:34 -04:00
parent ef4d315bf2
commit 386af57ce6
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 62 additions and 2 deletions

View File

@ -56,6 +56,8 @@ mod strike_through;
mod subscript;
mod superscript;
mod table;
mod table_cell;
mod table_row;
mod target;
mod timestamp;
mod underline;

View File

@ -1,5 +1,21 @@
use super::macros::inoop;
use super::macros::intermediate;
use super::table_row::ITableRow;
use crate::error::CustomError;
inoop!(ITable, Table);
#[derive(Debug, Clone)]
pub(crate) struct ITable {
pub(crate) children: Vec<ITableRow>,
}
intermediate!(ITable, Table, original, registry, {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(ITableRow::new(registry.clone(), obj).await?);
}
ret
};
Ok(ITable { children })
});

View File

@ -0,0 +1,21 @@
use super::macros::intermediate;
use super::IObject;
use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct ITableCell {
pub(crate) children: Vec<IObject>,
}
intermediate!(ITableCell, TableCell, original, registry, {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IObject::new(registry.clone(), obj).await?);
}
ret
};
Ok(ITableCell { children })
});

View File

@ -0,0 +1,21 @@
use super::macros::intermediate;
use super::table_cell::ITableCell;
use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct ITableRow {
pub(crate) children: Vec<ITableCell>,
}
intermediate!(ITableRow, TableRow, original, registry, {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(ITableCell::new(registry.clone(), obj).await?);
}
ret
};
Ok(ITableRow { children })
});