Copy the value of latex fragments through the pipeline.
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
use super::macros::inoop;
|
||||
use super::macros::intermediate;
|
||||
|
||||
use crate::error::CustomError;
|
||||
|
||||
inoop!(ILatexFragment, LatexFragment);
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ILatexFragment {
|
||||
pub(crate) value: String,
|
||||
}
|
||||
|
||||
intermediate!(ILatexFragment, LatexFragment, original, _registry, {
|
||||
let value: String = if original.value.starts_with("$$") && original.value.ends_with("$$") {
|
||||
format!("\\[{}\\]", &original.value[2..(original.value.len() - 2)])
|
||||
} else if original.value.starts_with("$") && original.value.ends_with("$") {
|
||||
format!("\\({}\\)", &original.value[1..(original.value.len() - 1)])
|
||||
} else {
|
||||
original.value.to_owned()
|
||||
};
|
||||
Ok(ILatexFragment { value })
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user