コード例 #1
0
    def __parse_title(self, source_filename, raw_title):
        if raw_title.startswith('SECTION'):
            rel_filename = raw_title.split('SECTION:')[1].strip()
            section_name = os.path.abspath(
                os.path.join(os.path.dirname(source_filename), rel_filename))

            if not os.path.exists(section_name):
                fname, ext = os.path.splitext(source_filename)
                if self.__section_file_matching and os.path.exists(
                        source_filename) and (
                            (ext == ".c" and os.path.exists(fname + '.h'))
                            or ext == '.h'):
                    section_name = source_filename[:-2] + '.h'
                else:
                    section_name = rel_filename

            return section_name, [], True

        split = raw_title.split(': ', 1)

        if not len(split) > 1 and not split[0].rstrip().endswith(':'):
            raise HotdocSourceException(
                message='Unexpected title in gtk-doc comment')

        title = split[0].rstrip(':')
        annotations = []

        if len(split) > 1:
            annotations = self.__parse_annotations(split[1])
        return title, annotations, False
コード例 #2
0
    def __parse_title(self, raw_title):
        if raw_title.startswith('SECTION'):
            filename = raw_title.split('SECTION:')[1].strip()
            return filename, []

        split = raw_title.split(': ', 1)
        title = split[0].rstrip(':')
        annotations = []
        if len(split) > 1:
            annotations = self.__parse_annotations(split[1])
        elif not raw_title.strip().endswith(':'):
            raise HotdocSourceException(
                message="Missing colon in comment name : %s" % raw_title)
        return title, annotations
コード例 #3
0
    def __parse_title(self, source_filename, raw_title):
        if raw_title.startswith('SECTION'):
            section_name = raw_title.split('SECTION:')[1].strip()
            return section_name, [], True

        split = raw_title.split(': ', 1)

        title = split[0].rstrip(':')
        if not len(split) > 1 and not title.endswith(':') and " " in title:
            raise HotdocSourceException(
                message='Unexpected title in gtk-doc comment')

        annotations = []

        if len(split) > 1:
            annotations = self.__parse_annotations(split[1])
        return title, annotations, False