{% import "macros.html" as macros %}
{% set data = load_data(path="content/projects.toml") %}
<table>
    <thead>
        <tr>
            <th>Project</th>
            <th>Links</th>
            <th>Package</th>
            <th>Maintenance</th>
            <th>Issues</th>
            <th>Pull Requests</th>
            <th>Builds</th>
        </tr>
    </thead>
    <tbody>
        {% for project_name, project in data.project %}
            {% if project.lang == for_lang %}
            <tr>
                <td><code>{{ project_name }}</code></td>
                <td><a href="https://github.com/{{ project.github }}">github</a></td>
                <td>
                    {% if project.crate and project.published %}
                        {{ macros::badge(type="crates/v", scope=project.crate, desc="Rust crate", link="https://crates.io/crates/" ~ project.crate) }}
                    {% endif %}
                    {% if project.hex and project.published %}
                        {{ macros::badge(type="hexpm/v", scope=project.hex, desc="Hex package", link="https://hex.pm/packages/" ~ project.hex) }}
                    {% endif %}
                    {% if not project.published %}
                        Not published
                    {% endif %}
                </td>
                <td>
                    {{ macros::status_badge(status=project.status, color=data.status[project.status], desc="Project status", link=false) }}
                </td>
                <td>
                    {{ macros::badge(type="github/issues", scope=project.github, desc="Github issues", link="https://github.com/" ~ project.github ~ "/issues") }}
                </td>
                <td>
                    {{ macros::badge(type="github/issues-pr", scope=project.github, desc="Github PRs", link="https://github.com/" ~ project.github ~ "/pulls") }}
                </td>
                <td>
                    {% if project.ci %}
                        {{ macros::badge(type="github/workflow/status", scope=project.github ~ "/build", desc="Build status", link="https://github.com/" ~ project.github ~ "/actions?query=workflow:build") }}
                    {% else %}
                        {{ macros::status_badge(label="build", status="unknown", color="inactive", desc="Build status", link=false) }}
                    {% endif %}
                </td>
            </tr>
            {% endif %}
        {% endfor %}
    </tbody>
</table>