コード例 #1
0
ファイル: html_package.py プロジェクト: schmouk/Typee
    def _get_package_header_code(self):
        '''
        Evaluates HTML code for the header of the package documentation.
        
        Returns:
            The header HTML code, embedded in a string, related to this package.
        '''
        my_package_dirpath = self._package_dirpath.replace('../', '')
        my_parent_package_path = os.path.dirname(my_package_dirpath)
        my_parent_package_id = Utils.path_to_id(my_parent_package_path)

        my_html_code = Utils.html_indent(
            self._html_indent,
            '<div class="package_container" id="{:s}">\n'.format(
                Utils.path_to_id(my_package_dirpath)))
        if my_parent_package_id == '':
            my_html_code += Utils.html_indent(
                self._html_indent + 1,
                '<p class="package_def">package <b><span class="package_def">{:s}</span></b></p>\n\n'
                .format(self._root_package_name))
        else:
            my_html_code += Utils.html_indent(
                self._html_indent + 1,
                '<p class="package_def">package <b><a class="package_def" href="#{:s}">{:s}</a><span class="package_def">{:s}{:s}</span></b></p>\n\n'
                .format(my_parent_package_id, my_parent_package_path,
                        '/' if my_parent_package_path != '' else '',
                        self._root_package_name))

        return my_html_code
コード例 #2
0
 def get_html_id(self):
     '''
     Gets an HTML identifier associated with a module and its embedding package.
     
     Returns:
         A string containing the CSS id associated with the specified module. 
     '''
     return '_'.join(
         (Utils.path_to_id(self._package_name), self._module_name))
コード例 #3
0
ファイル: html_package.py プロジェクト: schmouk/Typee
    def _get_package_footer_code(self):
        '''
        Evaluates HTML code for the footer of the package documentation.
        
        Returns:
            The HTML code, embedded in a string, related to this package.
        '''
        my_parent_package_path = os.path.dirname(
            self._package_dirpath).replace('../', '')

        return Utils.html_indent(
                    self._html_indent+1,
                    ('<p class="package_end">end of package <b><a class="package_end" href="#{:s}">' +  \
                     '{:s}</a>{:s}&nbsp;<a class="package_end" href="#{:s}">{:s}</a></b></p>\n').format(
                        Utils.path_to_id( my_parent_package_path ),
                        my_parent_package_path                    ,
                        '/' if my_parent_package_path != '' else '',
                        Utils.path_to_id( self._package_dirpath.replace('../','') ) ,
                        self._root_package_name                     )
               ) + \
               Utils.html_indent(
                   self._html_indent,
                   '</div> <!-- end of package container {:s} -->\n\n'.format( Utils.path_to_id( self._package_dirpath )  )
               )
コード例 #4
0
    def _get_module_footer_code(self):
        '''
        Evaluates HTML code for the footer of the module documentation.
        
        Returns:
            The HTML code, embedded in a string, related to this module.
        '''
        package_path = self._package_path.replace('../', '')
        my_html_code = Utils.html_indent(
            self._indent_level + 1,
            '<p>back to package <a class="package_end" href="#{:s}">{:s}</a></p>\n'
            .format(Utils.path_to_id(package_path), package_path))
        my_html_code += Utils.html_indent(
            self._indent_level,
            '</div> <!-- end of module {:s} -->\n\n'.format(
                self.get_html_id()))

        return my_html_code
コード例 #5
0
    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
コード例 #6
0
ファイル: html_package.py プロジェクト: schmouk/Typee
    def _list_sub_packages(self):
        '''
        Evaluates HTML code for the list of sub_packages contained within
        this package.
        
        Returns:
            The HTML code, embedded in a string, related to this package.
        '''
        my_html_code = ''

        if len(self._package_descr.dirs) > 0:
            # sub-packages are embedded in current package
            package_dirpath = self._package_dirpath.replace('../', '')
            my_html_code += Utils.html_indent(self._html_indent + 1,
                                              '<div class="packages-list">\n')
            my_html_code += Utils.html_indent(
                self._html_indent + 2,
                '<p><b>List of sub-packages for package {:s}</b></p>\n'.format(
                    package_dirpath))
            my_html_code += Utils.html_indent(self._html_indent + 2,
                                              '<p class="packages-names">\n')

            for sub_package_name in sorted(self._package_descr.dirs):
                my_sub_package_name = '/'.join(
                    (package_dirpath, sub_package_name))
                my_html_code += Utils.html_indent(
                    self._html_indent + 3,
                    '<a href="#{:s}">{:s}</a><br />\n'.format(
                        Utils.path_to_id(my_sub_package_name),
                        my_sub_package_name))

            my_html_code += Utils.html_indent(self._html_indent + 2, '</p>\n')
            my_html_code += Utils.html_indent(self._html_indent + 1,
                                              '</div>\n\n')

        return my_html_code