Add a test case demonstrating an issue.
This commit is contained in:
parent
9efc291d28
commit
665c1d70fb
@ -100,6 +100,7 @@ pub fn plain_list_item<'r, 's>(
|
||||
}
|
||||
Err(_) => {
|
||||
let (remaining, _ws) = space1(remaining)?;
|
||||
// TODO: The problem is we are not capturing trailing whitespace for elements that are before the last element.
|
||||
let (remaining, (contents, _exit_contents)) =
|
||||
many_till(element_matcher, exit_matcher)(remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
@ -296,7 +297,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn two_blank_lines_ends_nested_list() {
|
||||
// Plain lists with an asterisk bullet must be indented or else they would be a headline
|
||||
let input = r#"1. foo
|
||||
1. bar
|
||||
|
||||
@ -315,6 +315,40 @@ baz"#;
|
||||
1. bar
|
||||
|
||||
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn interior_trailing_whitespace() {
|
||||
let input = r#"1. foo
|
||||
|
||||
bar
|
||||
|
||||
1. baz
|
||||
|
||||
lorem
|
||||
|
||||
|
||||
ipsum"#;
|
||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||
let document_context =
|
||||
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
|
||||
let plain_list_matcher = parser_with_context!(plain_list)(&document_context);
|
||||
let (remaining, result) =
|
||||
plain_list_matcher(input).expect("Should parse the plain list successfully.");
|
||||
assert_eq!(remaining, "ipsum");
|
||||
assert_eq!(
|
||||
result.get_source(),
|
||||
r#"1. foo
|
||||
|
||||
bar
|
||||
|
||||
1. baz
|
||||
|
||||
lorem
|
||||
|
||||
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
@ -1,38 +1,10 @@
|
||||
prologue *goes here* I guess *bold
|
||||
text*
|
||||
|
||||
bold*wont* start *or stop*when there is text outside it
|
||||
|
||||
I guess *regular
|
||||
|
||||
text*
|
||||
|
||||
[foo *bar] baz* car
|
||||
|
||||
|
||||
*nesting *bold entrances* and* exits
|
||||
|
||||
* Heading
|
||||
|
||||
body of heading
|
||||
|
||||
** Child heading
|
||||
** Immediate second child heading
|
||||
|
||||
* Second top-level heading
|
||||
foo bar
|
||||
1. This is a list immediately after a paragraph
|
||||
2. This is a second item in the list
|
||||
1. This is a child of the second item
|
||||
#+begin_center
|
||||
1. foo
|
||||
2. bar
|
||||
#+end_center
|
||||
[fn:1] A footnote.
|
||||
|
||||
[fn:2] A multi-
|
||||
bar
|
||||
|
||||
line footnote.
|
||||
1. baz
|
||||
|
||||
lorem
|
||||
|
||||
|
||||
not in the footnote.
|
||||
ipsum
|
||||
|
Loading…
Reference in New Issue
Block a user