<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Mantra Report</title>

    <style>
        :root {
            --status-width: 250px;
        }

        body {
            display: grid;
            grid-template-areas:
                "n h b"
                "n m b"
                "f f f";
            grid-template-columns: 1fr 3fr minmax(10%, 1fr);
            grid-template-rows: 1fr auto 50px;
        }

        @media (width < 1400px) {
            body {
                grid-template-columns: 10% 3fr 10%;
            }

            nav {
                display: none;
            }
        }

        body>header {
            grid-area: h;
        }

        body>nav {
            grid-area: n;
            padding-right: 50px;
        }

        body>main {
            grid-area: m;
        }

        body>footer {
            grid-area: f;
        }

        /* from: https://christianoliff.com/blog/styling-external-links-with-an-icon-in-css/ */
        a.external-link::after {
            content: "";
            width: 11px;
            height: 11px;
            margin-left: 4px;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");
            background-position: center;
            background-repeat: no-repeat;
            background-size: contain;
            display: inline-block;
        }

        .requirement-info,
        .test-run {
            border-width: 1px;
            border-style: solid;
            border-color: lightgray;

            padding-top: 5px;
            padding-bottom: 5px;
            padding-left: 10px;
            padding-right: 10px;
        }

        .requirement-header {
            grid-template-columns: 1fr 1fr;
        }

        .test-run-header,
        .test-header {
            grid-template-columns: 80% 20%;
        }

        .requirement-header,
        .test-run-header,
        .test-header {
            display: grid;

            border-bottom-style: solid;
            border-bottom-width: 1px;
            border-bottom-color: lightgray;

            & .header-right-part {
                text-align: right;
            }
        }

        .req {
            overflow-wrap: break-word;
        }

        .requirement-status-info {
            display: grid;
            grid-template-columns: var(--status-width) auto;
            gap: 5px;
        }

        .test-name {
            overflow-wrap: break-word;
        }

        .requirement-status {
            width: var(--status-width);

            &>p {
                text-align: center;
            }

            &>table {
                width: 100%;
            }
        }

        .txt-center {
            text-align: center;
        }

        #requirements-list {
            display: grid;
            gap: 3px;
        }

        .requirement-details {
            margin-top: 20px;

            &>div {
                margin-left: 5px;
            }
        }

        .test-run-tests {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(auto, 450px));
            gap: 20px;
            justify-content: center;

            padding-bottom: 20px;
            margin-bottom: 10px;

            border-bottom-style: solid;
            border-bottom-width: 1px;
            border-bottom-color: lightgray;
        }

        .test {
            width: 100%;

            border-style: solid;
            border-width: 1px;
            border-color: lightgray;
        }

        .test>* {
            margin: 0 10px 10px 10px;
        }

        footer {
            text-align: center;
        }

        .passed,
        .traced,
        .verified,
        .all-leafs-passed,
        .all-leafs-traced {
            margin: 0;
            padding: 5px;
            background-color: green;
            color: white;
        }

        .failed,
        .untraced,
        .uncovered,
        .unverified,
        .no-leaf-traces,
        .no-leaf-passed {
            margin: 0;
            padding: 5px;
            background-color: red;
            color: white;
        }

        .skipped,
        .leaf-passed,
        .leaf-traces {
            margin: 0;
            padding: 5px;
            background-color: orange;
            color: white;
        }

        .requirement-status td {
            width: 50%;
        }

        .criteria-content {
            white-space: pre-wrap;
        }
    </style>
</head>

<body>
    {% macro break_id(id) %}
    {% for id_part in id | split(pat=".") %}
    {%- if loop.index > 1 %}.<wbr>{% endif -%}{{- id_part -}}
        {% endfor %}
    {% endmacro break_id %}

    <nav>
        <h3>Content</h3>
        <ul>
            <li>
                <a href="#criteria">Criteria</a>
            </li>
            <li>
                <a href="#requirements">Requirements</a>
                {% if requirements | length > 0 %}
                <ul>
                    {% for req in requirements %}
                    <li><a href="#{{ req.id }}">{{ req.id }}</a>{% if req.manual %} (manual{% if not req.valid %}, <span
                            class="invalid">invalid</span>{% endif %})
                        {% elif req.deprecated %} (deprecated{% if not req.valid %}, <span
                            class="invalid">invalid</span>{% endif %})
                        {% elif not req.valid %} <span class="invalid">(invalid)</span>
                        {% endif %}</li>
                    {% endfor %}
                </ul>
                {% endif %}
            </li>
            <li>
                <a href="#tests">Tests</a>
                {% if tests.test_runs | length > 0 %}
                <ul>
                    {% for test_run in tests.test_runs %}
                    <li>
                        <a href="#{{ test_run.name }}|{{ test_run.date }}" class="nav-test-run-link">
                            <span class="test-run-name">{{ test_run.name }}</span>
                            <span class="test-run-date">{{ test_run.date | date(format="%Y-%m-%d %H:%M:%S",
                                timezone="Europe/Berlin") }}</span>
                        </a>
                        {% if test_run.tests | length > 0 %}
                        <ul>
                            {% for test in test_run.tests %}
                            <li>
                                <a href="#{{ test_run.name }}|{{ test_run.date }}|{{ test.name }}" class="test-name">
                                    {{ test.name }}
                                </a>
                            </li>
                            {% endfor %}
                        </ul>
                        {% endif %}
                    </li>
                    {% endfor %}
                </ul>
                {% endif %}
            </li>
            <li>
                <a href="#reviews">Reviews</a>
                {% if reviews | length > 0 %}
                <ul>
                    {% for review in reviews %}
                    <li>
                        <a href="#{{ review.name }}|{{ review.date }}" class="review-link">
                            <span class="review-name">{{ review.name }}</span>
                            <span class="review-date">{{ review.date }}</span>
                        </a>
                    </li>
                    {% endfor %}
                </ul>
                {% endif %}
            </li>
        </ul>
    </nav>

    <header>
        <h1>Mantra Report for
            <a class="external-link" {% if project.repository %}href="{{ project.repository }}" {% endif %}>
                {%if project.name %}{{ project.name }}{% else %}unknown{% endif %}
                {%if project.version %}v{{ project.version }}{% endif %}</a>
        </h1>

        {% if tag.name %}
        <p><strong>Tag:</strong> {%if tag.link %}<a href="{{ tag.link }}">{{ tag.name }}</a>{% else %}{{ tag.name }}{%
            endif %}</p>
        {% endif %}

        <section id="criteria">
            <p><strong>This report was generated by <em>mantra</em> with the following criteria:</strong></p>
            <ul>
                <li>
                    <p><strong>Tracing</strong></p>
                    <p class="criteria-content">{{ trace_criteria }}</p>
                </li>
                <li>
                    <p><strong>Test Coverage</strong></p>
                    <p class="criteria-content">{{ test_coverage_criteria }}</p>
                </li>
                <li>
                    <p><strong>Validation</strong></p>
                    <p class="criteria-content">{{ validation.criteria }}</p>
                </li>
            </ul>
        </section>
    </header>

    <main>
        <section id="requirements">
            <h2>Requirements</h2>
            {%if not validation.is_valid %}
            <div id="invalid-requirements">
                <p>This report has {{ validation.invalid_reqs | length }} <strong>invalid</strong> requirement{% if
                    validation.invalid_reqs | length != 1 %}s{% endif %}:</p>
                <ul>
                    {% for invalid_req in validation.invalid_reqs %}
                    <li><a class="req" href="#{{ invalid_req }}">
                            {{ self::break_id(id=invalid_req) }}</a></li>
                    {% endfor %}
                </ul>
            </div>
            {% endif %}

            {% if unrelated.traces | length > 0 %}
            <p>{{ unrelated.traces | length }} unrelated traces.</p>
            {% endif %}
            {% if unrelated.coverage | length > 0 %}
            <p>{{ unrelated.coverage | length }} unrelated coverage.</p>
            {% endif %}
            {% if unrelated.verified_requirements | length > 0 %}
            <p>{{ unrelated.verified_requirements | length }} unrelated requirement review entries.</p>
            {% endif %}

            <h3>Overview</h3>
            <ul>
                <li>
                    <p><strong>Existing requirements:</strong> {{ overview.req_cnt }}</p>
                </li>
                <li>
                    <p><strong>Traced requirements:</strong> {{ overview.traced_cnt }} ({{ overview.traced_ratio * 100 |
                        round(precision = 2) }}%)</p>
                </li>
                <li>
                    <p><strong>Covered requirements:</strong> {{ overview.covered_cnt }} ({{ overview.covered_ratio *
                        100 | round(precision = 2) }}%)</p>
                </li>
                <li>
                    <p><strong>Passed requirements:</strong> {{ overview.passed_cnt }} ({{ overview.passed_ratio * 100 |
                        round(precision = 2) }}%)</p>
                </li>
                <li>
                    <p><strong>Manual requirements verified:</strong>
                        {% if overview.verified_cnt %}
                        {{ overview.verified_cnt }} ({{ overview.verified_ratio * 100 | round(precision = 2) }}%)
                        {% else %}
                        -
                        {% endif %}
                    </p>
                </li>
            </ul>

            <h3>Status</h3>
            <table class="requirements-table">
                <tr>
                    <th>ID</th>
                    <th>Tracing</th>
                    <th>Coverage</th>
                    <th>Manual</th>
                </tr>
                {% for req in requirements %}
                <tr>
                    <td>
                        <a href="#{{ req.id }}">{{ self::break_id(id=req.id) }}</a>
                        {% if req.manual %} (manual{% if not req.valid %}, <span class="invalid">invalid</span>{% endif
                        %})
                        {% elif req.deprecated %} (deprecated{% if not req.valid %}, <span
                            class="invalid">invalid</span>{% endif %})
                        {% elif not req.valid %} <span class="invalid">(invalid)</span>
                        {% endif %}
                    </td>
                    <td class="txt-center">
                        {% if req.trace_info.traced %}
                        <div class="traced">traced</div>
                        {% elif req.manual %}
                        <div>-</div>
                        {% else %}
                        <div class="untraced">untraced</div>
                        {% endif %}
                    </td>
                    <td class="txt-center">
                        {% if req.test_coverage_info.passed %}
                        <div class="passed">passed</div>
                        {% elif req.test_coverage_info.covered %}
                        <div class="failed">failed</div>
                        {% elif req.manual %}
                        <div>-</div>
                        {% else %}
                        <div class="uncovered">uncovered</div>
                        {% endif %}
                    </td>
                    <td class="txt-center">
                        {% if req.verified_info | length > 0 %}
                        <div class="verified">verified</div>
                        {% elif not req.manual %}
                        <div>-</div>
                        {% else %}
                        <div class="unverified">unverified</div>
                        {% endif %}
                    </td>
                </tr>
                {% endfor %}
            </table>

            <h3>Details</h3>
            <div id="requirements-list">
                {% for req in requirements %}
                <div id="{{ req.id }}" class="requirement-info">
                    <div class="requirement-header">
                        <h3 class="req">
                            {{ self::break_id(id=req.id) }}
                            {% if req.manual %} (manual{% if not req.valid %}, <span class="invalid">invalid</span>{%
                            endif %})
                            {% elif req.deprecated %} (deprecated{% if not req.valid %}, <span
                                class="invalid">invalid</span>{% endif %})
                            {% elif not req.valid %} <span class="invalid">(invalid)</span>
                            {% endif %}
                        </h3>
                        <p class="header-right-part"><strong>Parent:</strong> {% if req.parents %}
                            {% for parent in req.parents %}
                            <a class="req" href="#{{ parent }}">
                                {{ self::break_id(id=parent) }}
                            </a>
                            {% endfor %}
                            {% else %}none{% endif %}
                        </p>
                    </div>

                    <div class="requirement-status-info">
                        <div class="requirement-status">
                            {% if req.manual and not req.trace_info.traced %}
                            <p><strong>Status (manual)</strong></p>
                            <table>
                                <tr>
                                    <td class="txt-center">
                                        {% if req.verified_info | length > 0 %}
                                        <div class="verified">verified</div>
                                        {% else %}
                                        <div class="unverified">unverified</div>
                                        {% endif %}
                                    </td>
                                </tr>
                            </table>
                            {% else %}
                            <p><strong>Status</strong></p>
                            <table>
                                <tr>
                                    <td class="txt-center">
                                        {% if req.trace_info.traced %}
                                        <div class="traced">traced</div>
                                        {% elif req.manual %}
                                        <div>-</div>
                                        {% else %}
                                        <div class="untraced">untraced</div>
                                        {% endif %}
                                    </td>
                                    <td class="txt-center">
                                        {% if req.test_coverage_info.passed %}
                                        <div class="passed">passed</div>
                                        {% elif req.test_coverage_info.covered %}
                                        <div class="failed">failed</div>
                                        {% elif req.manual %}
                                        <div>-</div>
                                        {% else %}
                                        <div class="uncovered">uncovered</div>
                                        {% endif %}
                                    </td>
                                </tr>

                                {% if req.verified_info | length > 0 %}
                                <tr>
                                    <td class="verified txt-center">verified</td>
                                    <td></td>
                                </tr>
                                {% elif req.manual %}
                                <tr>
                                    <td class="unverified txt-center">unverified</td>
                                    <td></td>
                                </tr>
                                {% endif %}
                            </table>
                            {% endif %}
                        </div>

                        <div class="requirement-custom-info">
                            <p><strong>{{ req.title }}</strong></p>
                            <a class="external-link" href="{{ req.origin }}">{{ req.origin }}</a>
                            {% if req.rendered_data %}
                            <div class="rendered-data">
                                {{ req.rendered_data | safe }}
                            </div>
                            {% endif %}
                        </div>

                    </div>

                    <details class="requirement-details">
                        <summary>Details</summary>
                        <div class="requirement-details-content">

                            <div class="requirement-children">
                                <p class="requirement-details-header"><strong>Direct Children ({{ req.direct_children |
                                        length }})</strong></p>
                                {% if req.direct_children | length > 0 %}
                                <ul>
                                    {% for child_id in req.direct_children %}
                                    <li><a class="req" href="#{{ child_id }}">{{ self::break_id(id=child_id) }}</a></li>
                                    {% endfor %}
                                </ul>
                                {% endif %}
                            </div>

                            <div class="requirement-direct-traces">
                                <p class="requirement-details-header"><strong>Direct Traces ({{
                                        req.trace_info.direct_traces | length }})</strong></p>
                                {% if req.trace_info.direct_traces | length > 0 %}
                                <table class="file-location">
                                    <tr>
                                        <th>name</th>
                                        <th class="filepath">file</th>
                                        <th class="line">line</th>
                                    </tr>
                                    {% for trace in req.trace_info.direct_traces %}
                                    <tr>
                                        <td>{% if trace.item_name %}{{ trace.item_name }}{% else %}-{% endif %}</td>
                                        <td id="{{ req.id }}|{{ trace.filepath }}|{{ trace.line }}" class="filepath">{{
                                            trace.filepath }}</td>
                                        <td class="line">{{ trace.line }}</td>
                                    </tr>
                                    {% endfor %}
                                </table>
                                {% endif %}
                            </div>

                            <div class="requirement-indirect-traces">
                                <p class="requirement-details-header"><strong>Indirect Traces ({{
                                        req.trace_info.indirect_traces | length }})</strong></p>
                                {% if req.trace_info.indirect_traces | length > 0 %}
                                <ul>
                                    {% for indirect_trace in req.trace_info.indirect_traces %}
                                    <li>
                                        <p>Traced ID: <a class="req" href="#{{ indirect_trace.traced_id }}">{{
                                                self::break_id(id=indirect_trace.traced_id) }}</a></p>
                                        <table class="file-location">
                                            <tr>
                                                <th class="filepath">file</th>
                                                <th class="line">line</th>
                                            </tr>
                                            {% for trace in indirect_trace.traces %}
                                            <tr>
                                                <td id="{{ indirect_trace.traced_id }}|{{ trace.filepath }}|{{ trace.line }}"
                                                    class="filepath">{{ trace.filepath }}</td>
                                                <td class="line">{{ trace.line }}</td>
                                            </tr>
                                            {% endfor %}
                                        </table>
                                    </li>
                                    {% endfor %}
                                </ul>
                                {% endif %}
                            </div>

                            <div class="requirement-direct-coverage">
                                <p class="requirement-details-header"><strong>Direct Coverage ({{
                                        req.test_coverage_info.direct_coverage | length }})</strong></p>
                                {% if req.test_coverage_info.direct_coverage | length > 0 %}
                                <ul>
                                    {% for test_run in req.test_coverage_info.direct_coverage %}
                                    <li>
                                        <p><a class="test-run-name" href="#{{ test_run.name }}|{{ test_run.date }}">
                                                &lrm;{{ test_run.name }}
                                            </a><br>
                                            <span class="test-run-date">{{ test_run.date | date(format="%Y-%m-%d
                                                %H:%M:%S", timezone="Europe/Berlin") }}</span>
                                        </p>

                                        <ul>
                                            {% for test in test_run.tests %}
                                            <li>
                                                <p>
                                                    {% if test.passed %}<span class="passed">passed</span>{% else
                                                    %}<span class="failed">failed</span>{% endif %}
                                                    <a class="test-name"
                                                        href="#{{ test_run.name }}|{{ test_run.date }}|{{ test.name }}">
                                                        &lrm;{{ test.name }}
                                                    </a>
                                                </p>
                                                <table class="file-location">
                                                    <tr>
                                                        <th class="filepath">file</th>
                                                        <th class="line">line</th>
                                                    </tr>
                                                    {% for trace in test.traces %}
                                                    <tr>
                                                        <td id="{{ req.id }}|{{ trace.filepath }}|{{ trace.line }}"
                                                            class="filepath">&lrm;{{ trace.filepath }}</td>
                                                        <td class="line">{{ trace.line }}</td>
                                                    </tr>
                                                    {% endfor %}
                                                </table>
                                            </li>
                                            {% endfor %}
                                        </ul>
                                    </li>
                                    {% endfor %}
                                </ul>
                                {% endif %}
                            </div>

                            <div class="requirement-indirect-coverage">
                                <p class="requirement-details-header"><strong>Indirect Coverage ({{
                                        req.test_coverage_info.indirect_coverage | length }})</strong></p>
                                {% if req.test_coverage_info.indirect_coverage | length > 0 %}
                                <ul>
                                    {% for coverage in req.test_coverage_info.indirect_coverage %}
                                    <li>
                                        <p>Covered ID: <a class="req" href="#{{ coverage.covered_id }}">{{
                                                self::break_id(id=coverage.covered_id) }}</a></p>
                                        <ul>
                                            {% for test_run in coverage.test_runs %}
                                            <li>
                                                <p><a class="test-run-name"
                                                        href="#{{ test_run.name }}|{{ test_run.date }}">
                                                        &lrm;{{ test_run.name }}
                                                    </a><br>
                                                    <span class="test-run-date">{{ test_run.date | date(format="%Y-%m-%d
                                                        %H:%M:%S", timezone="Europe/Berlin") }}</span>
                                                </p>
                                                <ul>
                                                    {% for test in test_run.tests %}
                                                    <li>
                                                        <p>
                                                            {% if test.passed %}<span class="passed">passed</span>{%
                                                            else %}<span class="failed">failed</span>{% endif %}
                                                            <a class="test-name"
                                                                href="#{{ test_run.name }}|{{ test_run.date }}|{{ test.name }}">
                                                                &lrm;{{ test.name }}
                                                            </a>
                                                        </p>

                                                        <table class="file-location">
                                                            <tr>
                                                                <th class="filepath">file</th>
                                                                <th class="line">line</th>
                                                            </tr>
                                                            {% for trace in test.traces %}
                                                            <tr>
                                                                <td id="{{ coverage.covered_id }}|{{ trace.filepath }}|{{ trace.line }}"
                                                                    class="filepath">&lrm;{{ trace.filepath }}</td>
                                                                <td class="line">{{ trace.line }}</td>
                                                            </tr>
                                                            {% endfor %}
                                                        </table>
                                                    </li>
                                                    {% endfor %}
                                                </ul>
                                            </li>
                                            {% endfor %}
                                        </ul>
                                    </li>
                                    {% endfor %}
                                </ul>
                                {% endif %}
                            </div>

                            <div class="requirement-reviewed">
                                <p class="requirement-details-header"><strong>Verified in Reviews ({{ req.verified_info
                                        | length }})</strong></p>
                                {% if req.verified_info | length > 0 %}
                                <table>
                                    <tr>
                                        <th class="review-name">review-name</th>
                                        <th class="review-date">review-date</th>
                                        <th class="comment">comment</th>
                                    </tr>
                                    {% for info in req.verified_info %}
                                    <tr>
                                        <td class="review-name"><a
                                                href="#{{ info.review_name }}|{{ info.review_date }}">
                                                {{ info.review_name }}
                                            </a></td>
                                        <td class="review-date">{{ info.review_date }}</td>
                                        <td class="comment">{{ info.comment }}</td>
                                    </tr>
                                    {% endfor %}
                                </table>
                                {% endif %}
                            </div>
                        </div>
                    </details>
                </div>
                {% endfor %}
            </div>
        </section>
        <section id="tests">
            <h2>Tests</h2>
            <h3>Overview</h3>
            <ul>
                <li>
                    <p><strong>Existing tests:</strong> {{ tests.overview.test_cnt }}</p>
                </li>
                <li>
                    <p><strong>Run tests:</strong> {{ tests.overview.ran_cnt }} ({{ tests.overview.ran_ratio * 100 |
                        round(precision = 2) }}%)</p>
                </li>
                <li>
                    <p><strong>Passed tests:</strong> {{ tests.overview.passed_cnt }} ({{ tests.overview.passed_ratio *
                        100 | round(precision = 2) }}%)</p>
                </li>
                <li>
                    <p><strong>Failed tests:</strong> {{ tests.overview.failed_cnt }} ({{ tests.overview.failed_ratio *
                        100 | round(precision = 2) }}%)</p>
                </li>
                <li>
                    <p><strong>Skipped tests:</strong> {{ tests.overview.skipped_cnt }} ({{ tests.overview.skipped_ratio
                        * 100 | round(precision = 2) }}%)</p>
                </li>
            </ul>

            <div class="test-runs">
                {% for test_run in tests.test_runs %}
                <div id="{{ test_run.name }}|{{ test_run.date }}" class="test-run">
                    <div class="test-run-header">
                        <h3>
                            <span class="test-run-name">
                                &lrm;{{ test_run.name }}
                            </span><br>
                            <span>
                                {{ test_run.date | date(format="%Y-%m-%d %H:%M:%S", timezone="Europe/Berlin") }}
                            </span>
                        </h3>
                        <p class="header-right-part">
                            {% if test_run.overview.failed_cnt > 0 or test_run.overview.ran_cnt !=
                            test_run.overview.test_cnt %}
                            <span class="failed">failed</span>
                            {% elif test_run.overview.skipped_cnt == test_run.overview.test_cnt %}
                            <span class="skipped">skipped</span>
                            {% elif test_run.overview.passed_cnt == test_run.overview.test_cnt %}
                            <span class="passed">passed</span>
                            {% else %}
                            <span class="partial-passed">partial-passed</span>
                            {% endif %}
                        </p>
                    </div>
                    <div class="test-run-overview">
                        <p><strong>Overview</strong></p>
                        <ul>
                            <li>
                                <p><strong>Existing Tests:</strong> {{ test_run.overview.test_cnt }}</p>
                            </li>
                            <li>
                                <p><strong>Run tests:</strong> {{ test_run.overview.ran_cnt }} ({{
                                    test_run.overview.ran_ratio * 100 | round(precision = 2) }}%)</p>
                            </li>
                            <li>
                                <p><strong>Passed tests:</strong> {{ test_run.overview.passed_cnt }} ({{
                                    test_run.overview.passed_ratio * 100 | round(precision = 2) }}%)</p>
                            </li>
                            <li>
                                <p><strong>Failed tests:</strong> {{ test_run.overview.failed_cnt }} ({{
                                    test_run.overview.failed_ratio * 100 | round(precision = 2) }}%)</p>
                            </li>
                            <li>
                                <p><strong>Skipped tests:</strong> {{ test_run.overview.skipped_cnt }} ({{
                                    test_run.overview.skipped_ratio * 100 | round(precision = 2) }}%)</p>
                            </li>
                        </ul>
                    </div>

                    {% if test_run.rendered_data %}
                    <div class="test-run-data">
                        {{ test_run.rendered_data | safe }}
                    </div>
                    {% endif %}

                    <p><strong>Tests</strong></p>
                    <div class="test-run-tests">
                        {% for test in test_run.tests %}
                        <div id="{{ test_run.name }}|{{ test_run.date }}|{{ test.name }}" class="test">
                            <div class="test-header">
                                <p><strong class="test-name">&lrm;{{ test.name }}</strong></p>
                                <p class="header-right-part">
                                    {% if test.state == 'passed'%}
                                    <span class="passed">passed</span>
                                    {% elif 'skipped' in test.state %}
                                    <span class="skipped">skipped</span>
                                    {% else %}
                                    <span class="failed">failed</span>
                                    {% endif %}
                                </p>
                            </div>

                            <div class="test-body">
                                <p>
                                    <strong>File:</strong> <span class="filepath">{{ test.filepath }}</span><br>
                                    <strong>Line:</strong> <span class="line">{{ test.line }}</span>
                                </p>

                                <details class="test-covers">
                                    <summary>
                                        <strong>Covers {{ test.covers | length }} requirement{% if test.covers | length
                                            != 1 %}s{% endif %}</strong>
                                    </summary>
                                    <ul>
                                        {% for id in test.covers %}
                                        <li><a class="req" href="#{{ id }}">{{ self::break_id(id=id) }}</a></li>
                                        {% endfor %}
                                    </ul>
                                </details>
                            </div>
                        </div>
                        {% endfor %}
                    </div>

                    <details class="test-run-logs">
                        <summary><strong>Logs during test run...</strong></summary>
                        <p>{{ test_run.logs }}</p>
                    </details>
                </div>
                {% endfor %}
            </div>

        </section>
        <section id="reviews">
            <h2>Reviews ({{ reviews | length }})</h2>
            {% for review in reviews %}
            <div id="{{ review.name }}|{{ review.date }}" class="review">
                <div class="review-header">
                    <p class="review-name">{{ review.name }}</p>
                    <p class="review-date">{{ review.date }}</p>
                </div>
                <div class="review-content">
                    <div class="review-reviewer">
                        <p><strong>Reviewer:</strong> {{ review.reviewer }}</p>
                    </div>
                    <div class="review-comment">
                        <p>{{ review.comment }}</p>
                    </div>
                    <div class="review-requirements">
                        <p><strong>Verified Requirements ({{ review.requirements | length }})</strong></p>
                        {% if review.requirements | length > 0 %}
                        <ul>
                            {% for req in review.requirements %}
                            <li class="verified-requirement">
                                <p><a class="req" href="#{{req.id}}">{{ self::break_id(id=req.id) }}</a></p>
                                <p class="verified-requirement-comment">{{ req.comment }}</p>
                            </li>
                            {% endfor %}
                        </ul>
                        {% endif %}
                    </div>
                </div>
            </div>
            {% endfor %}
        </section>
    </main>

    <footer>
        Report generated at {{ creation_date | date(format="%Y-%m-%d %H:%M:%S", timezone="Europe/Berlin") }}
    </footer>
</body>

</html>