def _build_docs_blob(self): """Build importer result docs_blob from collection documentation.""" # return an empty DocsBlob if run_ansible_doc=False rendered_readme = schema.RenderedDocFile() docs_blob = schema.DocsBlob( collection_readme=rendered_readme, documentation_files=[], contents=[], ) if not self.cfg.run_ansible_doc: return docs_blob contents = [ schema.DocsBlobContentItem( content_name=c.name, content_type=c.content_type.value, doc_strings=c.doc_strings, readme_file=c.readme_file, readme_html=c.readme_html, ) for c in self.content_objs ] readme = markup_utils.get_readme_doc_file(self.path) if not readme: raise exc.ImporterError('No collection readme found') rendered_readme = schema.RenderedDocFile( name=readme.name, html=markup_utils.get_html(readme)) rendered_doc_files = [] doc_files = markup_utils.get_doc_files( os.path.join(self.path, DOCUMENTATION_DIR)) if doc_files: rendered_doc_files = [ schema.RenderedDocFile(name=f.name, html=markup_utils.get_html(f)) for f in doc_files ] execution_environment = ee_utils.process_execution_environment( self.path, self.log) return schema.DocsBlob( collection_readme=rendered_readme, documentation_files=rendered_doc_files, contents=contents, execution_environment=execution_environment, )
def _build_docs_blob(self): """Build importer result docs_blob from collection documentation.""" contents = [ schema.DocsBlobContentItem( content_name=c.name, content_type=c.content_type.value, doc_strings=c.doc_strings, readme_file=c.readme_file, readme_html=c.readme_html, ) for c in self.content_objs ] readme = markup_utils.get_readme_doc_file(self.path) if not readme: raise exc.ImporterError('No collection readme found') rendered_readme = schema.RenderedDocFile( name=readme.name, html=markup_utils.get_html(readme)) rendered_doc_files = [] doc_files = markup_utils.get_doc_files( os.path.join(self.path, DOCUMENTATION_DIR)) if doc_files: rendered_doc_files = [ schema.RenderedDocFile(name=f.name, html=markup_utils.get_html(f)) for f in doc_files ] return schema.DocsBlob( collection_readme=rendered_readme, documentation_files=rendered_doc_files, contents=contents, )