1
0
mirror of https://github.com/privacyguides/privacyguides.org.git synced 2025-08-19 09:24:46 +00:00
Files
privacyguides.org/theme/partials/source-file.html

88 lines
2.6 KiB
HTML

<!--
SPDX-FileCopyrightText: 2016 Martin Donath <martin.donath@squidfunk.com>
SPDX-FileCopyrightText: 2024 Jonah Aragon <jonah@privacyguides.org>
SPDX-License-Identifier: MIT OR LicenseRef-MIT-mkdocs-material
-->
<!-- 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 loop.index0 < 2 %}{{- author.name ~ ' (' ~ author.contribution ~ ')' -}}
{%- else -%}<abbr title="{{- author.contribution -}}">{{- author.name -}}</abbr>{%- endif -%}
{%- if loop.revindex > 1 %}, {% endif -%}
{% endfor %}
</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 %}
<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 %}
</aside>
{% endif %}