Fix footnote definition end matcher detecting the next footnote definition.
This commit is contained in:
parent
71bc1a5679
commit
c6fd04e9ce
@ -83,10 +83,18 @@ fn footnote_definition_end<'r, 's>(
|
|||||||
input: &'s str,
|
input: &'s str,
|
||||||
) -> Res<&'s str, &'s str> {
|
) -> Res<&'s str, &'s str> {
|
||||||
let start_of_line_matcher = parser_with_context!(start_of_line)(context);
|
let start_of_line_matcher = parser_with_context!(start_of_line)(context);
|
||||||
let footnote_definition_matcher = parser_with_context!(footnote_definition)(context);
|
let allow_nesting_context =
|
||||||
|
context.with_additional_node(ContextElement::Context("allow nesting footnotes"));
|
||||||
|
let footnote_definition_matcher = parser_with_context!(footnote_definition)(
|
||||||
|
if immediate_in_section(context, "footnote definition") {
|
||||||
|
&allow_nesting_context
|
||||||
|
} else {
|
||||||
|
context
|
||||||
|
},
|
||||||
|
);
|
||||||
let maybe_consume_trailing_whitespace_matcher =
|
let maybe_consume_trailing_whitespace_matcher =
|
||||||
parser_with_context!(maybe_consume_trailing_whitespace)(context);
|
parser_with_context!(maybe_consume_trailing_whitespace)(context);
|
||||||
alt((
|
let (remaining, source) = alt((
|
||||||
recognize(tuple((
|
recognize(tuple((
|
||||||
maybe_consume_trailing_whitespace_matcher,
|
maybe_consume_trailing_whitespace_matcher,
|
||||||
footnote_definition_matcher,
|
footnote_definition_matcher,
|
||||||
@ -95,7 +103,9 @@ fn footnote_definition_end<'r, 's>(
|
|||||||
start_of_line_matcher,
|
start_of_line_matcher,
|
||||||
verify(many1(blank_line), |lines: &Vec<&str>| lines.len() >= 2),
|
verify(many1(blank_line), |lines: &Vec<&str>| lines.len() >= 2),
|
||||||
))),
|
))),
|
||||||
))(input)
|
))(input)?;
|
||||||
|
|
||||||
|
Ok((remaining, source))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
:firstdrawer:
|
[fn:1] A footnote.
|
||||||
:seconddrawer:
|
|
||||||
foo
|
[fn:2] A multi-
|
||||||
:end:
|
|
||||||
:end:
|
line footnote.
|
||||||
|
|
||||||
|
|
||||||
|
not in the footnote.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user