{% macro github_reference(number, path) -%} {% if view.github_repository_url -%} #{{ number }} {%- else -%} #{{ number }} {%- endif %} {%- endmacro %} {#- An issue in another repository links there and is named with it, as GitHub names one. -#} {% macro issue_reference(issue) -%} {% if issue.repository -%} {{ issue.repository }}#{{ issue.number }} {%- else -%} {{ github_reference(issue.number, "issues") }} {%- endif %} {%- endmacro %} {#- An issue's state, then each fact that GitHub holds about it with the issues and pull requests that the fact names. An issue whose state is unknown shows nothing. -#} {% macro issue_state(state, facts) -%} {% if state is not none %}{{ state }}{% for fact in facts %}, {{ fact.words }}{% for issue in fact.issues %}{% if loop.first %} {% else %}, {% endif %}{{ issue_reference(issue) }}{% endfor %}{% for number in fact.pull_requests %}{% if loop.first %} {% else %}, {% endif %}PR {{ github_reference(number, "pull") }}{% endfor %}{% endfor %}{% endif %} {%- endmacro %} {#- An assignment's pull request, with where it stands when that is known. An assignment with no pull request shows nothing. One that is ready for review stands out from a draft. -#} {% macro pull_request_chip(number, summary, is_ready_for_review) -%} {% set text %}PR #{{ number }}{% if summary %} {{ summary }}{% endif %}{% endset -%} {% set class %}pr-chip{% if is_ready_for_review %} pr-chip-ready{% endif %}{% endset -%} {% if number is not none -%} {% if view.github_repository_url -%} {{ text }} {%- else -%} {{ text }} {%- endif %} {%- endif %} {%- endmacro %} {#- A card's first row: its issue and title, then what the caller gives, which is GitHub's state of what the card stands for. A work page gives its heading's tag and identifier. -#} {% macro card_heading(number, title, heading="div", heading_id=none) -%}