diff --git a/src/convert/npf/content_blocks.rs b/src/convert/npf/content_blocks.rs index 120dd5d..9872471 100644 --- a/src/convert/npf/content_blocks.rs +++ b/src/convert/npf/content_blocks.rs @@ -13,17 +13,6 @@ pub enum BlockValue { Audio(BlockAudio), Video(BlockVideo), } -impl BlockValue { - pub fn get_type(&self) -> String { - String::from(match &self { - BlockValue::Text(_) => "text", - BlockValue::Image(_) => "image", - BlockValue::Link(_) => "link", - BlockValue::Audio(_) => "audio", - BlockValue::Video(_) => "video", - }) - } -} #[derive(Debug, Deserialize, Serialize, Clone)] #[serde(rename_all = "snake_case")] diff --git a/src/convert/npf/objects_post.rs b/src/convert/npf/objects_post.rs index 8363e53..e4393ad 100644 --- a/src/convert/npf/objects_post.rs +++ b/src/convert/npf/objects_post.rs @@ -62,7 +62,10 @@ impl Post { } pub fn fold_content(mut self) -> Self { // TODO: Some form of folding also the layout of the npf - let groups = self.content.iter_mut().group_by(|c| c.get_type() == "text"); + let groups = self.content.iter_mut().group_by(|c| match c { + BlockValue::Text(_) => true, + _ => false, + }); self.content = groups .into_iter() .map(|a| {