Handle nesting of brackets.
This commit is contained in:
parent
885fefd060
commit
fa97124186
@ -113,17 +113,14 @@ fn babel_call_call<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn inside_header<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
let (remaining, _) = tag("[")(input)?;
|
||||
|
||||
let contents_start = remaining;
|
||||
let (remaining, contents) = opt(recognize(many_till(
|
||||
anychar,
|
||||
alt((
|
||||
peek(recognize(one_of("]"))),
|
||||
recognize(tuple((space0, org_line_ending))),
|
||||
)),
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag("]")(remaining)?;
|
||||
let (remaining, contents) = balanced_bracket(
|
||||
|i| tag("[")(i),
|
||||
|i| peek(tag("]"))(i),
|
||||
|i| recognize(tuple((space0, org_line_ending)))(i),
|
||||
|i| tag("]")(i),
|
||||
|s| s.get_bracket_depth(),
|
||||
)(input)?;
|
||||
let (contents_start, _) = tag("[")(input)?;
|
||||
Ok((remaining, contents.unwrap_or(contents_start.take(0))))
|
||||
}
|
||||
|
||||
@ -136,30 +133,6 @@ fn arguments<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, Option<OrgSource<'s
|
||||
|i| tag(")")(i),
|
||||
|s| s.get_parenthesis_depth(),
|
||||
)(input)
|
||||
|
||||
// impl_balanced_bracket(
|
||||
// input,
|
||||
// |i| tag("(")(i),
|
||||
// |i| peek(tag(")"))(i),
|
||||
// |i| recognize(tuple((space0, org_line_ending)))(i),
|
||||
// |i| tag(")")(i),
|
||||
// |s| s.get_parenthesis_depth(),
|
||||
// )
|
||||
|
||||
// let (remaining, _) = tag("(")(input)?;
|
||||
|
||||
// let (remaining, contents) = opt(verify(
|
||||
// recognize(many_till(
|
||||
// anychar,
|
||||
// alt((
|
||||
// peek(recognize(one_of(")"))),
|
||||
// recognize(tuple((space0, org_line_ending))),
|
||||
// )),
|
||||
// )),
|
||||
// |s| s.len() > 0,
|
||||
// ))(remaining)?;
|
||||
// let (remaining, _) = tag(")")(remaining)?;
|
||||
// Ok((remaining, contents))
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
|
Loading…
x
Reference in New Issue
Block a user