diff --git a/src/context/global_settings.rs b/src/context/global_settings.rs index c12bbcf..66c1d74 100644 --- a/src/context/global_settings.rs +++ b/src/context/global_settings.rs @@ -12,6 +12,8 @@ pub struct GlobalSettings<'g, 's> { pub radio_targets: Vec<&'g Vec>>, pub file_access: &'g dyn FileAccessInterface, pub in_progress_todo_keywords: BTreeSet, + pub category: Option, + pub complete_todo_keywords: BTreeSet, /// Set to true to allow for plain lists using single letters as the bullet in the same way that numbers are used. /// @@ -39,6 +41,7 @@ impl<'g, 's> GlobalSettings<'g, 's> { working_directory: None, }, in_progress_todo_keywords: BTreeSet::new(), + category: None, complete_todo_keywords: BTreeSet::new(), list_allow_alphabetical: false, tab_width: DEFAULT_TAB_WIDTH, diff --git a/src/parser/document.rs b/src/parser/document.rs index a944238..b7d91a5 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -191,7 +191,7 @@ fn _document<'b, 'g, 'r, 's>( remaining, Document { source: source.into(), - category: None, + category: context.get_global_settings().category.clone(), path: None, zeroth_section, children, diff --git a/src/parser/in_buffer_settings.rs b/src/parser/in_buffer_settings.rs index 167d428..b95ca74 100644 --- a/src/parser/in_buffer_settings.rs +++ b/src/parser/in_buffer_settings.rs @@ -111,6 +111,14 @@ pub(crate) fn apply_in_buffer_settings<'g, 's, 'sf>( } } + // Category + for kw in keywords + .iter() + .filter(|kw| kw.key.eq_ignore_ascii_case("category")) + { + new_settings.category = Some(kw.value.to_owned()); + } + Ok(new_settings) }