From bc4c09c5466d422adb6fa7223c0c2d39bc4bc96e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 11 Oct 2023 10:07:12 -0400 Subject: [PATCH] Add constants for affiliated keyword settings. --- src/context/constants.rs | 20 ++++++++++++++++++++ src/context/global_settings.rs | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/src/context/constants.rs b/src/context/constants.rs index 3b200845..011797b7 100644 --- a/src/context/constants.rs +++ b/src/context/constants.rs @@ -1,5 +1,25 @@ use super::global_settings::EntityDefinition; +pub(crate) const DEFAULT_ORG_ELEMENT_PARSED_KEYWORDS: [&'static str; 1] = ["CAPTION"]; + +pub(crate) const DEFAULT_ORG_ELEMENT_DUAL_KEYWORDS: [&'static str; 2] = ["CAPTION", "RESULTS"]; + +pub(crate) const DEFAULT_ORG_ELEMENT_AFFILIATED_KEYWORDS: [&'static str; 13] = [ + "CAPTION", "DATA", "HEADER", "HEADERS", "LABEL", "NAME", "PLOT", "RESNAME", "RESULT", + "RESULTS", "SOURCE", "SRCNAME", "TBLNAME", +]; + +pub(crate) const DEFAULT_ORG_ELEMENT_KEYWORD_TRANSLATION_ALIST: [(&'static str, &'static str); 8] = [ + ("DATA", "NAME"), + ("LABEL", "NAME"), + ("RESNAME", "NAME"), + ("SOURCE", "NAME"), + ("SRCNAME", "NAME"), + ("TBLNAME", "NAME"), + ("RESULT", "RESULTS"), + ("HEADERS", "HEADER"), +]; + pub(crate) const DEFAULT_ORG_LINK_PARAMETERS: [&'static str; 23] = [ "id", "eww", diff --git a/src/context/global_settings.rs b/src/context/global_settings.rs index 9b62c69b..c9afffea 100644 --- a/src/context/global_settings.rs +++ b/src/context/global_settings.rs @@ -5,6 +5,7 @@ use super::constants::DEFAULT_ORG_ENTITIES; use super::constants::DEFAULT_ORG_LINK_PARAMETERS; use super::FileAccessInterface; use super::LocalFileAccessInterface; +use crate::context::constants::DEFAULT_ORG_ELEMENT_PARSED_KEYWORDS; use crate::types::IndentationLevel; use crate::types::Object; @@ -54,6 +55,11 @@ pub struct GlobalSettings<'g, 's> { /// /// Corresponds to org-entities elisp variable. pub entities: &'g [EntityDefinition<'s>], + + /// Keywords that contain the standard set of objects (excluding footnote references). + /// + /// Corresponds to org-element-parsed-keywords elisp variable. + pub element_parsed_keywords: &'g [&'g str], } pub const DEFAULT_TAB_WIDTH: IndentationLevel = 8; @@ -86,6 +92,7 @@ impl<'g, 's> GlobalSettings<'g, 's> { link_parameters: &DEFAULT_ORG_LINK_PARAMETERS, link_templates: BTreeMap::new(), entities: &DEFAULT_ORG_ENTITIES, + element_parsed_keywords: &DEFAULT_ORG_ELEMENT_PARSED_KEYWORDS, } } }