Move in_section to a util module.
This commit is contained in:
@@ -23,16 +23,3 @@ pub fn document(input: &str) -> Res<&str, Vec<Paragraph>> {
|
||||
.collect();
|
||||
Ok((remaining, paragraphs))
|
||||
}
|
||||
|
||||
pub fn in_section<'s, 'r, 'x>(context: Context<'r, 's>, section_name: &'x str) -> bool {
|
||||
for thing in context.iter() {
|
||||
match thing.get_data() {
|
||||
ContextElement::ExitMatcherNode(_) => {}
|
||||
ContextElement::PreviousElementNode(_) => {}
|
||||
ContextElement::Context(name) if *name == section_name => return true,
|
||||
ContextElement::Context(_) => {}
|
||||
ContextElement::StartOfParagraph => {} // TODO: If we specialize this to bold then this would be a good spot to stop scanning
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user