Skip to content

Commit

Permalink
Update Leaf docs (#991)
Browse files Browse the repository at this point in the history
<!-- 🚀 Thank you for contributing! -->

<!-- Describe your changes clearly and use examples if possible. -->
Update Leaf docs to accept time zone IDs as argument in `#date` tag

<!-- When this PR is merged, the title and body will be -->
<!-- used to generate a release automatically. -->
  • Loading branch information
fpseverino authored Jul 21, 2024
1 parent 2bd8265 commit 1611d7e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/leaf/getting-started.it.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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: [
Expand Down
4 changes: 2 additions & 2 deletions docs/leaf/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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: [
Expand Down
6 changes: 6 additions & 0 deletions docs/leaf/overview.it.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions docs/leaf/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1611d7e

Please sign in to comment.