Add intermediate stage for tables.
This commit is contained in:
parent
ef4d315bf2
commit
386af57ce6
@ -56,6 +56,8 @@ mod strike_through;
|
|||||||
mod subscript;
|
mod subscript;
|
||||||
mod superscript;
|
mod superscript;
|
||||||
mod table;
|
mod table;
|
||||||
|
mod table_cell;
|
||||||
|
mod table_row;
|
||||||
mod target;
|
mod target;
|
||||||
mod timestamp;
|
mod timestamp;
|
||||||
mod underline;
|
mod underline;
|
||||||
|
@ -1,5 +1,21 @@
|
|||||||
use super::macros::inoop;
|
use super::macros::intermediate;
|
||||||
|
|
||||||
|
use super::table_row::ITableRow;
|
||||||
use crate::error::CustomError;
|
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 })
|
||||||
|
});
|
||||||
|
21
src/intermediate/table_cell.rs
Normal file
21
src/intermediate/table_cell.rs
Normal 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 })
|
||||||
|
});
|
21
src/intermediate/table_row.rs
Normal file
21
src/intermediate/table_row.rs
Normal 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 })
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user