Extract config text parsing into the type

This commit is contained in:
Juno Takano 2025-12-17 10:15:21 -03:00
commit 99b9feeb95
3 changed files with 22 additions and 15 deletions

View file

@ -2,6 +2,8 @@ use std::collections::HashMap;
use serde::{Serialize, Deserialize};
use crate::syntax::content::parsers::{compound::elements::literal::Literal, line::elements::{paragraph::Paragraph, span::Span}};
#[derive(Serialize, Deserialize, Clone, Default, PartialEq, Eq, Debug)]
pub struct Graph {
pub nodes: HashMap<String, Node>,
@ -149,3 +151,19 @@ impl Node {
}
}
}
impl Config {
#[must_use]
pub fn parse_text(self) -> Config {
Config {
footer_text: crate::syntax::content::parse::<Span, Literal>(
&self.footer_text,
),
about_text: crate::syntax::content::parse::<Paragraph, Literal>(
&self.about_text,
),
..self
}
}
}