Struct obsidian_export::Context [−][src]
Context holds metadata about a note which is being parsed.
This is used internally to keep track of nesting and help with constructing proper references to other notes.
It is also passed to postprocessors to provide contextual information and allow modification of a note’s frontmatter.
Fields
destination: PathBuf
The path where this note will be written to when exported.
Changing this path will result in the note being written to that new path instead, but beware: links will not be updated automatically. If this is changed by a postprocessor, it’s up to that postprocessor to rewrite any existing links to this new path.
frontmatter: Frontmatter
The Frontmatter for this note. Frontmatter may be modified in-place (see serde_yaml::Mapping for available methods) or replaced entirely.
Example
Insert foo: bar
into a note’s frontmatter:
use obsidian_export::serde_yaml::Value; let key = Value::String("foo".to_string()); context.frontmatter.insert( key.clone(), Value::String("bar".to_string()), );
Implementations
impl Context
[src]
pub fn new(src: PathBuf, dest: PathBuf) -> Context
[src]
Create a new Context
pub fn from_parent(context: &Context, child: &PathBuf) -> Context
[src]
Create a new Context
which inherits from a parent Context.
pub fn current_file(&self) -> &PathBuf
[src]
Return the path of the file currently being parsed.
pub fn root_file(&self) -> &PathBuf
[src]
Return the path of the root file.
Typically this will yield the same element as current_file
, but when a note is embedded
within another note, this will return the outer-most note.
pub fn note_depth(&self) -> usize
[src]
Return the note depth (nesting level) for this context.
pub fn file_tree(&self) -> Vec<PathBuf>
[src]
Return the list of files associated with this context.
The first element corresponds to the root file, the final element corresponds to the file
which is currently being processed (see also current_file
).
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,