Remove context from detect plain list.
This commit is contained in:
parent
b2383d9f93
commit
67f79aeb51
@ -128,7 +128,7 @@ fn _detect_element<'r, 's>(
|
||||
input: OrgSource<'s>,
|
||||
can_be_paragraph: bool,
|
||||
) -> Res<OrgSource<'s>, ()> {
|
||||
if detect_plain_list(context, input).is_ok() {
|
||||
if detect_plain_list(input).is_ok() {
|
||||
return Ok((input, ()));
|
||||
}
|
||||
if _element(context, input, can_be_paragraph).is_ok() {
|
||||
|
@ -38,10 +38,7 @@ use crate::parser::util::maybe_consume_trailing_whitespace_if_not_exiting;
|
||||
use crate::parser::util::start_of_line;
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn detect_plain_list<'r, 's>(
|
||||
_context: Context<'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, ()> {
|
||||
pub fn detect_plain_list<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
if verify(
|
||||
tuple((
|
||||
start_of_line,
|
||||
@ -522,24 +519,21 @@ dolar"#,
|
||||
r#"+
|
||||
"#,
|
||||
);
|
||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||
let result = detect_plain_list(&initial_context, input);
|
||||
let result = detect_plain_list(input);
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detect_eof() {
|
||||
let input = OrgSource::new(r#"+"#);
|
||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||
let result = detect_plain_list(&initial_context, input);
|
||||
let result = detect_plain_list(input);
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detect_no_gap() {
|
||||
let input = OrgSource::new(r#"+foo"#);
|
||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||
let result = detect_plain_list(&initial_context, input);
|
||||
let result = detect_plain_list(input);
|
||||
// Since there is no whitespace after the '+' this is a paragraph, not a plain list.
|
||||
assert!(result.is_err());
|
||||
}
|
||||
@ -547,8 +541,7 @@ dolar"#,
|
||||
#[test]
|
||||
fn detect_with_gap() {
|
||||
let input = OrgSource::new(r#"+ foo"#);
|
||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||
let result = detect_plain_list(&initial_context, input);
|
||||
let result = detect_plain_list(input);
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user