2023-10-27 14:23:05 +00:00
|
|
|
use crate::error::CustomError;
|
2023-10-27 17:05:34 +00:00
|
|
|
use crate::intermediate::util::coalesce_whitespace;
|
2023-10-27 14:23:05 +00:00
|
|
|
|
2023-10-27 18:43:06 +00:00
|
|
|
use super::registry::Registry;
|
|
|
|
|
2023-10-29 19:36:15 +00:00
|
|
|
#[derive(Debug, Clone)]
|
2023-10-27 17:05:34 +00:00
|
|
|
pub(crate) struct IPlainText {
|
2023-10-27 23:42:33 +00:00
|
|
|
pub(crate) source: String,
|
2023-10-27 14:23:05 +00:00
|
|
|
}
|
|
|
|
|
2023-10-27 17:05:34 +00:00
|
|
|
impl IPlainText {
|
2023-10-29 18:14:10 +00:00
|
|
|
pub(crate) async fn new<'b, 'parse>(
|
|
|
|
registry: &'b mut Registry<'parse>,
|
|
|
|
plain_text: &'b organic::types::PlainText<'parse>,
|
2023-10-27 17:05:34 +00:00
|
|
|
) -> Result<IPlainText, CustomError> {
|
|
|
|
Ok(IPlainText {
|
2023-10-27 14:23:05 +00:00
|
|
|
source: coalesce_whitespace(plain_text.source).into_owned(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|