Making a transform from markdown to XPress Tags

I am considering making a way to export content from Plone to QuarkXpress (desktop publishing).

To make a view that takes fields and export them is not too hard, but it would be nice to transform from markdown to XPressTags.

The format is very easy, and a bit similar to html:

# My title  would be something like  @Title:My Title

*italic* would be <I>Italic<I> (notice no end tag)
**bold** would be <B>bold<B>

So, how would a make such a transform, and should I ? Is it better to look at collective.csvexport or something similar.?

Take a look at plone.intelligenttext. That should give you enough pointers to get started.

Though I don't think this will bring you anything; do you want to import data with basic styling into a DTP application?

Yes, that is what I plan to do… ( I am pretty good at this but I have been using different approaches (like CSV, Excel, XML, AppleScript).

Things has changed in the DTP (QuarkXpress) program, making it much more interesting to do it this way (what earlier needed several text boxes can now be done in one, meaning that one can do everything in one export / import instead of 'far too many' as it was before. Also, I noticed that someone just made something that does it 'the other way'…

It looks to me that a lot of code is also in Products.PortalTransforms ( )
I would guess that the 'correct way' would be to add another entry to @@markup-controlpanel (or would it be ok to just use 'text/plain' ?

PS: I will not need a transform FROM html.

OK, I have gotten a bit further, so I have another question:

To me, it looks like the best approach would be to have another option in the markup settings.
( /@@markup-controlpanel )

Since my 'tags' probably 'technically is plain text', I wonder:

Can I invent a mime type and add it ?

PS: I did try:

    <record name="plone.allowed_types" interface="Products.CMFPlone.interfaces.controlpanel.IMarkupSchema" field="allowed_types">
  <field type="plone.registry.field.Tuple">
      <value_type type="plone.registry.field.Choice">
      Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module Products.CMFPlone.controlpanel.browser.quickinstaller, line 687, in __call__
  Module Products.CMFPlone.controlpanel.browser.quickinstaller, line 452, in install_product
  Module Products.GenericSetup.tool, line 388, in runAllImportStepsFromProfile
  __traceback_info__: profile-collective.transform.xtags:default
  Module Products.GenericSetup.tool, line 1433, in _runImportStepsFromContext
  Module Products.GenericSetup.tool, line 1245, in _doRunImportStep
  Module, line 79, in importRegistry
  __traceback_info__: registry.xml
  Module, line 125, in importDocument
  Module, line 245, in importRecord
  __traceback_info__: record name: plone.allowed_types
  Module plone.supermodel.exportimport, line 148, in read
  Module zope.schema._bootstrapfields, line 52, in __set__
  Module zope.schema._bootstrapfields, line 183, in validate
  Module zope.schema._field, line 527, in _validate
  WrongContainedType: ([ConstraintNotSatisfied('text/x-x-tags', '')], '')

If I understand correctly, you tried to add a record with registry import, right ?
warning, registry import is not additive, when you have multiple values like
if you import another value, the prior one will be deleted.
and the imported values can be controlled by the registry, here from
<value_type type="plone.registry.field.Choice">

also you should notice from this thread that
content_type_registry/manage_predicates is the way to go.

I am not completely sure what I am 'trying to do'.
In the UI, I want to to work like this:

  1. In /@@markup settings, add a new 'type' ( text/mycodes or something )
  2. Add a new page (or similar)
  3. Choose 'text/mycodes' instead of html
  4. Paste (or upload) the text that I get from the layout program.
  5. Render this as html

yes indeed portal_transform seems your best bet

Currently, I dont have a 'real use case' for this, so I have changed my mind a little:

Anyway: I got Xpress Tags to html transform mostly working, which means one can:

  1. Export text from Quark Xpress (DTP program)
  2. Import it in Plone
  3. Render it as html
  4. Do edits in the Tagged text in Plone (with preview)
  5. Reimport the TAGS to Quark Xpress.

This could be used to let those who do not have Quark Xpress do proofing etc