Comment 1 for bug 240432

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

This TAL pattern produces "X" or "X, and Y" or "X, Y, and Z" etc:

<!-- (suppress whitespace)
  --><tal:loop repeat="item view/items"><!-- (suppress whitespace)
    --><tal:comma condition="repeat/item/index">,
      <tal:and condition="repeat/item/end"> and </tal:end>
    </tal:comma>

    Item text<!-- (suppress whitespace)
  --></tal:loop>

That's not ideal for the X/Y case if the text for X is brief and simple, because there will be a comma for that case. It does work well for more complex X though.