diff --git a/src/context/global_settings.rs b/src/context/global_settings.rs index 32cad28..ebf9365 100644 --- a/src/context/global_settings.rs +++ b/src/context/global_settings.rs @@ -1,3 +1,4 @@ +use std::collections::BTreeMap; use std::collections::BTreeSet; use super::FileAccessInterface; @@ -42,6 +43,13 @@ pub struct GlobalSettings<'g, 's> { /// /// Corresponds to org-link-parameters elisp variable. pub link_parameters: &'g [&'g str], + + /// Link templates where the key is the document text and the value is the replacement. + /// + /// For example, `"foo": "bar%s"` will replace `[[foo::baz]]` with `[[barbaz]]` + /// + /// This is set by including #+LINK in the org-mode document. + pub link_templates: BTreeMap<&'s str, &'s str>, } pub const DEFAULT_TAB_WIDTH: IndentationLevel = 8; @@ -60,7 +68,8 @@ impl<'g, 's> GlobalSettings<'g, 's> { odd_levels_only: HeadlineLevelFilter::default(), footnote_section: "Footnotes", coderef_label_format: "(ref:%s)", - link_parameters: &ORG_LINK_PARAMETERS, + link_parameters: &DEFAULT_ORG_LINK_PARAMETERS, + link_templates: BTreeMap::new(), } } } @@ -83,7 +92,7 @@ impl Default for HeadlineLevelFilter { } } -const ORG_LINK_PARAMETERS: [&'static str; 23] = [ +const DEFAULT_ORG_LINK_PARAMETERS: [&'static str; 23] = [ "id", "eww", "rmail",