Logo Search packages:      
Sourcecode: calibre version File versions

def calibre::ebooks::rtf2xml::field_strings::FieldStrings::__ref_func (   self,
  field_name,
  name,
  line 
) [private]

Requires:
    field_name -- the first word in the string
    name -- the changed name according to the dictionary
    line -- the string to be parsed
Returns:
    The name of the field.
Logic:
    A page reference field looks like this:
PAGEREF _Toc440880424 \\h
    I want to extract the second line of info, which is used as an
    achor in the resulting XML file.

Definition at line 503 of file field_strings.py.

00503                                                 :
        """
        Requires:
            field_name -- the first word in the string
            name -- the changed name according to the dictionary
            line -- the string to be parsed
        Returns:
            The name of the field.
        Logic:
            A page reference field looks like this:
                PAGEREF _Toc440880424 \\h
            I want to extract the second line of info, which is used as an
            achor in the resulting XML file.
        """
        the_string = name
        match_group = re.search(self.__format_text_exp, line)
        if match_group:
            name =  match_group.group(1)
            changed_name =   self.__text_format_dict.get(name)
            if changed_name:
                the_string += '<format>%s' % changed_name
            else:
                sys.stderr.write('module is fields_string\n')
                sys.stderr.write('method is __parse_num_type\n')
                sys.stderr.write('no dictionary entry for %s\n' % name)
        line = re.sub(self.__merge_format_exp, '', line)
        words = line.split()
        words = words[1:] #  get rid of field name
        for word in words:
            if word[0:1] != '\\':
                the_string += '<bookmark>%s' % word
        index = line.find('\\f')
        if index > -1:
            the_string += '<include-note-number>true'
        index = line.find('\\h')
        if index > -1:
            the_string += '<hyperlink>true'
        index = line.find('\\n')
        if index > -1:
            the_string += '<insert-number>true'
        index = line.find('\\r')
        if index > -1:
            the_string += '<insert-number-relative>true'
        index = line.find('\\p')
        if index > -1:
            the_string += '<paragraph-relative-position>true'
        index = line.find('\\t')
        if index > -1:
            the_string += '<suppress-non-delimeter>true'
        index = line.find('\\w')
        if index > -1:
            the_string += '<insert-number-full>true'
        return [None, None, the_string]
    def __toc_table_func(self, field_name, name, line):


Generated by  Doxygen 1.6.0   Back to index