Lacking exemples in toml data files

Hi, the data page would need some love.
I need toml’s multline strings, I can’t bear yaml’s indentation for the data I need to write and display. How would you translate the following into toml ?

- title: The Hunchback of Notre Dame
author: Victor Hugo
isbn: 978-0140443530
- title: Les Misérables
author: Victor Hugo
isbn: 978-0451419439

Especially if the title field was a multline string ? translators on internet don’t see this text as valid yaml…

Those YAML examples are meant to exactly match the file tree shown directly above them, which is why we don’t have a data toggle.

YAML and TOML handle arrays differently, so you need to structure the data directory differently. Specifically, each table must have a key.

https://toml.io/en/v1.0.0#array-of-tables

data/
└── books.toml
data/books.toml
[[fiction]]
title = "The Hunchback of Notre Dame"
author = "Victor Hugo"
isbn = "978-0140443530"

[[fiction]]
title = "Les Misérables"
author = "Victor Hugo"
isbn = "978-0451419439"

But accessed the same way:

<pre>{{ jsonify (dict "indent" "  ") site.Data.books.fiction }}</pre>

You can learn more about TOML, including how to represent multiline strings, by reading the spec:

https://toml.io/en/v1.0.0#string

Oh, neat, I like it better that way. Thanks.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.