Update all transform.Unmarshal examples

This commit is contained in:
Joe Mooring 2024-02-20 09:40:39 -08:00 committed by GitHub
parent d41da74506
commit 1c20eb91ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 13 deletions

View File

@ -97,7 +97,7 @@ my-project/
{{ $p := "data/pets.csv" }}
{{ with resources.Get $p }}
{{ $opts := dict "delimiter" "," }}
{{ $data = . | transform.Unmarshal $opts }}
{{ $data = .Content | transform.Unmarshal $opts }}
{{ else }}
{{ errorf "Unable to get resource %q" $p }}
{{ end }}
@ -121,7 +121,7 @@ my-project/
{{ $p := "pets.csv" }}
{{ with .Resources.Get $p }}
{{ $opts := dict "delimiter" "," }}
{{ $data = . | transform.Unmarshal $opts }}
{{ $data = .Content | transform.Unmarshal $opts }}
{{ else }}
{{ errorf "Unable to get resource %q" $p }}
{{ end }}
@ -139,7 +139,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`]
{{ errorf "%s" . }}
{{ else }}
{{ $opts := dict "delimiter" "," }}
{{ $data = . | transform.Unmarshal $opts }}
{{ $data = .Content | transform.Unmarshal $opts }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $u }}

View File

@ -101,7 +101,7 @@ my-project/
{{ $data := "" }}
{{ $p := "data/books.json" }}
{{ with resources.Get $p }}
{{ $data = . | transform.Unmarshal }}
{{ $data = .Content | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get resource %q" $p }}
{{ end }}
@ -124,7 +124,7 @@ my-project/
{{ $data := "" }}
{{ $p := "books.json" }}
{{ with .Resources.Get $p }}
{{ $data = . | transform.Unmarshal }}
{{ $data = .Content | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get resource %q" $p }}
{{ end }}
@ -141,7 +141,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`]
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $data = . | transform.Unmarshal }}
{{ $data = .Content | transform.Unmarshal }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $u }}

View File

@ -15,7 +15,7 @@ action:
{{ $p := "data/books.json" }}
{{ with resources.Get $p }}
{{ $opts := dict "delimiter" "," }}
{{ $data = . | transform.Unmarshal $opts }}
{{ $data = .Content | transform.Unmarshal $opts }}
{{ else }}
{{ errorf "Unable to get resource %q" $p }}
{{ end }}

View File

@ -30,7 +30,7 @@ To retrieve and render the content:
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ with . | transform.Unmarshal }}
{{ with .Content | transform.Unmarshal }}
{{ .content | base64Decode | markdownify }}
{{ end }}
{{ end }}

View File

@ -79,7 +79,7 @@ When retrieving remote data, use the [`transform.Unmarshal`] function to [unmars
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $data = . | transform.Unmarshal }}
{{ $data = .Content | transform.Unmarshal }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}

View File

@ -49,7 +49,7 @@ assets/
{{ $data := "" }}
{{ $path := "data/books.json" }}
{{ with resources.Get $path }}
{{ with unmarshal . }}
{{ with unmarshal .Content }}
{{ $data = . }}
{{ end }}
{{ else }}
@ -78,7 +78,7 @@ content/
{{ $data := "" }}
{{ $path := "books.json" }}
{{ with .Resources.Get $path }}
{{ with unmarshal . }}
{{ with unmarshal .Content }}
{{ $data = . }}
{{ end }}
{{ else }}
@ -101,7 +101,7 @@ A remote resource is a file on a remote server, accessible via HTTP or HTTPS.
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $data = . | transform.Unmarshal }}
{{ $data = .Content | transform.Unmarshal }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
@ -172,7 +172,7 @@ Get the remote data:
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $data = . | transform.Unmarshal }}
{{ $data = .Content | transform.Unmarshal }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}