'Requires:
line --the line to parse
Returns:
nothing
Logic:
This function handles all lines within a toc or index entry. It
adds each line to a string until the end of the entry is found. It
processes the string with the fields_string module, and
prints out the result.'

def __toc_index_func(self, line):

    if (self.__beg_bracket_count == self.__cb_count):
        self.__state = 'body'
        type = self.__tag
        if (type == 'index'):
            my_string = self.__parse_index_func(self.__text_string)
        elif (type == 'toc'):
            my_string = self.__parse_toc_func(self.__text_string)
        self.__write_obj.write(self.__marker)
        self.__write_obj.write(my_string)
        self.__text_string = ''
        self.__write_obj.write(line)
    else:
        self.__text_string += line
