Apply category even if there are radio targets.
This commit is contained in:
@@ -6,6 +6,7 @@ use nom::multi::many0;
|
||||
|
||||
use super::headline::heading;
|
||||
use super::in_buffer_settings::apply_in_buffer_settings;
|
||||
use super::in_buffer_settings::apply_post_parse_in_buffer_settings;
|
||||
use super::in_buffer_settings::scan_for_in_buffer_settings;
|
||||
use super::org_source::OrgSource;
|
||||
use super::section::zeroth_section;
|
||||
@@ -168,25 +169,17 @@ fn document_org_source<'b, 'g, 'r, 's>(
|
||||
let mut new_global_settings = context.get_global_settings().clone();
|
||||
new_global_settings.radio_targets = all_radio_targets;
|
||||
let parser_context = context.with_global_settings(&new_global_settings);
|
||||
let (remaining, document) = _document(&parser_context, input)
|
||||
let (remaining, mut document) = _document(&parser_context, input)
|
||||
.map(|(rem, out)| (Into::<&str>::into(rem), out))?;
|
||||
apply_post_parse_in_buffer_settings(&mut document)
|
||||
.map_err(|err| nom::Err::<CustomError<OrgSource<'_>>>::Failure(err.into()))?;
|
||||
return Ok((remaining.into(), document));
|
||||
}
|
||||
}
|
||||
|
||||
// Find final in-buffer settings that do not impact parsing
|
||||
document.category = Into::<AstNode>::into(&document)
|
||||
.into_iter()
|
||||
.filter_map(|ast_node| {
|
||||
if let AstNode::Keyword(ast_node) = ast_node {
|
||||
if ast_node.key.eq_ignore_ascii_case("category") {
|
||||
return Some(ast_node);
|
||||
}
|
||||
}
|
||||
None
|
||||
})
|
||||
.last()
|
||||
.map(|kw| kw.value.to_owned());
|
||||
apply_post_parse_in_buffer_settings(&mut document)
|
||||
.map_err(|err| nom::Err::<CustomError<OrgSource<'_>>>::Failure(err.into()))?;
|
||||
|
||||
Ok((remaining.into(), document))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user