The Conversion Templates

This pseudo-storyline is then passed through the templates in the cue-print/storyline-to-cue-print folder in order to produce the required output. The starting point is the cue-print/storyline-to-cue-print/ccitext.xml file, which contains the skeleton of a CUE Print text:

<cci:ccitext xmlns:cci="urn:schemas-ccieurope.com"
             xmlns:ccix="http://www.ccieurope.com/xmlns/ccimlextensions">
    ...
    <cci:head>
        ...
    </cci:head>
    <cci:head_deck>
        ...
    </cci:head_deck>
    <cci:body>
        ...
    </cci:body>
    <cci:byline>
        <cci:p>
            ...
        </cci:p>
    </cci:byline>
    <cci:quote>
        <cci:p>
            ...
        </cci:p>
        ...
    </cci:quote>
    ...
</cci:ccitext>

where the ... ellipses represent Jinja2 template code that extracts content from the pseudo-storyline and inserts it into the CUE Print text. The cci:head section of the template, for example, actually looks like this:

    <cci:head>
        {% for print_head in storyline.elements|of_type('print_head') %}
          {% for element in print_head.elements %}
            {% if element.type == 'headline' %}
        <cci:p>{{element.fields.headline.value}}</cci:p>
            {% elif element.type == 'lead_text' %}
        <cci:p>{{element.fields['lead-text'].value}}</cci:p>
            {% endif %}
          {% endfor %}
        {% endfor %}
    </cci:head>

This template code searches the pseudo-storyline's elements array looking for entries with a type property set to print_head. It then picks from this group's elements array any entries with type properties of headline or lead_text and insert their values, wrapped in cci:p elements. The storyline in this case only contains a headline, so the resulting output is:

  <cci:head>
    <cci:p>My Bullet Test</cci:p>
  </cci:head>

The body section of cue-print/storyline-to-cue-print/ccitext.xml includes references to other templates that deal with the various story element types that may appear in the body of the storyline:

    <cci:body>
        {%- for print_body in storyline.elements|of_type('print_body') %}
          {%- for element in print_body.elements|of_type('headline','lead_text','paragraph','interview', 'list_bulleted', 'list_numbered') %}
            {% include ['body/' + element.type + '.xml',
                        element.type + '.xml'] %}
          {% endfor %}
        {% endfor %}
    </cci:body>

You can therefore easily extend CUE Zipline to support new story element types by adding your own templates to the cue-print/storyline-to-cue-print/body folder, and adding a reference here. If, for example, your publications include story elements called aside, you can extend this transformation to handle them by adding a suitable aside.xml template to the cue-print/storyline-to-cue-print/body folder, and adding a corresponding reference to cue-print/storyline-to-cue-print/ccitext.xml:

          {%- for element in print_body.elements|of_type('headline','lead_text','paragraph','interview', 'list_bulleted', 'list_numbered', 'aside') %}