Identified the problem.
The issue is plain text is eating the line break so paragraph is failing since it expects a line break at the end.
This commit is contained in:
@@ -71,16 +71,19 @@ pub fn get_consumed<'s>(input: &'s str, remaining: &'s str) -> &'s str {
|
||||
/// A line containing only whitespace and then a line break
|
||||
///
|
||||
/// It is up to the caller to ensure this is called at the start of a line.
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn blank_line(input: &str) -> Res<&str, &str> {
|
||||
not(eof)(input)?;
|
||||
recognize(tuple((space0, alt((line_ending, eof)))))(input)
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn trailing_whitespace(input: &str) -> Res<&str, &str> {
|
||||
alt((eof, recognize(tuple((line_ending, many0(blank_line))))))(input)
|
||||
}
|
||||
|
||||
/// Check that we are at the start of a line
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn start_of_line<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, ()> {
|
||||
let document_root = context.get_document_root().unwrap();
|
||||
let preceding_character = get_one_before(document_root, input)
|
||||
@@ -103,6 +106,7 @@ pub fn start_of_line<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'
|
||||
/// Pull one non-whitespace character.
|
||||
///
|
||||
/// This function only operates on spaces, tabs, carriage returns, and line feeds. It does not handle fancy unicode whitespace.
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn non_whitespace_character(input: &str) -> Res<&str, char> {
|
||||
none_of(" \t\r\n")(input)
|
||||
}
|
||||
@@ -116,6 +120,13 @@ pub fn exit_matcher_parser<'r, 's>(
|
||||
peek(|i| context.check_exit_matcher(i))(input)
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn always_fail<'r, 's>(_context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||
Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Always fail",
|
||||
))))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user