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:
Tom Alexander
2023-03-27 18:08:17 -04:00
parent e1fbe36297
commit 028946ec90
8 changed files with 31 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ use nom::multi::many0;
use nom::multi::many_till;
use nom::sequence::tuple;
#[allow(dead_code)]
#[tracing::instrument(ret, level = "debug")]
pub fn plain_list<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, PlainList<'s>> {
let (remaining, first_item) = plain_list_item(context, input)?;
let plain_list_item_matcher = parser_with_context!(plain_list_item)(context);
@@ -41,7 +41,7 @@ pub fn plain_list<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
Ok((remaining, PlainList { source, children }))
}
#[allow(dead_code)]
#[tracing::instrument(ret, level = "debug")]
pub fn plain_list_item<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -72,6 +72,7 @@ pub fn plain_list_item<'r, 's>(
))
}
#[tracing::instrument(ret, level = "debug")]
fn bullet<'s>(i: &'s str) -> Res<&'s str, &'s str> {
alt((
tag("*"),
@@ -81,10 +82,12 @@ fn bullet<'s>(i: &'s str) -> Res<&'s str, &'s str> {
))(i)
}
#[tracing::instrument(ret, level = "debug")]
fn counter<'s>(i: &'s str) -> Res<&'s str, &'s str> {
alt((recognize(one_of("abcdefghijklmnopqrstuvwxyz")), digit1))(i)
}
#[tracing::instrument(ret, level = "debug")]
fn plain_list_item_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
let plain_list_item_matcher = parser_with_context!(plain_list_item)(context);
let line_indented_lte_matcher = parser_with_context!(line_indented_lte)(context);
@@ -95,6 +98,7 @@ fn plain_list_item_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<
))(input)
}
#[tracing::instrument(ret, level = "debug")]
fn line_indented_lte<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
let current_item_indent_level: &usize =
get_context_item_indent(context).ok_or(nom::Err::Error(CustomError::MyError(MyError(