privacyguides.org/theme/partials/source-file.html

104 lines
3.6 KiB
HTML
Raw Normal View History

<!--
Copyright (c) 2016-2024 Martin Donath <martin.donath@squidfunk.com>
Copyright (c) 2024 Jonah Aragon <jonah@triplebit.net>
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 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 %}