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

Preserve comments on list items #171

Open
jacebrowning opened this issue Apr 12, 2020 · 0 comments
Open

Preserve comments on list items #171

jacebrowning opened this issue Apr 12, 2020 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jacebrowning
Copy link
Owner

jacebrowning commented Apr 12, 2020

This test demonstrates the expected functionality:

def with_comments_on_list_items(expect):
sample = SampleWithListOfDataclasses()
write(
'tmp/sample.yml',
"""
# Header
items: # Subheader
# Section
- name: a # Item
score: 1
# Section
- name: b # Item
score: 2
""",
)
sample.datafile.load()
sample.items[1].name = 'c'
sample.datafile.save()
expect(read('tmp/sample.yml')) == dedent(
"""
# Header
items: # Subheader
# Section
- name: a # Item
score: 1
# Section
- name: c # Item
score: 2
"""
)

This appears to be an issue with the YAML library: https://sourceforge.net/p/ruamel-yaml/tickets/318/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant