<div metal:define-macro="table"
  lang="en"
  xml:lang="en"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:metal="http://xml.zope.org/namespaces/metal"
  xmlns:tal="http://xml.zope.org/namespaces/tal"
  tal:define="
    view here;
    parameters options/parameters | nothing;
    table options/table | nothing;

    Batch nocall:modules/Products/Silva/batch/Batch;
    b_size parameters/csvbatchsize;
    b_start python: 0;
    b_start request/b_start | b_start;
    
    batch python: Batch(table, int(b_size), int(b_start), orphan=0);

    headings parameters/headings | nothing;

    table_class parameters/csvtableclass | python:'';
    even_style parameters/even_row_style | nothing;
    odd_style parameters/odd_row_style | nothing;
    "
  >
  
  <metal:block use-macro="here/macro/macros/navigation" />
  <table 
    tal:condition="table"
    tal:attributes="class string:silvatable ${table_class}" >
    <caption 
      tal:condition="parameters/show_caption | nothing"
      tal:content="python: here.get_title()" />
    
      <thead>
        <tr>
          <th tal:repeat="cell headings" tal:content="cell" />
        </tr>
      </thead>
    <tbody>
      <tal:block repeat="row batch">
        <tr tal:define="iterate repeat/row/even;"
            tal:attributes="
              class python: iterate and 'even' or 'odd';
              style python: iterate and even_style or odd_style;
            " >
          <td tal:repeat="cell row" tal:content="cell" />
        </tr>
      </tal:block>
    </tbody>
    
  </table>
</div>
