Jakski/sphinxcontrib-autoyaml

Support for lists

Closed this issue · 1 comments

Would it be possible to add support for parsing YAML lists without a parent key? Most Ansible yaml files will be in the form of a list.

Adding a key to the top of an Ansible file does 'work' as one might expect, but is not a valid Ansible playbook

Example that will parse correctly into reST

test3:
    ###
    # The :code:`test ansible` playbook 
  - name: test ansible
    tasks:
      ###
      # This is a task
    - name: value
      another: value
      ###
      # This is a task      
    - name: value
      another: value

However, most ansible playbooks and roles will not have a test3: parent key, and look more like the list below.

Example lists.yml:

  ###
  # The :code:`test ansible` playbook 
- name: test ansible
  tasks:
    ###
    # This is a task
  - name: value
    another: value
    ###
    # This is a task      
  - name: value
    another: value

Jakski commented

sphinxcontrib-autoyaml is designed to work with mapping data structures. While it's possible to document sequences like above, it results in duplicated entries for key name. I recommend to create a separate reST document describing tasks or to provide a sensible task names in the first place.