Nested list keys are not rendered
Closed this issue · 4 comments
Problem
Nested keys that are a list are not rendered.
How to reproduce
Like the following example
###
# This is a root test key
test_key_1:
###
# This is a nested key in a list
- secret_name: value
###
# This is another nested key in a list
json_section_key: value
###
# This is another nested key in a list
json_value_key: ssh-key
###
# This is another nested key in a list
envvar_name: value
- secret_name: value
json_section_key: value
json_value_key: value
Expected output
This should be rendered probably like:
root_key
hello
- nested_key_list
asdf
another_item_in_the_same_item
text
- another_nested_key_list
asdf
another_root_key
text goes here
Current output
test_key_1
This is a root test key
Is there a reason why https://github.com/Jakski/sphinxcontrib-autoyaml/blob/master/tests/examples/output/index.yml#L36-L40 should not be rendered?
Currently lists are not handled. Rendering them would require using additional node types from docutils
. bullet_list seems to be a good candidate for this job.
What about ambiguities like:
list:
# Comment1
- nested_key1: nested_value1
nested_key2: nested_value2
Should comment accompany nested_key1
or whole list item list[0]
? What, if someone needs to comment both: list item as a whole and first mapping key inside this list item?
@Jakski right there, the thing is that the comments represent information for the keys and not for the type. I think it should be something like:
# Comment for list explaining what the list items mean
list:
# Comment for nested_key1
- nested_key1: nested_value1
# Comment for nested_key1
nested_key2: nested_value2
The thing is that the nested items in the list might have totally different meanings.
I thought this was the role of autoyaml_level, but indeed it isn't.
It would be good to be able to render the items in the list (specially when they are mappings)