From 1611d7e0c6f838be6db06d7470f11abaa3d48441 Mon Sep 17 00:00:00 2001 From: Francesco Paolo Severino <96546612+fpseverino@users.noreply.github.com> Date: Sun, 21 Jul 2024 23:34:22 +0200 Subject: [PATCH] Update Leaf docs (#991) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Leaf docs to accept time zone IDs as argument in `#date` tag --- docs/leaf/getting-started.it.md | 4 ++-- docs/leaf/getting-started.md | 4 ++-- docs/leaf/overview.it.md | 6 ++++++ docs/leaf/overview.md | 6 ++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/leaf/getting-started.it.md b/docs/leaf/getting-started.it.md index 799c044dd..1fcea19a6 100644 --- a/docs/leaf/getting-started.it.md +++ b/docs/leaf/getting-started.it.md @@ -7,7 +7,7 @@ Leaf è un potente linguaggio di templating con la sintassi ispirata a Swift. Pu Il primo passo per usare Leaf è aggiungerlo come una dipendenza al tuo progetto nel tuo file di manifesto del pacchetto SPM. ```swift -// swift-tools-version:5.2 +// swift-tools-version:5.8 import PackageDescription let package = Package( @@ -17,7 +17,7 @@ let package = Package( ], dependencies: [ /// Qualsiasi altra dipendenza ... - .package(url: "https://github.com/vapor/leaf.git", from: "4.0.0"), + .package(url: "https://github.com/vapor/leaf.git", from: "4.4.0"), ], targets: [ .target(name: "App", dependencies: [ diff --git a/docs/leaf/getting-started.md b/docs/leaf/getting-started.md index b875db39b..b494fc89c 100644 --- a/docs/leaf/getting-started.md +++ b/docs/leaf/getting-started.md @@ -7,7 +7,7 @@ Leaf is a powerful templating language with Swift-inspired syntax. You can use i The first step to using Leaf is adding it as a dependency to your project in your SPM package manifest file. ```swift -// swift-tools-version:5.2 +// swift-tools-version:5.8 import PackageDescription let package = Package( @@ -17,7 +17,7 @@ let package = Package( ], dependencies: [ /// Any other dependencies ... - .package(url: "https://github.com/vapor/leaf.git", from: "4.0.0"), + .package(url: "https://github.com/vapor/leaf.git", from: "4.4.0"), ], targets: [ .target(name: "App", dependencies: [ diff --git a/docs/leaf/overview.it.md b/docs/leaf/overview.it.md index fae1757b2..8e1533d3d 100644 --- a/docs/leaf/overview.it.md +++ b/docs/leaf/overview.it.md @@ -264,6 +264,12 @@ Puoi passare una stringa in un formato di data personalizzato come secondo argom The date is #date(now, "yyyy-MM-dd") ``` +Puoi anche passare l'ID di un fuso orario come terzo argomento. Guarda [`DateFormatter.timeZone`](https://developer.apple.com/documentation/foundation/dateformatter/1411406-timezone) e [`TimeZone`](https://developer.apple.com/documentation/foundation/timezone) di Swift per più informazioni. + +```leaf +The date is #date(now, "yyyy-MM-dd", "America/New_York") +``` + #### `#unsafeHTML` Il tag `#unsafeHTML` agisce come un tag di variabile - p.es. `#(variable)`. Però non evade nessun HTML che `variable` potrebbe contenere: diff --git a/docs/leaf/overview.md b/docs/leaf/overview.md index b10351894..e1f4ff414 100644 --- a/docs/leaf/overview.md +++ b/docs/leaf/overview.md @@ -264,6 +264,12 @@ You can pass a custom date formatter string as the second argument. See Swift's The date is #date(now, "yyyy-MM-dd") ``` +You can also pass a time zone ID for the date formatter as the third argument. See Swift's [`DateFormatter.timeZone`](https://developer.apple.com/documentation/foundation/dateformatter/1411406-timezone) and [`TimeZone`](https://developer.apple.com/documentation/foundation/timezone) for more information. + +```leaf +The date is #date(now, "yyyy-MM-dd", "America/New_York") +``` + #### `#unsafeHTML` The `#unsafeHTML` tag acts like a variable tag - e.g. `#(variable)`. However it does not escape any HTML that `variable` may contain: