aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar bott <mhpoin@gmail.com>2018-10-07 18:53:45 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-10-08 09:40:20 +0200
commit833983ffe1420d4db1409c5c9ad224911eafef77 (patch)
tree239ed7638f4eafdb674d1548bbb0790ea322abba
parent28d76964080f5c6c36d5f6ed72828b679fe352b4 (diff)
downloadaskama-833983ffe1420d4db1409c5c9ad224911eafef77.tar.gz
askama-833983ffe1420d4db1409c5c9ad224911eafef77.tar.bz2
askama-833983ffe1420d4db1409c5c9ad224911eafef77.zip
Add changing delimiters documentation
Diffstat (limited to '')
-rw-r--r--askama/src/lib.rs35
1 files changed, 33 insertions, 2 deletions
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index 0acf837..c5cb962 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -55,13 +55,17 @@
//! specified extension (`ext`): if the extension is `html`, `htm` or `xml`,
//! the `html` escape mode is used; otherwise, no implicit escaping is done.
//! Setting an escape mode explicitly overrides the inferred value.
+//! * `syntax` (as `syntax = "foo"`): set the syntax name for a parser defined
+//! in the configuration file. The default syntax , "default", is the one
+//! provided by Askama.
//!
//! ## Configuration
//!
//! At compile time, Askama will read optional configuration values from
//! `askama.toml` in the crate root (the directory where `Cargo.toml` can
-//! be found). Currently, this only covers the directories to search for
-//! templates.
+//! be found). Currently, this covers the directories to search for templates,
+//! as well as the of customization syntax.
+//!
//!
//! This example file demonstrates the default configuration:
//!
@@ -71,6 +75,33 @@
//! dirs = ["templates"]
//! ```
//!
+//! Syntax consists of at least the attribute `name` which uniquely names
+//! this syntax in the project.
+//!
+//! This example file demonstrate a personalized syntax configuration "foo":
+//!
+//! ```toml
+//! default_syntax = "foo"
+//!
+//! [[syntax]]
+//! name = "foo"
+//! block_start = "%{"
+//! comment_start = "#{"
+//! expr_end = "^^"
+//!
+//! [[syntax]]
+//! name = "bar"
+//! block_start = "%%"
+//! block_end = "%%"
+//! comment_start = "%#"
+//! expr_start = "%{"
+//! ```
+//!
+//! The following keys can currently be used to customize template syntax: `block_start`,
+//! `block_end`, `comment_start`, `comment_end`, `expr_start` and `expr_end`; Must be
+//! exactly 2 characters long and start delimiters must all start or end with the same
+//! character. If a key is omitted, the value from the default syntax is used.
+//!
//! ## Variables
//!
//! Top-level template variables are defined by the template's context type.