pub struct WorkflowBuilder<W> { /* private fields */ }Expand description
Typestate of the WorkflowBuilder.
Implementations§
Source§impl<'a> WorkflowBuilder<SyncFilename<'a>>
impl<'a> WorkflowBuilder<SyncFilename<'a>>
Sourcepub fn new(path: &'a Path) -> Self
pub fn new(path: &'a Path) -> Self
Constructor of all workflows. The path points
- to an existing note file, or
- to a directory where the new note should be created, or
- to a non-Tp-Note file that will be annotated.
For cases 2. and 3. upgrade the WorkflowBuilder with
upgrade() to add additional input data.
Sourcepub fn upgrade<T: Content, F: Fn(TemplateKind) -> TemplateKind>(
self,
scheme_new_default: &'a str,
html_clipboard: &'a T,
txt_clipboard: &'a T,
stdin: &'a T,
tk_filter: F,
) -> WorkflowBuilder<SyncFilenameOrCreateNew<'a, T, F>>
pub fn upgrade<T: Content, F: Fn(TemplateKind) -> TemplateKind>( self, scheme_new_default: &'a str, html_clipboard: &'a T, txt_clipboard: &'a T, stdin: &'a T, tk_filter: F, ) -> WorkflowBuilder<SyncFilenameOrCreateNew<'a, T, F>>
Upgrade the WorkflowBuilder to enable also the creation of new note
files. It requires providing additional input data:
New notes are created by inserting Tp-Note’s environment
in a template. The template set being used, is determined by
scheme_new_default. If the note to be created exists already, append
a so called copy_counter to the filename and try to save it again. In
case this does not succeed either, increment the copy_counter until a
free filename is found. The returned path points to the (new) note file
on disk. Depending on the context, Tp-Note chooses one TemplateKind
to operate (c.f. tpnote_lib::template::TemplateKind::from()).
The tk-filter allows to overwrite this choice, e.g. you may set
TemplateKind::None under certain circumstances. This way the caller
can disable the filename synchronization and inject behavior like
--no-filename-sync.
Some templates insert the content of the clipboard or the standard
input pipe. The input data (can be empty) must be provided with the
parameters clipboard and stdin. The templates expect text with
markup or HTML. In case of HTML, the content must start with
<!DOCTYPE html or <html
Sourcepub fn build(self) -> Workflow<SyncFilename<'a>>
pub fn build(self) -> Workflow<SyncFilename<'a>>
Finalize the build.
Source§impl<'a, T: Content, F: Fn(TemplateKind) -> TemplateKind> WorkflowBuilder<SyncFilenameOrCreateNew<'a, T, F>>
impl<'a, T: Content, F: Fn(TemplateKind) -> TemplateKind> WorkflowBuilder<SyncFilenameOrCreateNew<'a, T, F>>
Sourcepub fn html_export(&mut self, path: &'a Path, local_link_kind: LocalLinkKind)
pub fn html_export(&mut self, path: &'a Path, local_link_kind: LocalLinkKind)
Set a flag, that the workflow also stores an HTML-rendition of the note file next to it. This optional HTML rendition is performed just before returning and does not affect any above described operation.
Sourcepub fn force_scheme(&mut self, scheme: &'a str)
pub fn force_scheme(&mut self, scheme: &'a str)
Overwrite the default scheme.
Sourcepub fn force_lang(&mut self, force_lang: &'a str)
pub fn force_lang(&mut self, force_lang: &'a str)
By default, the natural language, the note is written in is guessed from the title and subtitle. This disables the automatic guessing and forces the language.
Sourcepub fn build(self) -> Workflow<SyncFilenameOrCreateNew<'a, T, F>>
pub fn build(self) -> Workflow<SyncFilenameOrCreateNew<'a, T, F>>
Finalize the build.
Trait Implementations§
Source§impl<W: Clone> Clone for WorkflowBuilder<W>
impl<W: Clone> Clone for WorkflowBuilder<W>
Source§fn clone(&self) -> WorkflowBuilder<W>
fn clone(&self) -> WorkflowBuilder<W>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<W> Freeze for WorkflowBuilder<W>where
W: Freeze,
impl<W> RefUnwindSafe for WorkflowBuilder<W>where
W: RefUnwindSafe,
impl<W> Send for WorkflowBuilder<W>where
W: Send,
impl<W> Sync for WorkflowBuilder<W>where
W: Sync,
impl<W> Unpin for WorkflowBuilder<W>where
W: Unpin,
impl<W> UnwindSafe for WorkflowBuilder<W>where
W: UnwindSafe,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more