{# -*- engine: jinja -*- #}
{% extends "base.html" %}

{% block summary %}
<div>
  <table class="legend">
    <tr>
      <th scope="row">Directory:</th>
      <td>{{info.get_directory()}}</td>
    </tr>
    <tr>
      <th scope="row">File:</th>
      <td>{{filename}}</td>
    </tr>
    <tr>
      <th scope="row">Date:</th>
      <td>{{info.date}}</td>
    </tr>
  </table>
</div>
<div>
  <table class="coverage">
    <tr>
      <th></th>
      <th scope="col">Exec</th>
      <th scope="col">Total</th>
      <th scope="col">Coverage</th>
    </tr>
    <tr>
      <th scope="row">Lines:</th>
      <td>{{lines.exec}}</td>
      <td>{{lines.total}}</td>
      <td class="{{lines.class}}">{{lines.coverage}}%</td>
    </tr>
    <tr>
      <th scope="row">Branches:</th>
      <td>{{branches.exec}}</td>
      <td>{{branches.total}}</td>
      <td class="{{branches.class}}">{{branches.coverage}}%</td>
    </tr>
  </table>
</div>
{% endblock %}

{% block content %}
<div class="file-source">
  <table>
    <tr>
      <th align="right">Line</th>
      <th align="right">Branch</th>
      <th align="right">Exec</th>
      <th align="left">Source</th>
    </tr>

    {% for row in source_lines %}

    <tr class="source-line">
      <td class="lineno"><a id="l{{row.lineno}}" href="#l{{row.lineno}}">{{row.lineno}}</a></td>
      <td class="linebranch">
        {% if row.linebranch %}
        <details class="linebranchDetails">
        <summary class="linebranchSummary">{{row.linebranch.taken}}/{{row.linebranch.total}}</summary>
        <div class="linebranchContents">
          {% for branch in row.linebranch.branches %}
          {% if branch.taken %}
          <div class="takenBranch">&check; Branch {{branch.name}} taken {{branch.count}} times.</div>
          {% else %}
          <div class="notTakenBranch">&cross; Branch {{branch.name}} not taken.</div>
          {% endif%}
          {% endfor %}
        </div>
        </details>
        {% endif %}
      </td>
      <td class="linecount {{row.covclass}}">{% if ( row.covclass == 'uncoveredLine' ) %}&cross;{% else %}{{row.linecount}}{% endif %}</td>
      <td class="src {{row.covclass}}">{{row.source}}</td>
    </tr>
    {% endfor %}

  </table>
</div>
{% endblock %}
