diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2017-06-04 16:04:36 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2017-06-05 10:20:44 -0400 |
| commit | b1730c1956aed244d9d05255c95f427fdfcf4d1e (patch) | |
| tree | 19257a9e4ef7fec51177f4a7e36fced7a85055fc /docs/content | |
| parent | a4ddbc506abd34da600abb392513a1e49ea04548 (diff) | |
Adding TOML support
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs/content')
| -rw-r--r-- | docs/content/functions.md | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/docs/content/functions.md b/docs/content/functions.md index c8962146..2cf6a6c7 100644 --- a/docs/content/functions.md +++ b/docs/content/functions.md @@ -372,6 +372,44 @@ $ gomplate < input.tmpl Hello world ``` +## `toml` + +Converts a [TOML](https://github.com/toml-lang/toml) document into an object. +This can be used to access properties of TOML documents. + +Compatible with [TOML v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md). + +### Usage + +```go +toml input +``` + +Can also be used in a pipeline: +```go +input | toml +``` + +### Arguments + +| name | description | +|--------|-------| +| `input` | the TOML document to parse | + +#### Example + +_`input.tmpl`:_ +``` +{{ $t := `[data] +hello = "world"` -}} +Hello {{ (toml $t).hello }} +``` + +```console +$ gomplate -f input.tmpl +Hello world +``` + ## `csv` Converts a CSV-format string into a 2-dimensional string array. @@ -547,6 +585,34 @@ $ gomplate < input.tmpl hello: world ``` +## `toTOML` + +Converts an object to a [TOML](https://github.com/toml-lang/toml) document. + +### Usage + +```go +toTOML obj +``` + +Can also be used in a pipeline: +```go +obj | toTOML +``` + +### Arguments + +| name | description | +|--------|-------| +| `obj` | the object to marshal as a TOML document | + +#### Example + +```console +$ gomplate -i '{{ `{"foo":"bar"}` | json | toTOML }}' +foo = "bar" +``` + ## `toCSV` Converts an object to a CSV document. The input object must be a 2-dimensional @@ -598,7 +664,7 @@ Parses a given datasource (provided by the [`--datasource/-d`](#--datasource-d) Currently, `file://`, `http://`, `https://`, and `vault://` URLs are supported. -Currently-supported formats are JSON, YAML, and CSV. +Currently-supported formats are JSON, YAML, TOML, and CSV. #### Examples |
