2022-12-18 08:18:43 +00:00
|
|
|
use super::parser_context::ContextElement;
|
|
|
|
use super::Context;
|
|
|
|
|
2022-12-18 08:30:28 +00:00
|
|
|
pub fn in_section<'r, 's, 'x>(context: Context<'r, 's>, section_name: &'x str) -> bool {
|
2022-12-18 08:18:43 +00:00
|
|
|
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
|
2023-03-17 20:49:09 +00:00
|
|
|
ContextElement::ListItem(_) => {}
|
2022-12-18 08:18:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
false
|
|
|
|
}
|