Skip to content

Commit 17f8d33

Browse files
authored
content: Add format option to transform.Unmarshal
1 parent a6a9715 commit 17f8d33

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

‎content/en/functions/transform/Unmarshal.md‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ aliases: [/functions/transform.unmarshal]
1313

1414
The input can be a string or a [resource](g).
1515

16+
### Options
17+
18+
delimiter
19+
: (`string`) Applicable to CSV files. The delimiter used. Default is `,`.
20+
21+
comment
22+
: (`string`) Applicable to CSV files. The comment character used in the CSV. If set, lines beginning with the comment character without preceding whitespace are ignored.
23+
24+
format
25+
: {{< new-in 0.149.0 />}}
26+
: (`string`) The serialization format of the input, one of `csv`, `json`, `org`, `toml`, `xml`, or `yaml`. If empty or unspecified, Hugo infers the format from the input. For resources, this option is only needed if the file lacks an extension or to override the inferred format. For strings, it's only required when the format is ambiguous.
27+
28+
lazyQuotes
29+
: {{< new-in 0.122.0 />}}
30+
: (`bool`) Applicable to CSV files. Whether to allow a quote in an unquoted field, or to allow a non-doubled quote in a quoted field. Default is `false`.
31+
32+
targetType
33+
: {{< new-in 0.146.7 />}}
34+
: (`string`) Applicable to CSV files. The target data type, either `slice` or `map`. Default is `slice`.
35+
1636
## Unmarshal a string
1737

1838
```go-html-template
@@ -116,26 +136,6 @@ A remote resource is a file on a remote server, accessible via HTTP or HTTPS.
116136
117137
## Working with CSV
118138

119-
### Options
120-
121-
When unmarshaling a CSV file, provide an optional map of options.
122-
123-
delimiter
124-
: (`string`) The delimiter used. Default is `,`.
125-
126-
comment
127-
: (`string`) The comment character used in the CSV. If set, lines beginning with the comment character without preceding whitespace are ignored.
128-
129-
lazyQuotes
130-
: {{< new-in 0.122.0 />}}
131-
: (`bool`) Whether to allow a quote in an unquoted field, or to allow a non-doubled quote in a quoted field. Default is `false`.
132-
133-
targetType
134-
: {{< new-in 0.146.7 />}}
135-
: (`string`) The target data type, either `slice` or `map`. Default is `slice`.
136-
137-
### Examples
138-
139139
The examples below use this CSV file:
140140

141141
```csv

0 commit comments

Comments
 (0)