intelligenttext
 - by Martin Aspeli
 
 This product contains a mimetype (for the mimetypes_registry) and a transform 
 (for portal_transforms) that is capable converting plain text into HTML where
 line breaks and indentation is preserved, and web and email addresses are made
 into clickable links.
 
 For Plone 3.0: see the plone.intelligenttext package instead, which
 is based on this product.

The mimetype, in mimetype.py, is 'text/x-web-intelligent'. The transform is 
called 'web_intelligent_plain_text_to_html', and can be found in 
transforms/web_intelligent_plain_text_to_html.py.

There is also a transform that can convert from HTML to plain text, called
'html_to_web_intelligent_plain_text'. Note that these are not commutative, so
if you convert from text/x-web-intelligent to html and back, you may not end up
with exactly what you started with!

To directly convert a value from plain text to HTML, do:

    portal_transforms = getToolByName(self, 'portal_transforms')
    data = portal_transforms.convertTo('text/html', text, 
                                            mimetype='text/-x-web-intelligent')
    html = data.getData()
 
To use it on an Archetypes field, do:

    TextField('text',
        widget=TextAreaWidget(
            label="Text",
            description="Enter some text",
        ),
        searchable=True,
        default_content_type="text/x-web-intelligent",
        allowable_content_types=('text/x-web-intelligent',),
        default_output_type="text/html"
    ),

Archetypes will now automatically save your text as text/x-web-intelligent
when you edit text via base_edit, and transform the text to html when you call
the accessor (i.e. getText() in this example).

Note that to ensure the mimetype is set correctly, you must pass it as a keyword
argument if you manually call the mutator:

    instance.setText('Go to http://plone.org', 
                        mimetype='text/x-web-intelligent')
 
 
Credits:
 
    Martin Aspeli (optilude@gmx.net) -- Development
    
    The transform was originally based on the url_to_hyperlink transform from
    Ploneboard by Plone Solutions and others.

    Thomas Mueller and Maurits van Rees -- Various fixes.
