<?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">
  <xi:include href="macros.rss" />
  <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 != -1 and report.id or '')}</link>
    </image>
    <generator>Trac v${trac.version}</generator>

    <item py:for="row in [r for (_, row_group) in row_groups for r in row_group]">
      <py:for each="cell in [c for cell_group in row.cell_groups for c in cell_group]">
        <py:with vars="col = cell.header.col.strip('_')">
          <py:choose>
            <py:when test="col == 'reporter'">
              ${author_or_creator(cell.author, email_map)}
            </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(fromtimestamp(int(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(row.resource), cell.value))}</description>
            </py:when>
          </py:choose>
        </py:with>
      </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>

  </channel>
</rss>
