Array of tables output
If I have this code:
import toml
in_s = '''
[[Winter]]
December = [
{ Sunday = 6 },
{ Monday = 7 }
]
January = [
{ Sunday = 6 },
{ Monday = 7 }
]
[[Spring]]
March = [
{ Sunday = 6 },
{ Monday = 7 }
]
April = [
{ Sunday = 6 },
{ Monday = 7 }
]
'''
m = toml.loads(in_s)
out_s = toml.dumps(m)
print(out_s)
I get this result:
[[Winter]]
[[Winter.December]]
Sunday = 6
[[Winter.December]]
Monday = 7
[[Winter.January]]
Sunday = 6
[[Winter.January]]
Monday = 7
[[Spring]]
[[Spring.March]]
Sunday = 6
[[Spring.March]]
Monday = 7
[[Spring.April]]
Sunday = 6
[[Spring.April]]
Monday = 7
Is it possible to get something closer to the input?
As a first time contributor, this seems like a fun starting point. I'll give it a shot sometime in the next week.
not sure how helpful it is, but I did find an implementation in C++ that produces the output I am talking about:
https://github.com/marzer/tomlplusplus
Oddly enough, there is an unused method to dump inline tables. Considering Uiri did 90% of what was needed to implement inline tables in 2017 but never finished it, not having inline tables is likely a design choice (albeit one that I do not understand).
https://github.com/uiri/toml/blob/3f637dba5f68db63d4b30967fedda51c82459471/toml/encoder.py#L157
BTW, you can use this wrapper to get TomlPlusPlus's behavior in Python https://github.com/bobfang1992/pytomlpp, although it also does not output your TOML inline.
I was just looking for this. :'(