Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for arrays on multiple lines #2

Open
ModelEarth opened this issue Oct 22, 2021 · 1 comment
Open

Fix for arrays on multiple lines #2

ModelEarth opened this issue Oct 22, 2021 · 1 comment

Comments

@ModelEarth
Copy link

GitHub's TOML includes line returns within arrays.

topics = [
"red",
"blue",
"green"
]

This hack removes line returns by brackets and commas:
data = data.replace(/[\n/g, '[') // Replace line return after bracket
data = data.replace(/[[ ]"/g, '["') // Replace [ then arbitrary amount of spaces then a quote
data = data.replace(/,\n[ ]
/g, ',') // Replace comma following by line return and any amount of space
data = data.replace(/\n]/g, ']') // Replace line return before bracket

Resulting in one line in the incoming data:
topics = ["red","blue","green"]

But ideally the regex would reside in the toml.js file and only remove the line returns between brackets.
Thanks!

@marksheldon
Copy link

+1 on this!
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants