Add a global setting for link templates.
This commit is contained in:
		
							parent
							
								
									ae3a6ff919
								
							
						
					
					
						commit
						2ba5156ee1
					
				| @ -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", | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander