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

Inconsistent newline behavior based on order of insertion #387

Open
hcording opened this issue Nov 23, 2024 · 0 comments
Open

Inconsistent newline behavior based on order of insertion #387

hcording opened this issue Nov 23, 2024 · 0 comments

Comments

@hcording
Copy link

hcording commented Nov 23, 2024

I stumbled over this behavior today:

table().add("a", table()).add("y", 3.2).as_string()
'y = 3.2\n[a]\n'

table().add("y", 3.2).add("a", table()).as_string()
'y = 3.2\n\n[a]\n'

I wouldn't expect the results to differ, because in both cases the literal is inserted above the table. It seems that the second result is what should be always produced, because it conforms with the current practice of always separating tables from previous content by an additional newline. But this seems to break when inserting a literal over the first table in the document, if I see that correctly.

tomlkit 0.13.2
python 3.12.7
linux
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

1 participant