def __init__(self, package_descr, html_indent_level=0): ''' Evaluates HTML code for the documentation of a specified package. Once instantiated, Package objects can be applied their method get_html_code(). Args: package_descr: DirectoryDescr A reference to the descriptor of this package - which is also a directory on disk. html_indent_level: int The level of indentation in the HTML code for this package. Defaults to 0. Raises: AssertError: the passed argument 'package_descr' is not an instance of class DirectoryDescr. ''' assert isinstance(package_descr, DirectoryDescr) self._package_descr = package_descr self._package_dirpath = Utils.replace_backslash(package_descr.root) self._root_package_name = Utils.replace_backslash( os.path.basename(package_descr.root)) self._html_indent = html_indent_level
def _get_module_header_code(self): ''' Evaluates HTML code for the header of the module documentation. Returns: The header HTML code, embedded in a string, related to this module. ''' #self._root_package_name = Utils.replace_backslash( self._package_path ) self._root_package_name = Utils.replace_backslash( self._package_name).replace('../', '') my_html_code = Utils.html_indent( self._indent_level, '<div class="module_container" id="{:s}">\n'.format( Utils.path_to_id(self.get_html_id()))) my_html_code += Utils.html_indent( self._indent_level + 1, '<p class="module_def">module <b>{:s}</b></p>\n\n'.format( self._module_name)) return my_html_code