diff --git a/default_environment/templates/html/plain_list_item.dust b/default_environment/templates/html/plain_list_item.dust index 2e0c0e8..8634420 100644 --- a/default_environment/templates/html/plain_list_item.dust +++ b/default_environment/templates/html/plain_list_item.dust @@ -1,6 +1,6 @@ {@select key=list_type} - {@eq value="unordered"}
  • {/eq} - {@eq value="ordered"}
  • {/eq} - {@eq value="descriptive"}
    {/eq} + {@eq value="unordered"}
  • {#.children}{>element/}{/.children}
  • {/eq} + {@eq value="ordered"}
  • {#.children}{>element/}{/.children}
  • {/eq} + {@eq value="descriptive"}
    {#.tag}{>object/}{/.tag}
    {#.children}{>element/}{/.children}
    {/eq} {@none}{!TODO: make this panic!}ERROR: Unrecognized list type {.list_type}.{/none} {/select} diff --git a/src/context/plain_list_item.rs b/src/context/plain_list_item.rs index b99723c..0cfe106 100644 --- a/src/context/plain_list_item.rs +++ b/src/context/plain_list_item.rs @@ -6,10 +6,16 @@ use crate::config::Config; use crate::error::CustomError; use crate::intermediate::IPlainListItem; +use super::RenderElement; +use super::RenderObject; + #[derive(Debug, Serialize)] #[serde(tag = "type")] #[serde(rename = "plain_list_item")] -pub(crate) struct RenderPlainListItem {} +pub(crate) struct RenderPlainListItem { + tag: Vec, + children: Vec, +} impl RenderPlainListItem { pub(crate) fn new( @@ -18,6 +24,31 @@ impl RenderPlainListItem { output_file: &Path, original: &IPlainListItem, ) -> Result { - Ok(RenderPlainListItem {}) + let tag = { + let mut ret = Vec::new(); + for obj in original.tag.iter() { + ret.push(RenderObject::new( + config, + &output_directory, + &output_file, + obj, + )?); + } + ret + }; + + let children = { + let mut ret = Vec::new(); + for obj in original.children.iter() { + ret.push(RenderElement::new( + config, + &output_directory, + &output_file, + obj, + )?); + } + ret + }; + Ok(RenderPlainListItem { tag, children }) } } diff --git a/src/intermediate/plain_list_item.rs b/src/intermediate/plain_list_item.rs index f9cd396..8a77b9a 100644 --- a/src/intermediate/plain_list_item.rs +++ b/src/intermediate/plain_list_item.rs @@ -1,15 +1,36 @@ use crate::error::CustomError; use super::registry::Registry; +use super::IElement; +use super::IObject; #[derive(Debug)] -pub(crate) struct IPlainListItem {} +pub(crate) struct IPlainListItem { + pub(crate) tag: Vec, + pub(crate) children: Vec, +} impl IPlainListItem { pub(crate) async fn new<'parse>( registry: &mut Registry<'parse>, plain_list_item: &organic::types::PlainListItem<'parse>, ) -> Result { - Ok(IPlainListItem {}) + let tag = { + let mut ret = Vec::new(); + for obj in plain_list_item.tag.iter() { + ret.push(IObject::new(registry, obj).await?); + } + ret + }; + + let children = { + let mut ret = Vec::new(); + for elem in plain_list_item.children.iter() { + ret.push(IElement::new(registry, elem).await?); + } + ret + }; + + Ok(IPlainListItem { tag, children }) } }