123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <!--
- Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to
- deal in the Software without restriction, including without limitation the
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- sell copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- IN THE SOFTWARE.
- -->
- <!-- Render date of last update -->
- {% macro render_updated(date) %}
- <span class="md-source-file__fact">
- <span class="md-icon" title="{{ lang.t('source.file.date.updated') }}">
- {% include ".icons/material/clock-edit-outline.svg" %}
- </span>
- {{ date }}
- </span>
- {% endmacro %}
- <!-- Render date of creation -->
- {% macro render_created(date) %}
- <span class="md-source-file__fact">
- <span class="md-icon" title="{{ lang.t('source.file.date.created') }}">
- {% include ".icons/material/clock-plus-outline.svg" %}
- </span>
- {{ date }}
- </span>
- {% endmacro %}
- <!-- ---------------------------------------------------------------------- -->
- <!-- Render authors -->
- {% macro render_authors(authors) %}
- {% set git_authors = config.plugins.get("git-authors") %}
- <span class="md-source-file__fact">
- <span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
- {% if authors | length == 1 %}
- {% include ".icons/material/account.svg" %}
- {% else %}
- {% include ".icons/material/account-group.svg" %}
- {% endif %}
- </span>
- <nav>
- {% for author in authors %}
- {%- if git_authors.config.show_email_address %}
- <a href="mailto:{{ author.email }}">
- {{- author.name -}}
- </a>
- {%- else -%}
- {{- author.name -}}
- {% endif -%}
- {%- if loop.revindex > 1 %}, {% endif -%}
- {% endfor %}
- </nav>
- </span>
- {% endmacro %}
- <!-- ---------------------------------------------------------------------- -->
- <!-- Render committers from GitHub -->
- {% macro render_committers_github(title) %}
- <span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
- {% include ".icons/material/github.svg" %}
- </span>
- <span>{{ title }}</span>
- {% endmacro %}
- <!-- Render committers from GitLab -->
- {% macro render_committers_gitlab(title) %}
- <span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
- {% include ".icons/material/gitlab.svg" %}
- </span>
- <span>{{ title }}</span>
- {% endmacro %}
- <!-- Render committers -->
- {% macro render_committers(authors) %}
- <span class="md-source-file__fact">
- {% if committers_source == "gitlab" %}
- {{ render_committers_gitlab("GitLab") }}
- {% else %}
- {{ render_committers_github("GitHub") }}
- {% endif %}
- <nav>
- {% for author in authors[:4] %}
- <a
- href="{{ author.url }}"
- class="md-author"
- title="@{{ author.login }}"
- >
- {% set separator = "&" if "?" in author.avatar else "?" %}
- <img
- src="{{ author.avatar }}{{ separator }}size=72"
- alt="{{ author.name or 'GitHub user' }}"
- />
- </a>
- {% endfor %}
- <!-- More authors -->
- {% set more = authors[4:] | length %}
- {% if more > 0 %}
- {% if page.edit_url %}
- <a
- href="{{ page.edit_url | replace('edit', 'blob') }}"
- class="md-author md-author--more"
- >
- +{{ more }}
- </a>
- {% else %}
- <span class="md-author md-author--more">
- +{{ more }}
- </span>
- {% endif %}
- {% endif %}
- </nav>
- </span>
- {% endmacro %}
- <!-- ---------------------------------------------------------------------- -->
- <!-- Determine date of last update -->
- {% if page.meta %}
- {% if page.meta.git_revision_date_localized %}
- {% set updated = page.meta.git_revision_date_localized %}
- {% elif page.meta.revision_date %}
- {% set updated = page.meta.revision_date %}
- {% endif %}
- <!-- Determine date of creation -->
- {% if page.meta.git_creation_date_localized %}
- {% set created = page.meta.git_creation_date_localized %}
- {% endif %}
- {% endif %}
- <!-- Source file information -->
- {% if updated or created or git_info or committers %}
- <aside class="md-source-file">
- <!-- Date of last update -->
- {% if updated %}
- {{ render_updated(updated) }}
- {% endif %}
- <!-- Date of creation -->
- {% if created %}
- {{ render_created(created) }}
- {% endif %}
- <!-- Authors (git-authors plugin) -->
- {% if git_info %}
- {{ render_authors(git_info.get("page_authors")) }}
- {% endif %}
- <!-- Authors (git-committers plugin) -->
- {% if committers %}
- {{ render_committers(committers) }}
- {% endif %}
- </aside>
- {% endif %}
|