コード例 #1
0
    def _refactor_attributes(self, header):
        """Refactor the attributes section to sphinx friendly format"""

        if self.verbose:
            print '{0} Section'.format(header)

        index = self.index
        self.remove_lines(index, 2)
        indent = get_indent(self.peek())
        fields = self.extract_fields(indent, AttributeField)
        header = fix_backspace(header)
        lines = [indent + ':{0}:'.format(header), '']
        for field in fields:
            lines += field.to_rst(len(indent) + 4)
        self.insert_lines(lines[:-1], index)
        self.index += len(lines)
        return
コード例 #2
0
ファイル: enaml_decl_doc.py プロジェクト: 5n1p/enaml
    def _refactor_attributes(self, header):
        """Refactor the attributes section to sphinx friendly format"""

        if self.verbose:
            print '{0} Section'.format(header)

        index = self.index
        self.remove_lines(index, 2)
        indent = get_indent(self.peek())
        fields = self.extract_fields(indent, AttributeField)
        header = fix_backspace(header)
        lines = [indent + ':{0}:'.format(header), '']
        for field in fields:
            lines += field.to_rst(len(indent) + 4)
        self.insert_lines(lines[:-1], index)
        self.index += len(lines)
        return
コード例 #3
0
    def _refactor_header(self, header):
        """ Refactor the header section using the rubric directive.

        The method has been tested and supports refactoring single word
        headers, two word headers and headers that include a backslash
        ''\''.

        Arguments
        ---------
        header : string
            The header string to use with the rubric directive.

        """
        header = fix_backspace(header)
        directive = '.. rubric:: {0}'.format(header)
        lines = []
        lines += [directive, NEW_LINE]
        return lines
コード例 #4
0
    def _refactor_header(self, header):
        """ Refactor the header section using the rubric directive.

        The method has been tested and supports refactoring single word
        headers, two word headers and headers that include a backslash
        ''\''.

        Arguments
        ---------
        header : string
            The header string to use with the rubric directive.

        """
        index = self.index
        indent = get_indent(self.peek())
        self.remove_lines(index, 2)
        descriptions = []
        header = fix_backspace(header)
        descriptions += [indent + '.. rubric:: {0}'.format(header), '']
        self.insert_lines(descriptions, index)
        self.index += len(descriptions)
        return descriptions
コード例 #5
0
ファイル: base_doc.py プロジェクト: 5n1p/enaml
    def _refactor_header(self, header):
        """ Refactor the header section using the rubric directive.

        The method has been tested and supports refactoring single word
        headers, two word headers and headers that include a backslash
        ''\''.

        Arguments
        ---------
        header : string
            The header string to use with the rubric directive.

        """
        index = self.index
        indent = get_indent(self.peek())
        self.remove_lines(index, 2)
        descriptions = []
        header = fix_backspace(header)
        descriptions += [indent + '.. rubric:: {0}'.format(header), '']
        self.insert_lines(descriptions, index)
        self.index += len(descriptions)
        return descriptions