Logo Search packages:      
Sourcecode: calibre version File versions

calibre::ebooks::rtf2xml::fields_large::FieldsLarge Class Reference

List of all members.


Detailed Description

=========================
Logic
=========================
Make tags for fields.
-Fields reflect text that Microsoft Word automatically generates.
-Each file contains (or should contain) an inner group called field instructions.
-Fields can be nested.
--------------
Logic
--------------
1. As soon as a field is found, make a new text string by appending an empty text string to the field list. Collect all the lines in this string until the field instructions are found.
2. Collect all the tokens and text in the field instructions. When the end of the field instructions is found, process the string of text with the field_strings module. Append the processed string to the field instructins list.
3. Continue collecting tokens. Check for paragraphs or sections. If either is found, add to the paragraph or section list.
4. Continue collecting tokens and text either the beginning of a new field is found, or the end of this field is found.
5. If a new field is found, repeat steps 1-3.
6. If the end of the field is found, process the last text string of the field list.
7. If the field list is empty (after removing the last text string), there are no more fields. Print out the final string. If the list contains other strings, add the processed string to the last string in the field list.
============================
Examples
============================
This line of RTF:
    {\field{\*\fldinst { CREATEDATE  \\* MERGEFORMAT }}{\fldrslt {
    \lang1024 1/11/03 10:34 PM}}}
Becomes:
    <field type = "insert-time">
        10:34 PM
    </field>
The simple field in the above example conatins no paragraph or sections breaks.
This line of RTF:
    {{\field{\*\fldinst SYMBOL 97 \\f "Symbol" \\s 12}{\fldrslt\f3\fs24}}}
Becomes:
    <para><inline font-size="18"><inline font-style="Symbol">&#x03A7;</inline></inline></para>
    The RTF in the example above should be represented as UTF-8 rather than a field.
This RTF:
    {\field\fldedit{\*\fldinst { TOC \\o "1-3" }}{\fldrslt {\lang1024
    Heading one\tab }{\field{\*\fldinst {\lang1024  PAGEREF _Toc440880424
    \\h }{\lang1024 {\*\datafield
    {\lang1024 1}}}{\lang1024 \par }\pard\plain
    \s18\li240\widctlpar\tqr\tldot\tx8630\aspalpha\aspnum\faauto\adjustright\rin0\lin240\itap0
    \f4\lang1033\cgrid {\lang1024 Heading 2\tab }{\field{\*\fldinst
    {\lang1024  PAGEREF _Toc440880425 \\h }{\lang1024 {\*\datafield
    {\lang1024 1}}}{\lang1024 \par }\pard\plain
    \widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
    \f4\lang1033\cgrid }}\pard\plain
    \widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
    \f4\lang1033\cgrid {\fs28 \u214\'85 \par }{\fs36 {\field{\*\fldinst
    SYMBOL 67 \\f "Symbol" \\s 18}{\fldrslt\f3\fs36}}}
Becomes:
    <field-block type="table-of-contents">
    <paragraph-definition language="1033" nest-level="0"
    font-style="Times" name="toc 1" adjust-right="true"
    widow-control="true">
    <para><inline language="1024">Heading one&#x009;</inline><field
    type="reference-to-page" ref="_Toc440880424"><inline
    language="1024">1</inline></field></para>
    </paragraph-definition>
    <paragraph-definition language="1033" nest-level="0" left-indent="12"
    font-style="Times" name="toc 2" adjust-right="true"
    widow-control="true">
    <para><inline language="1024">Heading 2&#x009;</inline><field
    type="reference-to-page" ref="_Toc440880425"><inline
    language="1024">1</inline></field></para>
    </paragraph-definition>
    </field-block>

Definition at line 20 of file fields_large.py.


Public Member Functions

def __init__
def fix_fields

Private Member Functions

def __before_body_func
def __end_field_func
def __field_instruction_func
def __found_field_func
def __found_field_instruction_func
def __in_body_func
def __in_field_func
def __initiate_values
def __par_in_field_func
def __sec_in_field_func
def __write_field_string

Private Attributes

 __bug_handler
 __cb_count
 __copy
 __field_count
 __field_dict
 __field_instruction
 __field_instruction_count
 __field_instruction_string
 __field_string
 __file
 __in_body_dict
 __marker
 __ob_count
 __par_in_field
 __run_level
 __sec_in_field
 __state
 __state_dict
 __string_obj
 __symbol
 __text_string
 __token_info
 __write_obj
 __write_to

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index