Only allow a single section under a heading.
This commit is contained in:
parent
56865c68fc
commit
950baa9d5d
1
build.rs
1
build.rs
@ -75,7 +75,6 @@ fn is_expect_fail(name: &str) -> Option<&str> {
|
||||
"autogen_greater_element_drawer_drawer_with_headline_inside" => Some("Apparently lines with :end: become their own paragraph. This odd behavior needs to be investigated more."),
|
||||
"autogen_element_container_priority_footnote_definition_dynamic_block" => Some("Apparently broken begin lines become their own paragraph."),
|
||||
"autogen_lesser_element_paragraphs_paragraph_with_backslash_line_breaks" => Some("The text we're getting out of the parse tree is already processed to remove line breaks, so our comparison needs to take that into account."),
|
||||
"autogen_sections_and_headings_empty_section" => Some("We are not yet handling empty sections properly."),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
@ -283,10 +283,14 @@ fn _heading<'r, 's>(
|
||||
headline(context, input, parent_stars)?;
|
||||
let section_matcher = parser_with_context!(section)(context);
|
||||
let heading_matcher = parser_with_context!(heading(star_count))(context);
|
||||
let (remaining, children) = many0(alt((
|
||||
map(heading_matcher, DocumentElement::Heading),
|
||||
map(section_matcher, DocumentElement::Section),
|
||||
)))(remaining)?;
|
||||
let (remaining, maybe_section) =
|
||||
opt(map(section_matcher, DocumentElement::Section))(remaining)?;
|
||||
let (remaining, mut children) =
|
||||
many0(map(heading_matcher, DocumentElement::Heading))(remaining)?;
|
||||
if let Some(section) = maybe_section {
|
||||
children.insert(0, section);
|
||||
}
|
||||
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
remaining,
|
||||
|
Loading…
x
Reference in New Issue
Block a user