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-27 14:23:05 +00:00
|
|
|
#[derive(Debug)]
|
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 16:15:07 +00:00
|
|
|
pub(crate) async fn new<'intermediate, 'parse>(
|
|
|
|
registry: &mut Registry<'intermediate, 'parse>,
|
2023-10-27 19:55:19 +00:00
|
|
|
plain_text: &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(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|