feat: support latex fragment parsing

This commit is contained in:
PoiScript 2023-11-18 23:57:45 +08:00
parent 2aec1768da
commit 4a3dd6aacb
No known key found for this signature in database
GPG key ID: 22C2B1249D99985E
6 changed files with 269 additions and 6 deletions

View file

@ -8,6 +8,7 @@ use super::{
inline_call::inline_call_node,
inline_src::inline_src_node,
input::Input,
latex_fragment::latex_fragment_node,
link::link_node,
macros::macros_node,
radio_target::radio_target_node,
@ -29,7 +30,9 @@ impl ObjectPositions<'_> {
input,
pos: 0,
next: Some(0),
finder: jetscii::bytes!(b'@', b'<', b'[', b' ', b'(', b'{', b'\'', b'"', b'\n'),
finder: jetscii::bytes!(
b'@', b'<', b'[', b' ', b'(', b'{', b'\'', b'"', b'\n', b'\\', b'$'
),
}
}
}
@ -142,6 +145,8 @@ fn object_node(i: Input) -> IResult<Input, GreenElement, ()> {
.or_else(|_| timestamp_inactive_node(i)),
b'c' => inline_call_node(i),
b's' => inline_src_node(i),
b'$' => latex_fragment_node(i),
b'\\' => latex_fragment_node(i),
_ => Err(nom::Err::Error(())),
}
}