intelligenttext

Warning
This product has not had a release in over 1 year and may no longer be maintained.
by Maurits van Rees last modified Feb 16, 2011 02:14 AM

- 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.

Project Description

Note that there are two major versions of intelligenttext:

Products.intelligenttext

  • Found in the collective, with downloads right here in this project.
  • This should be put in the Products directory of your instance.
  • Use this on Plone 2.5 and earlier.
  • Contains a mime type and two transforms.
  • Not developed anymore, as it is superseded by plone.intelligenttext. Bug fixes can be expected though.

plone.intelligenttext

  • Found in the main plone subversion repository, with releases on the cheese shop.
  • This should be put in the lib/python directory of your instance.
  • Use this on Plone 3.0 and later. In fact, this is in core Plone, so you will automatically get it when you use Plone 3.0.
  • Note: this only contains the base python functions (converting from intelligent text to html and the other way around). The MimeTypesRegistry product registers a mime type for this and the PortalTransforms product registers two transforms using the functions defined in plone.intelligenttext.

Going from Plone 2.5 to 3.0

You have a Plone 2.5 site with intelligenttext in the Products directory? The adviced route is this:

  1. In your 2.5 site uninstall intelligenttext in the Add/Remove Products page of the Plone Control Panel.
  2. Remove intelligenttext from your Products folder.
  3. Install Plone 3.0 (follow steps in the upgrade guide). During the portal_migration the mime type and the transforms for intelligenttext will be added using the plone.intelligenttext that comes with Plone 3.0.

Oh no, I found a bug!

Please report these in the issue tracker of core plone.

So what is intelligenttext?

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

Kai Diefenbach

Hanno Schlichting

Thomas Müller

Maurits van Rees

 

The transform was originally based on the url_to_hyperlink transform from

Ploneboard by Plone Solutions and others.

Current Release
intelligenttext 1.0

Released Dec 04, 2007 — tested with Plone 2.5

First official release of Products.intelligenttext
More about this release…

Download file Get intelligenttext for all platforms
Products.intelligenttext 1.0.1
If you are using Plone 3.2 or higher, you probably want to install this product with buildout. See our tutorial on installing add-on products with buildout for more information.

All Releases

Version Released Description Compatibility Status
1.0 Dec 04, 2007 First official release of Products.intelligenttext More about this release…
Plone 2.5
final

Comments (0)