Footnote definitions are parsing on their own.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use crate::parser::parser_with_context::parser_with_context;
|
||||
|
||||
use super::error::CustomError;
|
||||
use super::error::MyError;
|
||||
use super::error::Res;
|
||||
@@ -10,6 +12,7 @@ use nom::character::complete::none_of;
|
||||
use nom::character::complete::space0;
|
||||
use nom::combinator::eof;
|
||||
use nom::combinator::not;
|
||||
use nom::combinator::opt;
|
||||
use nom::combinator::peek;
|
||||
use nom::combinator::recognize;
|
||||
use nom::multi::many0;
|
||||
@@ -89,6 +92,20 @@ pub fn element_trailing_whitespace<'r, 's>(
|
||||
alt((eof, recognize(many0(blank_line))))(input)
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn maybe_consume_trailing_whitespace<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, Option<&'s str>> {
|
||||
if context.should_consume_trailing_whitespace() {
|
||||
Ok(opt(parser_with_context!(element_trailing_whitespace)(
|
||||
context,
|
||||
))(input)?)
|
||||
} else {
|
||||
Ok((input, None))
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn trailing_whitespace(input: &str) -> Res<&str, &str> {
|
||||
alt((eof, recognize(tuple((line_ending, many0(blank_line))))))(input)
|
||||
|
||||
Reference in New Issue
Block a user