<?xml version="1.0"?>
<rss version="2.0" xmlns:py="http://genshi.edgewall.org/"
                   xmlns:dc="http://purl.org/dc/elements/1.1/"
                   xmlns:xi="http://www.w3.org/2001/XInclude">
  <channel>
    <title>$project.name: $title</title>
    <link>${abs_href.report(report.id)}</link>
    <description>Trac Report - $description</description>
    <language>en-us</language>
    <image py:if="chrome.logo.src_abs">
      <title>$project.name</title>
      <url>$chrome.logo.src_abs</url>
      <link>${abs_href.report(report.id if report.id != -1 else '')}</link>
    </image>
    <generator>Trac v${trac.version}</generator>

    <py:for each="row_group in [rg for (_, rg) in row_groups]">
      <item py:for="row in row_group">
        <py:for each="cell_group in row.cell_groups">
          <py:for each="cell in cell_group">
            <py:with vars="col = cell.header.col.strip('_')">
              <py:choose>
                <py:when test="col == 'reporter'">
                  <xi:include href="author_or_creator.rss" py:with="author = cell.value"/>
                </py:when>
                <py:when test="col in ('time', 'changetime', 'created', 'modified')">
                  <!-- FIXME: we end up with multiple pubDate -->
                  <pubDate py:if="cell.value != 'None'">${http_date(from_utimestamp(long(cell.value)))}</pubDate>
                </py:when>
                <py:when test="col == 'summary'">
                  <title>#$row.id: $cell.value</title>
                </py:when>
                <py:when test="col == 'description'">
                  <description>${unicode(wiki_to_html(context.child(row.resource), cell.value))}</description>
                </py:when>
              </py:choose>
            </py:with>
          </py:for>
        </py:for>
        <link py:if="row.id">${abs_url_of(row.resource)}</link>
        <guid isPermaLink="false" py:if="row.id">${abs_url_of(row.resource)}</guid>
        <category>Report</category>
      </item>
    </py:for>

  </channel>
</rss>
