Pass context into paragraph from document instead of generating the initial context at paragraph level.
This commit is contained in:
@@ -24,6 +24,7 @@ use nom::sequence::tuple;
|
||||
use nom::IResult;
|
||||
|
||||
use super::nom_context::NomContext;
|
||||
use super::parser_with_context::parser_with_context;
|
||||
use super::text_element_parser::paragraph;
|
||||
|
||||
pub type Res<T, U> = IResult<T, U, VerboseError<T>>;
|
||||
@@ -139,5 +140,6 @@ pub fn paragraph_end(input: &str) -> Res<&str, &str> {
|
||||
}
|
||||
|
||||
pub fn document(input: &str) -> Res<&str, Vec<(Vec<TextElement>, &str)>> {
|
||||
many1(paragraph)(input)
|
||||
let initial_context = NomContext::new(¶graph_end);
|
||||
many1(parser_with_context!(paragraph)(initial_context))(input)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user