Struct minimad::TextTemplateExpander [−][src]
an expander you get from a template. You specify replacements
on the expander then you ask it the text using expand
Implementations
impl<'s, 'b> TextTemplateExpander<'s, 'b>
[src]
pub fn set(
&mut self,
name: &str,
value: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
[src]
&mut self,
name: &str,
value: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
replace placeholders with name name
with the given value, non interpreted
(i.e. stars, backquotes, etc. don't mess the styling defined by the template)
pub fn set_all(&mut self, value: &'s str) -> &mut TextTemplateExpander<'s, 'b>
[src]
replace all placeholders with the given value, non interpreted (i.e. stars, backquotes, etc. don't mess the styling defined by the template). This can be used at start to have a "default" value.
pub fn set_md(
&mut self,
name: &'b str,
value: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
[src]
&mut self,
name: &'b str,
value: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
replace placeholders with name name
with the given value, interpreted as markdown
pub fn set_lines(
&mut self,
name: &'b str,
raw_lines: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
[src]
&mut self,
name: &'b str,
raw_lines: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
replace a placeholder with several lines. This is mostly useful when the placeholder is a repeatable line (code, list item)
pub fn set_lines_md(
&mut self,
name: &'b str,
md: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
[src]
&mut self,
name: &'b str,
md: &'s str
) -> &mut TextTemplateExpander<'s, 'b>
replace a placeholder with several lines interpreted as markdown
pub fn sub(&mut self, name: &'b str) -> &mut SubTemplateExpander<'s, 'b>
[src]
prepare expansion of a sub template and return a mutable reference to the object in which to set compound replacements
pub fn expand(self) -> Text<'s>
[src]
build a text by applying the replacements to the initial template
Trait Implementations
impl<'s, 'b> From<&'b TextTemplate<'s>> for TextTemplateExpander<'s, 'b>
[src]
fn from(template: &'b TextTemplate<'s>) -> Self
[src]
Build a new expander for the template. The expander stores the additions
done with set
, set_md
, set_lines
or in the sub
expanders.
Auto Trait Implementations
impl<'s, 'b> RefUnwindSafe for TextTemplateExpander<'s, 'b>
[src]
impl<'s, 'b> Send for TextTemplateExpander<'s, 'b>
[src]
impl<'s, 'b> Sync for TextTemplateExpander<'s, 'b>
[src]
impl<'s, 'b> Unpin for TextTemplateExpander<'s, 'b> where
's: 'b,
[src]
's: 'b,
impl<'s, 'b> UnwindSafe for TextTemplateExpander<'s, 'b>
[src]
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, 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>,