From a76db44a886668c2e120395dd58cf349927e39f1 Mon Sep 17 00:00:00 2001 From: vthg2themax Date: Sat, 8 Jun 2024 05:57:00 -0400 Subject: [PATCH] Update The Documentation To List Some Useful Information About The Display Filter --- docs/en/docs/syntax/filters.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/en/docs/syntax/filters.md b/docs/en/docs/syntax/filters.md index b2f47d19..c4e8e733 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 +```