aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-04 13:05:18 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-04 13:05:18 +0200
commitef4199f2e7e0b4c3c813da76d95276faae811478 (patch)
tree82dc35e29fefdc57dba51866e9310e05b1aee8bd
parent6fa83bf79f76f2d3ab40d32498f684b55889e2ff (diff)
downloadaskama-ef4199f2e7e0b4c3c813da76d95276faae811478.tar.gz
askama-ef4199f2e7e0b4c3c813da76d95276faae811478.tar.bz2
askama-ef4199f2e7e0b4c3c813da76d95276faae811478.zip
Expand documentation on whitespace suppression (fixes #80)
-rw-r--r--askama/src/lib.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index a83aab2..534e27d 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -83,13 +83,27 @@
//!
//! ## Whitespace control
//!
-//! Askama preserves all whitespace in template code by default,
-//! except that a single trailing newline characters are suppressed.
+//! Askama considers all tabs, spaces, newlines and carriage returns to be
+//! whitespace. By default, it preserves all whitespace in template code,
+//! except that a single trailing newline character is suppressed.
//! However, whitespace before and after expression and block delimiters
//! can be suppressed by writing a minus sign directly following a
//! start delimiter or leading into an end delimiter.
-//! Askama considers all tabs, spaces, newlines and carriage returns to be
-//! whitespace.
+//!
+//! Here is an example:
+//!
+//! ```text
+//! {% if foo %}
+//! {{- bar -}}
+//! {% else if -%}
+//! nothing
+//! {%- endif %}
+//! ```
+//!
+//! This discards all whitespace inside the if/else block. If a literal
+//! (any part of the template not surrounded by `{% %}` or `{{ }}`)
+//! includes only whitespace, whitespace suppression on either side will
+//! completely suppress that literal content.
//!
//! ## Template inheritance
//!