pub struct Syntax {
pub block_start: Cow<'static, str>,
pub block_end: Cow<'static, str>,
pub variable_start: Cow<'static, str>,
pub variable_end: Cow<'static, str>,
pub comment_start: Cow<'static, str>,
pub comment_end: Cow<'static, str>,
}
Available on crate feature
custom_syntax
only.Expand description
The delimiter configuration for the environment and the parser.
MiniJinja allows you to override the syntax configuration for
templates by setting different delimiters. The end markers can
be shared, but the start markers need to be distinct. It would
thus not be valid to configure {{
to be the marker for both
variables and blocks.
let mut environment = Environment::new();
environment.set_syntax(Syntax {
block_start: "\\BLOCK{".into(),
block_end: "}".into(),
variable_start: "\\VAR{".into(),
variable_end: "}".into(),
comment_start: "\\#{".into(),
comment_end: "}".into(),
}).unwrap();
Fields§
§block_start: Cow<'static, str>
The start of a block. By default it is {%
.
block_end: Cow<'static, str>
The end of a block. By default it is %}
.
variable_start: Cow<'static, str>
The start of a variable. By default it is {{
.
variable_end: Cow<'static, str>
The end of a variable. By default it is }}
.
comment_start: Cow<'static, str>
The start of a comment. By default it is {#
.
comment_end: Cow<'static, str>
The end of a comment. By default it is #}
.
Trait Implementations§
source§impl PartialEq<Syntax> for Syntax
impl PartialEq<Syntax> for Syntax
impl Eq for Syntax
impl StructuralEq for Syntax
impl StructuralPartialEq for Syntax
Auto Trait Implementations§
impl RefUnwindSafe for Syntax
impl Send for Syntax
impl Sync for Syntax
impl Unpin for Syntax
impl UnwindSafe for Syntax
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
Mutably borrows from an owned value. Read more