diff --git a/docs/en/docs/syntax/filters.md b/docs/en/docs/syntax/filters.md index b2f47d1..c4e8e73 100644 --- a/docs/en/docs/syntax/filters.md +++ b/docs/en/docs/syntax/filters.md @@ -37,3 +37,35 @@ Example: ## Built-In Filters Built-In filters can be found in [`sailfish::runtime::filter`](https://docs.rs/sailfish/latest/sailfish/runtime/filter/index.html) module. + +## Useful Filters + +You can also use the Display filter to do things like format a date, or a UUID. + +- Easily Display A Date + +=== "Template" + +``` +<%= chrono::NaiveDate::from_ymd_opt(2015, 9, 5).unwrap().and_hms_opt(23, 56, 4).unwrap().format("around %l %p on %b %-d") | disp %> +``` + +=== "Result" + +``` +around 11 PM on Sep 5 +``` + +- Easily Display A UUID + +=== "Template" + +``` +<%= uuid::Uuid::new_v4().urn() | disp %> +``` + +=== "Result" + +``` +urn:uuid:c3602585-a9a1-43f5-b0e6-8bc05d5444dd +```