Logo Search packages:      
Sourcecode: calibre version File versions

def calibre::ebooks::rtf2xml::field_strings::FieldStrings::__initiate_values (   self  )  [private]

Requires:
    nothing.
Returns:
    nothing.
Logic:
    initiate values for rest of class.
    self.__field_instruction_dict:
The dictionary for all field names.

Definition at line 34 of file field_strings.py.

00034                                :
        """
        Requires:
            nothing.
        Returns:
            nothing.
        Logic:
            initiate values for rest of class.
            self.__field_instruction_dict:
                The dictionary for all field names.
        """
        self.__field_instruction_dict = {
        # number type (arabic, etc.) and number format (\# " ")
        'EDITTIME'      :       (self.__num_type_and_format_func, 'editing-time'),
        'NUMCHARS'      :       (self.__num_type_and_format_func, 'number-of-characters-in-doc'),
        'NUMPAGES'      :       (self.__num_type_and_format_func, 'number-of-pages-in-doc'),
        'NUMWORDS'      :       (self.__num_type_and_format_func, 'number-of-words-in-doc'),
        'REVNUM'        :       (self.__num_type_and_format_func, 'revision-number'),
        'SECTIONPAGES'  :       (self.__num_type_and_format_func, 'num-of-pages-in-section'),
        'SECTION'       :       (self.__num_type_and_format_func, 'insert-section-number'),
        'QUOTE'         :       (self.__num_type_and_format_func, 'quote'),
        # number formatting (\# "")
        'PAGE'          :       (self.__default_inst_func, 'insert-page-number'),
        'page'          :       (self.__default_inst_func, 'insert-page-number'),
        # date format (\@ "")
        'CREATEDATE'    :       (self.__date_func, 'insert-date'),
        'PRINTDATE'     :       (self.__date_func, 'insert-date'),
        # PRINTDATE?
        'SAVEDATE'      :       (self.__date_func, 'last-saved'),
        'TIME'          :       (self.__date_func, 'insert-time'),
        # numbers?
        # these fields take four switches
        'AUTHOR'        :       (self.__simple_info_func, 'user-name'),
        'COMMENTS'      :       (self.__simple_info_func, 'comments'),
        'FILENAME'      :       (self.__simple_info_func, 'file-name'),
        'filename'      :       (self.__simple_info_func, 'file-name'),
        'KEYWORDS'      :       (self.__simple_info_func, 'keywords'),
        'LASTSAVEDBY'   :       (self.__simple_info_func, 'last-saved-by'),
        'SUBJECT'       :       (self.__simple_info_func, 'subject'),
        'TEMPLATE'      :       (self.__simple_info_func, 'based-on-template'),
        'TITLE'         :       (self.__simple_info_func, 'document-title'),
        'USERADDRESS'   :       (self.__simple_info_func, 'user-address'),
        'USERINITIALS'  :       (self.__simple_info_func, 'user-initials'),
        'USERNAME'      :       (self.__simple_info_func, 'user-name'),
        'EQ'            :       (self.__equation_func, 'equation'),
        'HYPERLINK'     :       (self.__hyperlink_func, 'hyperlink'),
        'INCLUDEPICTURE':       (self.__include_pict_func, 'include-picture'),
        'INCLUDETEXT'   :       (self.__include_text_func, 'include-text-from-file'),
        'INDEX'         :       (self.__index_func, 'index'),
        'NOTEREF'       :       (self.__note_ref_func, 'reference-to-note'),
        'PAGEREF' :     (self.__page_ref_func, 'reference-to-page'),
        'REF'           :       (self.__ref_func, 'reference'),
        'ref'           :       (self.__ref_func, 'reference'),
        'SEQ'           :       (self.__sequence_func, 'numbering-sequence'),
        'SYMBOL'        :       (self.__symbol_func, 'symbol'),
        'TA'            :       (self.__ta_func, 'anchor-for-table-of-authorities'),
        'TOA'           :       (self.__toc_table_func, 'table-of-authorities'),
        'TOC'           :       (self.__toc_table_func, 'table-of-contents'),
        # no switches
        'AUTONUMOUT'    :       (self.__no_switch_func, 'auto-num-out?'),
        'COMPARE'       :       (self.__no_switch_func, 'compare'),
        'DOCVARIABLE'   :       (self.__no_switch_func, 'document-variable'),
        'GOTOBUTTON'    :       (self.__no_switch_func, 'go-button'),
        'NEXT'          :       (self.__no_switch_func, 'next'),
        'NEXTIF'        :       (self.__no_switch_func, 'next-if'),
        'SKIPIF'        :       (self.__no_switch_func, 'skip-if'),
        'IF'            :       (self.__no_switch_func, 'if'),
        'MERGEFIELD'    :       (self.__no_switch_func, 'merge-field'),
        'MERGEREC'      :       (self.__no_switch_func, 'merge-record'),
        'MERGESEQ'      :       (self.__no_switch_func, 'merge-sequence'),
        'PLACEHOLDER'   :       (self.__no_switch_func, 'place-holder'),
        'PRIVATE'       :       (self.__no_switch_func, 'private'),
        'RD'            :       (self.__no_switch_func, 'referenced-document'),
        'SET'           :       (self.__no_switch_func, 'set'),
        # default instructions (haven't written a method for them
        'ADVANCE'       :       (self.__default_inst_func, 'advance'),
        'ASK'           :       (self.__default_inst_func, 'prompt-user'),
        'AUTONUMLGL'    :       (self.__default_inst_func, 'automatic-number'),
        'AUTONUM'       :     (self.__default_inst_func, 'automatic-number'),
        'AUTOTEXTLIST'  :       (self.__default_inst_func, 'auto-list-text'),
        'AUTOTEXT'      :       (self.__default_inst_func, 'auto-text'),
        'BARCODE'       :       (self.__default_inst_func, 'barcode'),
        'CONTACT'       :       (self.__default_inst_func, 'contact'),
        'DATABASE'      :       (self.__default_inst_func, 'database'),
        'DATE'          :       (self.__default_inst_func, 'date'),
        'date'          :       (self.__default_inst_func, 'date'),
        'DOCPROPERTY'   :       (self.__default_inst_func, 'document-property'),
        'FILESIZE'      :       (self.__default_inst_func, 'file-size'),
        'FILLIN'        :       (self.__default_inst_func, 'fill-in'),
        'INFO'          :       (self.__default_inst_func, 'document-info'),
        'LINK'          :       (self.__default_inst_func, 'link'),
        'PA'            :       (self.__default_inst_func, 'page'),
        'PRINT'         :       (self.__default_inst_func, 'print'),
        'STYLEREF'      :       (self.__default_inst_func, 'style-reference'),
        'USERPROPERTY'  :       (self.__default_inst_func, 'user-property'),
        'FORMCHECKBOX'  :       (self.__default_inst_func, 'form-checkbox'),
        'FORMTEXT'      :       (self.__default_inst_func, 'form-text'),
        # buttons
        'MACROBUTTON'   :       (self.__default_inst_func, 'macro-button'),
        }
        self.__number_dict = {
            'Arabic'        :   'arabic',
            'alphabetic'    :   'alphabetic',
            'ALPHABETIC'    :   'capital-alphabetic',
            'roman'         :   'roman',
            'ROMAN'         :   'capital-roman',
            'Ordinal'       :   'ordinal',
            'CardText'      :   'cardinal-text',
            'OrdText'       :   'ordinal-text',
            'Hex'           :   'hexidecimal',
            'DollarText'    :   'dollar-text',
            'Upper'         :   'upper-case',
            'Lower'         :   'lower-case',
            'FirstCap'      :   'first-cap',
            'Caps'          :   'caps',
        }
        self.__text_format_dict = {
            'Upper'         :   'upper',
            'Lower'         :   'lower',
            'FirstCap'      :   'first-cap',
            'Caps'          :   'caps',
        }
        self.__symbol_num_exp = re.compile(r'SYMBOL (.*?) ')
        self.__symbol_font_exp = re.compile(r'\\f "(.*?)"')
        self.__symbol_size_exp = re.compile(r'\\s (\d+)')
        ##self.__toc_figure_exp = re.compile(r'\\c "Figure"')
        # \\@ "dddd, MMMM d, yyyy"
00161         self.__date_exp = re.compile(r'\\@\s{1,}"(.*?)"')
        self.__num_type_exp = re.compile(r'\\\*\s{1,}(Arabic|alphabetic|ALPHABETIC|roman|ROMAN|Ordinal|CardText|OrdText|Hex|DollarText|Upper|Lower|FirstCap|Caps)')
        self.__format_text_exp = re.compile(r'\\\*\s{1,}(Upper|Lower|FirstCap|Caps)')
        self.__merge_format_exp = re.compile(r'\\\*\s{1,}MERGEFORMAT')
        self.__ta_short_field_exp = re.compile(r'\\s\s{1,}"(.*?)"')
        self.__ta_long_field_exp = re.compile(r'\\l\s{1,}"(.*?)"')
        self.__ta_category_exp = re.compile(r'\\c\s{1,}(\d+)')
        # indices
        self.__index_insert_blank_line_exp = re.compile(r'\\h\s{1,}""')
        self.__index_insert_letter_exp = re.compile(r'\\h\s{1,}"()"')
        self.__index_columns_exp = re.compile(r'\\c\s{1,}"(.*?)"')
        self.__bookmark_exp = re.compile(r'\\b\s{1,}(.*?)\s')
        self.__d_separator = re.compile(r'\\d\s{1,}(.*?)\s')
        self.__e_separator = re.compile(r'\\e\s{1,}(.*?)\s')
        self.__l_separator = re.compile(r'\\l\s{1,}(.*?)\s')
        self.__p_separator = re.compile(r'\\p\s{1,}(.*?)\s')
        self.__index_sequence = re.compile(r'\\s\s{1,}(.*?)\s')
        self.__index_entry_typ_exp = re.compile(r'\\f\s{1,}"(.*?)"')
        self.__quote_exp = re.compile(r'"(.*?)"')
        self.__filter_switch = re.compile(r'\\c\s{1,}(.*?)\s')
        self.__link_switch = re.compile(r'\\l\s{1,}(.*?)\s')
    def process_string(self, my_string, type):


Generated by  Doxygen 1.6.0   Back to index