Update getting the previous character and previous line.
This can be done a lot more efficiently now that we are keeping track of this information in the wrapped input type instead of having to fetch to the original document out of the context tree.
This commit is contained in:
@@ -25,7 +25,6 @@ use crate::parser::parser_context::SubscriptSuperscriptBrace;
|
||||
use crate::parser::parser_with_context::parser_with_context;
|
||||
use crate::parser::util::exit_matcher_parser;
|
||||
use crate::parser::util::get_consumed;
|
||||
use crate::parser::util::get_one_before;
|
||||
use crate::parser::Subscript;
|
||||
use crate::parser::Superscript;
|
||||
|
||||
@@ -69,10 +68,7 @@ pub fn superscript<'r, 's>(
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn pre<'r, 's>(context: Context<'r, 's>, input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
let document_root = context.get_document_root().unwrap();
|
||||
let preceding_character = get_one_before(document_root, input)
|
||||
.map(|slice| slice.chars().next())
|
||||
.flatten();
|
||||
let preceding_character = input.get_preceding_character();
|
||||
match preceding_character {
|
||||
Some(c) if !c.is_whitespace() => {}
|
||||
_ => {
|
||||
|
||||
Reference in New Issue
Block a user