Enum tpnote_lib::template::TemplateKind
source · #[non_exhaustive]pub enum TemplateKind {
New,
FromClipboardYaml,
FromClipboard,
FromTextFile,
AnnotateFile,
SyncFilename,
None,
}Expand description
Each workflow is related to one TemplateKind, which relates to one
content template and one filename template.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
New
Templates used when Tp-Note is invoked with a directory path.
FromClipboardYaml
Templates used when the clipboard contains a text with a YAML header.
FromClipboard
Templates used when the clipboard contains a text without header.
FromTextFile
Templates used when Tp-Note is invoked with a path pointing to a text file that does not contain a YAML header.
AnnotateFile
Templates used when Tp-Note is invoked with a path pointing to a non text file.
SyncFilename
Templates used when Tp-Note is invoked with a path pointing to a Tp-Note
text file with a valid YAML header (with a title: field).
None
No templates are used, but the file is still parsed in order to render it
later to HTML (c.f. <Note>.render_content_to_html() and
<Note>.export_html()).
Implementations§
source§impl TemplateKind
impl TemplateKind
sourcepub fn from<T: Content>(
path: &Path,
clipboard: &T,
stdin: &T
) -> (Self, Option<T>)
pub fn from<T: Content>( path: &Path, clipboard: &T, stdin: &T ) -> (Self, Option<T>)
Constructor encoding the logic under what circumstances what template should be used.
sourcepub fn get_content_template(&self) -> String
pub fn get_content_template(&self) -> String
Returns the content template string as it is defined in the configuration file.
Panics for TemplateKind::SyncFilename and TemplateKind::None.
sourcepub fn get_content_template_name(&self) -> &str
pub fn get_content_template_name(&self) -> &str
Returns the content template variable name as it is used in the configuration file.
sourcepub fn get_filename_template(&self) -> String
pub fn get_filename_template(&self) -> String
Returns the file template string as it is defined in the configuration file.
Panics for TemplateKind::None.
sourcepub fn get_filename_template_name(&self) -> &str
pub fn get_filename_template_name(&self) -> &str
Returns the content template variable name as it is used in the configuration file.
Trait Implementations§
source§impl Clone for TemplateKind
impl Clone for TemplateKind
source§fn clone(&self) -> TemplateKind
fn clone(&self) -> TemplateKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for TemplateKind
impl Debug for TemplateKind
source§impl Default for TemplateKind
impl Default for TemplateKind
source§fn default() -> TemplateKind
fn default() -> TemplateKind
source§impl PartialEq<TemplateKind> for TemplateKind
impl PartialEq<TemplateKind> for TemplateKind
source§fn eq(&self, other: &TemplateKind) -> bool
fn eq(&self, other: &TemplateKind) -> bool
self and other values to be equal, and is used
by ==.impl Copy for TemplateKind
impl Eq for TemplateKind
impl StructuralEq for TemplateKind
impl StructuralPartialEq for TemplateKind
Auto Trait Implementations§
impl RefUnwindSafe for TemplateKind
impl Send for TemplateKind
impl Sync for TemplateKind
impl Unpin for TemplateKind
impl UnwindSafe for TemplateKind
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.