Standardize right arrow usage

This commit is contained in:
Joe Mooring authored and GitHub committed 2023-08-03 15:54:39 -07:00
1 parent 01b3787268
commit 69e24e44e8
9 files changed
+44 -44

No files matched your search

@@ -506,7 +506,7 @@ See [lang.FormatNumber] and [lang.FormatNumberCustom] for details.
With this template code: With this template code:
```go-html-template ```go-html-template
{{ 512.5032 | lang.FormatPercent 2 }} ---> 512.50% {{ 512.5032 | lang.FormatPercent 2 }} → 512.50%
``` ```
The rendered page displays: The rendered page displays:
+7 -7
View File
@@ -13,11 +13,11 @@ relatedfuncs: [now]
```go-html-template ```go-html-template
{{ $d := "2022-01-01" | time.AsTime }} {{ $d := "2022-01-01" | time.AsTime }}
{{ $d.AddDate 0 0 1 | time.Format "2006-01-02" }} --> 2022-01-02 {{ $d.AddDate 0 0 1 | time.Format "2006-01-02" }} → 2022-01-02
{{ $d.AddDate 0 1 1 | time.Format "2006-01-02" }} --> 2022-02-02 {{ $d.AddDate 0 1 1 | time.Format "2006-01-02" }} → 2022-02-02
{{ $d.AddDate 1 1 1 | time.Format "2006-01-02" }} --> 2023-02-02 {{ $d.AddDate 1 1 1 | time.Format "2006-01-02" }} → 2023-02-02
{{ $d.AddDate -1 -1 -1 | time.Format "2006-01-02" }} --> 2020-11-30 {{ $d.AddDate -1 -1 -1 | time.Format "2006-01-02" }} → 2020-11-30
``` ```
{{% note %}} {{% note %}}
@@ -28,11 +28,11 @@ See [this explanation](https://github.com/golang/go/issues/31145#issuecomment-47
```go-html-template ```go-html-template
{{ $d := "2023-01-31" | time.AsTime }} {{ $d := "2023-01-31" | time.AsTime }}
{{ $d.AddDate 0 1 0 | time.Format "2006-01-02" }} --> 2023-03-03 {{ $d.AddDate 0 1 0 | time.Format "2006-01-02" }} → 2023-03-03
{{ $d := "2024-01-31" | time.AsTime }} {{ $d := "2024-01-31" | time.AsTime }}
{{ $d.AddDate 0 1 0 | time.Format "2006-01-02" }} --> 2024-03-02 {{ $d.AddDate 0 1 0 | time.Format "2006-01-02" }} → 2024-03-02
{{ $d := "2024-02-29" | time.AsTime }} {{ $d := "2024-02-29" | time.AsTime }}
{{ $d.AddDate 1 0 0 | time.Format "2006-01-02" }} --> 2025-03-01 {{ $d.AddDate 1 0 0 | time.Format "2006-01-02" }} → 2025-03-01
``` ```
+6 -6
View File
@@ -15,10 +15,10 @@ If [Goldmark](/getting-started/configuration-markup#goldmark) is set as `default
Since the `defaultMarkdownHandler` and this template function use the same sanitizing logic, you can use the latter to determine the ID of a header for linking with anchor tags. Since the `defaultMarkdownHandler` and this template function use the same sanitizing logic, you can use the latter to determine the ID of a header for linking with anchor tags.
```go-html-template ```go-html-template
{{ anchorize "This is a header" }} --> "this-is-a-header" {{ anchorize "This is a header" }} → "this-is-a-header"
{{ anchorize "This is also a header" }} --> "this-is-also----a-header" {{ anchorize "This is also a header" }} → "this-is-also----a-header"
{{ anchorize "main.go" }} --> "maingo" {{ anchorize "main.go" }} → "maingo"
{{ anchorize "Article 123" }} --> "article-123" {{ anchorize "Article 123" }} → "article-123"
{{ anchorize "<- Let's try this, shall we?" }} --> "--lets-try-this-shall-we" {{ anchorize "<- Let's try this, shall we?" }} → "--lets-try-this-shall-we"
{{ anchorize "Hello, 世界" }} --> "hello-世界" {{ anchorize "Hello, 世界" }} → "hello-世界"
``` ```
+7 -7
View File
@@ -24,11 +24,11 @@ content/
The function returns these values: The function returns these values:
```go-html-template ```go-html-template
{{ os.FileExists "content" }} --> true {{ os.FileExists "content" }} → true
{{ os.FileExists "content/news" }} --> true {{ os.FileExists "content/news" }} → true
{{ os.FileExists "content/news/article-1" }} --> false {{ os.FileExists "content/news/article-1" }} → false
{{ os.FileExists "content/news/article-1.md" }} --> true {{ os.FileExists "content/news/article-1.md" }} → true
{{ os.FileExists "news" }} --> true {{ os.FileExists "news" }} → true
{{ os.FileExists "news/article-1" }} --> false {{ os.FileExists "news/article-1" }} → false
{{ os.FileExists "news/article-1.md" }} --> true {{ os.FileExists "news/article-1.md" }} → true
``` ```
+4 -4
View File
@@ -12,8 +12,8 @@ relatedfuncs: []
Examples: Examples:
```go-html-template ```go-html-template
{{ os.Getenv "HOME" }} --> /home/victor {{ os.Getenv "HOME" }} → /home/victor
{{ os.Getenv "USER" }} --> victor {{ os.Getenv "USER" }} → victor
``` ```
You can pass values when building your site: You can pass values when building your site:
@@ -31,8 +31,8 @@ hugo
And then retrieve the values within a template: And then retrieve the values within a template:
```go-html-template ```go-html-template
{{ os.Getenv "MY_VAR1" }} --> foo {{ os.Getenv "MY_VAR1" }} → foo
{{ os.Getenv "MY_VAR2" }} --> bar {{ os.Getenv "MY_VAR2" }} → bar
``` ```
With Hugo v0.91.0 and later, you must explicitly allow access to environment variables. For details, review [Hugo's Security Policy](/about/security-model/#security-policy). By default, environment variables beginning with `HUGO_` are allowed when using the `os.Getenv` function. With Hugo v0.91.0 and later, you must explicitly allow access to environment variables. For details, review [Hugo's Security Policy](/about/security-model/#security-policy). By default, environment variables beginning with `HUGO_` are allowed when using the `os.Getenv` function.
+12 -12
View File
@@ -27,9 +27,9 @@ Example 1
```go-html-template ```go-html-template
{{ $merged := merge $m1 $m2 $m3 }} {{ $merged := merge $m1 $m2 $m3 }}
{{ $merged.x }} --> baz {{ $merged.x }} → baz
{{ $merged.y }} --> wobble {{ $merged.y }} → wobble
{{ $merged.z.a }} --> huey {{ $merged.z.a }} → huey
``` ```
Example 2 Example 2
@@ -37,9 +37,9 @@ Example 2
```go-html-template ```go-html-template
{{ $merged := merge $m3 $m2 $m1 }} {{ $merged := merge $m3 $m2 $m1 }}
{{ $merged.x }} --> foo {{ $merged.x }} → foo
{{ $merged.y }} --> wibble {{ $merged.y }} → wibble
{{ $merged.z.a }} --> huey {{ $merged.z.a }} → huey
``` ```
Example 3 Example 3
@@ -47,9 +47,9 @@ Example 3
```go-html-template ```go-html-template
{{ $merged := merge $m2 $m3 $m1 }} {{ $merged := merge $m2 $m3 $m1 }}
{{ $merged.x }} --> foo {{ $merged.x }} → foo
{{ $merged.y }} --> wobble {{ $merged.y }} → wobble
{{ $merged.z.a }} --> huey {{ $merged.z.a }} → huey
``` ```
Example 4 Example 4
@@ -57,9 +57,9 @@ Example 4
```go-html-template ```go-html-template
{{ $merged := merge $m1 $m3 $m2 }} {{ $merged := merge $m1 $m3 $m2 }}
{{ $merged.x }} --> bar {{ $merged.x }} → bar
{{ $merged.y }} --> wibble {{ $merged.y }} → wibble
{{ $merged.z.a }} --> huey {{ $merged.z.a }} → huey
``` ```
{{% note %}} {{% note %}}
+5 -5
View File
@@ -13,13 +13,13 @@ The `os.Stat` function attempts to resolve the path relative to the root of your
```go-html-template ```go-html-template
{{ $f := os.Stat "README.md" }} {{ $f := os.Stat "README.md" }}
{{ $f.IsDir }} --> false (bool) {{ $f.IsDir }} → false (bool)
{{ $f.ModTime }} --> 2021-11-25 10:06:49.315429236 -0800 PST (time.Time) {{ $f.ModTime }} → 2021-11-25 10:06:49.315429236 -0800 PST (time.Time)
{{ $f.Name }} --> README.md (string) {{ $f.Name }} → README.md (string)
{{ $f.Size }} --> 241 (int64) {{ $f.Size }} → 241 (int64)
{{ $d := os.Stat "content" }} {{ $d := os.Stat "content" }}
{{ $d.IsDir }} --> true (bool) {{ $d.IsDir }} → true (bool)
``` ```
Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo). Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
+1 -1
View File
@@ -26,7 +26,7 @@ This template code:
```go-html-template ```go-html-template
{{ range os.ReadDir "content" }} {{ range os.ReadDir "content" }}
{{ .Name }} --> {{ .IsDir }} {{ .Name }} → {{ .IsDir }}
{{ end }} {{ end }}
``` ```
+1 -1
View File
@@ -11,5 +11,5 @@ signature: [uniq SET]
```go-html-template ```go-html-template
{{ slice 1 3 2 1 | uniq }} --> [1 3 2] {{ slice 1 3 2 1 | uniq }} → [1 3 2]
``` ```