yaml4rst package


yaml4rst.cli module

Command line interface of yaml4rst


yaml4rst.reformatter module

Reformatting class of yaml4rst

exception yaml4rst.reformatter.YamlRstReformatterError

Bases: exceptions.Exception

Exception which is thrown by YamlRstReformatter when a unrecoverable error occurred.

class yaml4rst.reformatter.YamlRstReformatter(preset='debops/ansible', template_path='/home/docs/checkouts/readthedocs.org/user_builds/yaml4rst/checkouts/latest/yaml4rst/templates', config=None)

Bases: object

YAML+RST linting/reformatting class with the following features:

Checks for:

  • Reasonable variable namespace
  • Undocumented variables

Automatically fixes:

  • RST sections which are not folds
  • Undocumented variables (adds a FIXME for the user)
  • Documented variables which are not folds
  • YAML documents without a defined header
  • Spacing between variables and sections

Return one string containing all lines.


Read the given input file path and save its content for later processing.


Process (check/lint/reformat) the instance lines.

write_file(output_file, only_if_changed=False)

Write the instance lines to the given output file path and save its content for later processing.

yaml4rst.defaults module

Default configuration of yaml4rst

yaml4rst.helpers module

Helper functions of yaml4rst

yaml4rst.helpers.get_first_match(pattern, strings, ind_offset=None, limit_pattern=None, break_pattern=None, match=True)
yaml4rst.helpers.get_last_index(input_list, search_elems, fallback=None)
yaml4rst.helpers.get_last_match(pattern, strings, ind_offset=None, limit_pattern=None, match=True)
yaml4rst.helpers.insert_list(base_list, ind, add_list)
yaml4rst.helpers.list_index(input_list, elem, fallback=None)

Module contents

Linting/reformatting Python package for YAML files documented with inline RST