Introduction
MIME types are classifications of content, typically used for email attachments and other places where data is interchanged and must be described. For example, the 'text/html' type represents HTML content, whilst the 'text/structured' type represents StructuredText. The 'MimetypesRegistry', bundled with Archetypes, keeps track of the various MIME types available to Plone in the 'mimetypes_registry' tool.
'PortalTransforms', also bundled with Archetypes, provides the 'portal_transforms' tool, which is used to transform data between two MIME types. For example, if you enter StructuredText in a Page, it is transformed to HTML via the 'st' transform when the object is displayed.
In this tutorial, you will learn how to register new MIME types with 'mimetypes_tool', and how to create new transforms with 'PortalTransforms'. The example used throughout the tutorial is the 'intelligenttext' product, "found in the Collective":https://svn.plone.org/svn/collective/intelligenttext/trunk. This provides a new MIME type, 'text/x-web-intelligent', which describes a plain text type that can be transformed to HTML in such a way that paragraph breaks and indentation remains, and web- and email addresses become clickable links. The transform that converts from 'text/x-web-intelligent' to 'text/html' is called 'web_intelligent_plain_text_to_html'.
Additionally, the product provides a 'html_to_web_intelligent_plain_text' transform that can convert HTML to plain text. Note that these transforms are not commutative, so if you convert from 'text/x-web-intelligent' to 'text/html' and then back to 'text/x-web-intelligent', you may not end up with exactly what you started with. This is because HTML is much richer than plain text in formatting, and certain assumptions are made about how to sensibly represent various HTML tags and entities as plain text.
