Documents the various paginators for a service param section: The section to write to.
(self, section)
| 33 | ) |
| 34 | |
| 35 | def document_paginators(self, section): |
| 36 | """Documents the various paginators for a service |
| 37 | |
| 38 | param section: The section to write to. |
| 39 | """ |
| 40 | section.style.h2('Paginators') |
| 41 | self._add_overview(section) |
| 42 | section.style.new_line() |
| 43 | section.writeln('The available paginators are:') |
| 44 | section.style.toctree() |
| 45 | |
| 46 | paginator_names = sorted( |
| 47 | self._service_paginator_model._paginator_config |
| 48 | ) |
| 49 | |
| 50 | # List the available paginators and then document each paginator. |
| 51 | for paginator_name in paginator_names: |
| 52 | section.style.tocitem( |
| 53 | f'{self._service_name}/paginator/{paginator_name}' |
| 54 | ) |
| 55 | # Create a new DocumentStructure for each paginator and add contents. |
| 56 | paginator_doc_structure = DocumentStructure( |
| 57 | paginator_name, target='html' |
| 58 | ) |
| 59 | self._add_paginator(paginator_doc_structure, paginator_name) |
| 60 | # Write paginators in individual/nested files. |
| 61 | # Path: <root>/reference/services/<service>/paginator/<paginator_name>.rst |
| 62 | paginator_dir_path = os.path.join( |
| 63 | self._root_docs_path, self._service_name, 'paginator' |
| 64 | ) |
| 65 | paginator_doc_structure.write_to_file( |
| 66 | paginator_dir_path, paginator_name |
| 67 | ) |
| 68 | |
| 69 | def _add_paginator(self, section, paginator_name): |
| 70 | section.add_title_section(paginator_name) |