2023-10-29 17:29:16 -04:00
|
|
|
use super::macros::intermediate;
|
2023-10-29 22:31:29 -04:00
|
|
|
|
2023-10-29 17:29:16 -04:00
|
|
|
use crate::error::CustomError;
|
2023-10-27 17:08:58 -04:00
|
|
|
|
2023-10-29 15:36:15 -04:00
|
|
|
#[derive(Debug, Clone)]
|
2023-10-29 09:37:27 -04:00
|
|
|
pub(crate) struct ISrcBlock {
|
|
|
|
pub(crate) lines: Vec<String>,
|
2023-12-21 12:07:36 -05:00
|
|
|
pub(crate) language: Option<String>,
|
2023-10-29 09:37:27 -04:00
|
|
|
}
|
2023-10-27 17:08:58 -04:00
|
|
|
|
2023-12-19 17:09:11 -05:00
|
|
|
intermediate!(
|
|
|
|
ISrcBlock,
|
|
|
|
&'orig organic::types::SrcBlock<'parse>,
|
|
|
|
original,
|
|
|
|
_registry,
|
|
|
|
{
|
|
|
|
let lines = original
|
|
|
|
.get_value()
|
|
|
|
.split_inclusive('\n')
|
|
|
|
.map(|s| s.to_owned())
|
|
|
|
.collect();
|
2023-12-21 12:07:36 -05:00
|
|
|
let language = original.language.map(str::to_owned);
|
|
|
|
Ok(ISrcBlock { lines, language })
|
2023-12-19 17:09:11 -05:00
|
|
|
}
|
|
|
|
);
|