converters

CUE Zipline provides a default service for converting simple rich text-based content items to storylines. This default converter can be used by any client with access to CUE Zipline. An enrichment service, for example, can convert a rich text-based content item to a storyline by POSTing the content item to https://zipline-host/cue-print-zipline/escenic/convert/default. A rich text content item POSTed to this URL will be passed to the Jinja2 template /etc/cue/zipline/conversion-templates/classic/classic-to-storyline/storyline.json, which returns a JSON structure containing a pseudo-storyline, that can be used to construct a storyline content item (see below for more about pseudo-storylines).

In some cases, however, this simple conversion might be insufficient. The imported content items might come from different sources, and therefore be imported as different content types with different fields. In this case you would then want to define your own templates for converting the different content types. Alternatively you might want to set up a converter to convert content items in the opposite direction – storyline to classic.

The server/converters section of zipline.conf allows you to expose such specialized converters on their own URLs. For example:

server:
    converters:
        ap:
            template_dir: /etc/cue/zipline/myproject/classic_converters
            template: ap_converter.json
        ntb:
            template_dir: /etc/cue/zipline/myproject/classic_converters
            template: ntb_converter.json

For each custom converter you add an entry under server/converters. The entry name you use becomes the final segment of the converter URL. The entry name ap in the example above will be exposed as https://zipline-host/cue-print-zipline/escenic/convert/ap. Each such entry must have two child settings:

template_dir (required)

The absolute path of the folder containing the custom template.

template (required)

The name of the custom template.

Note that these transformations convert between classic content items in the form of Atom entries as returned by the Content Store web service and pseudo-storylines. A pseudo-storyline:

  • Only contains what appears in the storyline editor in CUE – it does not include any of the metadata and other fields that make up a complete content item.

  • Contains a modified version of the storyline data structure. It is easier to convert between the pseudo-storyline structure and XML formats such as NewsML, CUE Print text XML and classic CUE content items than it is to convert directly between the true storyline format and such XML formats.

These converters therefore only provide a partial conversion between classic content items and storyline content items. CUE Zipline does, however provide an API for converting between the storyline and pseudo-storyline formats.