Merge branch 'table'
This commit is contained in:
commit
e8963e107b
@ -1 +1 @@
|
||||
!!!!!!!! table
|
||||
<table>{#.children}{>table_row/}{/.children}</table>
|
||||
|
1
default_environment/templates/html/table_cell.dust
Normal file
1
default_environment/templates/html/table_cell.dust
Normal file
@ -0,0 +1 @@
|
||||
<td>{#.children}{>object/}{/.children}</td>
|
1
default_environment/templates/html/table_row.dust
Normal file
1
default_environment/templates/html/table_row.dust
Normal file
@ -0,0 +1 @@
|
||||
<tr>{#.children}{>table_cell/}{/.children}</tr>
|
@ -54,6 +54,8 @@ mod strike_through;
|
||||
mod subscript;
|
||||
mod superscript;
|
||||
mod table;
|
||||
mod table_cell;
|
||||
mod table_row;
|
||||
mod target;
|
||||
mod timestamp;
|
||||
mod underline;
|
||||
|
@ -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 })
|
||||
}
|
||||
);
|
||||
|
42
src/context/table_cell.rs
Normal file
42
src/context/table_cell.rs
Normal file
@ -0,0 +1,42 @@
|
||||
use std::path::Path;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::ITableCell;
|
||||
|
||||
use super::macros::render;
|
||||
use super::RenderObject;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "table_cell")]
|
||||
pub(crate) struct RenderTableCell {
|
||||
children: Vec<RenderObject>,
|
||||
}
|
||||
|
||||
render!(
|
||||
RenderTableCell,
|
||||
ITableCell,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderObject::new(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
obj,
|
||||
)?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(RenderTableCell { children })
|
||||
}
|
||||
);
|
42
src/context/table_row.rs
Normal file
42
src/context/table_row.rs
Normal file
@ -0,0 +1,42 @@
|
||||
use std::path::Path;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::ITableRow;
|
||||
|
||||
use super::macros::render;
|
||||
use super::table_cell::RenderTableCell;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "table_row")]
|
||||
pub(crate) struct RenderTableRow {
|
||||
children: Vec<RenderTableCell>,
|
||||
}
|
||||
|
||||
render!(
|
||||
RenderTableRow,
|
||||
ITableRow,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderTableCell::new(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
obj,
|
||||
)?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(RenderTableRow { children })
|
||||
}
|
||||
);
|
@ -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;
|
||||
@ -119,6 +121,8 @@ pub(crate) use strike_through::IStrikeThrough;
|
||||
pub(crate) use subscript::ISubscript;
|
||||
pub(crate) use superscript::ISuperscript;
|
||||
pub(crate) use table::ITable;
|
||||
pub(crate) use table_cell::ITableCell;
|
||||
pub(crate) use table_row::ITableRow;
|
||||
pub(crate) use target::ITarget;
|
||||
pub(crate) use timestamp::ITimestamp;
|
||||
pub(crate) use underline::IUnderline;
|
||||
|
@ -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 })
|
||||
});
|
||||
|
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…
Reference in New Issue
Block a user