Merge latests changes from Insiders

This commit is contained in:
squidfunk 2023-12-07 11:46:44 +01:00
parent f855a67384
commit aa62bcc4f6
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
6 changed files with 194 additions and 154 deletions

View File

@ -477,19 +477,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
# Validate authors and throw if errors occurred # Validate authors and throw if errors occurred
errors, warnings = config.validate() errors, warnings = config.validate()
if not config.authors and warnings:
log.warning(
f"Action required: the format of the authors file changed.\n"
f"All authors must now be located under the 'authors' key.\n"
f"Please adjust '{file}' to match:\n"
f"\n"
f"authors:\n"
f" squidfunk:\n"
f" avatar: https://avatars.githubusercontent.com/u/932156\n"
f" description: Creator\n"
f" name: Martin Donath\n"
f"\n"
)
for _, w in warnings: for _, w in warnings:
log.warning(w) log.warning(w)
for _, e in errors: for _, e in errors:

View File

@ -53,8 +53,8 @@ class GroupPlugin(BasePlugin[GroupConfig]):
# little hacky, but has huge potential making plugin configuration easier. # little hacky, but has huge potential making plugin configuration easier.
# There's one little caveat: the `__init__` and `on_startup` methods of the # There's one little caveat: the `__init__` and `on_startup` methods of the
# plugins that are part of the group are called after all other plugins, so # plugins that are part of the group are called after all other plugins, so
# the `event_priority` decorator for `on_startup` events and is effectively # the `event_priority` decorator for `on_startup` methods is effectively
# useless. However, the `on_startup` event is only intended to set up the # useless. However, the `on_startup` method is only intended to set up the
# plugin and doesn't receive anything else than the invoked command and # plugin and doesn't receive anything else than the invoked command and
# whether we're running a dirty build, so there should be no problems. # whether we're running a dirty build, so there should be no problems.
@event_priority(150) @event_priority(150)

View File

@ -1,36 +1,23 @@
{#- {#-
This file was automatically generated - do not edit This file was automatically generated - do not edit
-#} -#}
{% if page.meta %} {% macro render_updated(date) %}
{% 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 %}
{% if page.meta.git_creation_date_localized %}
{% set created = page.meta.git_creation_date_localized %}
{% endif %}
{% endif %}
{% if updated or created or git_info or committers %}
<aside class="md-source-file">
{% if updated %}
<span class="md-source-file__fact"> <span class="md-source-file__fact">
<span class="md-icon" title="{{ lang.t('source.file.date.updated') }}"> <span class="md-icon" title="{{ lang.t('source.file.date.updated') }}">
{% include ".icons/material/clock-edit-outline.svg" %} {% include ".icons/material/clock-edit-outline.svg" %}
</span> </span>
{{ updated }} {{ date }}
</span> </span>
{% endif %} {% endmacro %}
{% if created %} {% macro render_created(date) %}
<span class="md-source-file__fact"> <span class="md-source-file__fact">
<span class="md-icon" title="{{ lang.t('source.file.date.created') }}"> <span class="md-icon" title="{{ lang.t('source.file.date.created') }}">
{% include ".icons/material/clock-plus-outline.svg" %} {% include ".icons/material/clock-plus-outline.svg" %}
</span> </span>
{{ created }} {{ date }}
</span> </span>
{% endif %} {% endmacro %}
{% if git_info %} {% macro render_authors(authors) %}
{% set authors = git_info.get("page_authors") %}
<span class="md-source-file__fact"> <span class="md-source-file__fact">
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}"> <span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
{% if authors | length == 1 %} {% if authors | length == 1 %}
@ -48,21 +35,34 @@
{% endfor %} {% endfor %}
</nav> </nav>
</span> </span>
{% endif %} {% endmacro %}
{% if committers %} {% macro render_committers_github(title) %}
<span class="md-source-file__fact">
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}"> <span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
{% include ".icons/material/github.svg" %} {% include ".icons/material/github.svg" %}
</span> </span>
<span>GitHub</span> <span>{{ title }}</span>
{% endmacro %}
{% 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 %}
{% 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> <nav>
{% for author in committers[:4] %} {% for author in authors[:4] %}
<a href="{{ author.url }}" class="md-author" title="@{{ author.login }}"> <a href="{{ author.url }}" class="md-author" title="@{{ author.login }}">
{% set separator = "&" if "?" in author.avatar else "?" %} {% set separator = "&" if "?" in author.avatar else "?" %}
<img src="{{ author.avatar }}{{ separator }}size=72" alt="{{ author.name or 'GitHub user' }}"> <img src="{{ author.avatar }}{{ separator }}size=72" alt="{{ author.name or 'GitHub user' }}">
</a> </a>
{% endfor %} {% endfor %}
{% set more = committers[4:] | length %} {% set more = authors[4:] | length %}
{% if more > 0 %} {% if more > 0 %}
{% if page.edit_url %} {% if page.edit_url %}
<a href="{{ page.edit_url | replace('edit', 'blob') }}" class="md-author md-author--more"> <a href="{{ page.edit_url | replace('edit', 'blob') }}" class="md-author md-author--more">
@ -76,6 +76,30 @@
{% endif %} {% endif %}
</nav> </nav>
</span> </span>
{% endmacro %}
{% 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 %}
{% if page.meta.git_creation_date_localized %}
{% set created = page.meta.git_creation_date_localized %}
{% endif %}
{% endif %}
{% if updated or created or git_info or committers %}
<aside class="md-source-file">
{% if updated %}
{{ render_updated(updated) }}
{% endif %}
{% if created %}
{{ render_created(created) }}
{% endif %}
{% if git_info %}
{{ render_authors(git_info.get("page_authors")) }}
{% endif %}
{% if committers %}
{{ render_committers(committers) }}
{% endif %} {% endif %}
</aside> </aside>
{% endif %} {% endif %}

View File

@ -477,19 +477,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
# Validate authors and throw if errors occurred # Validate authors and throw if errors occurred
errors, warnings = config.validate() errors, warnings = config.validate()
if not config.authors and warnings:
log.warning(
f"Action required: the format of the authors file changed.\n"
f"All authors must now be located under the 'authors' key.\n"
f"Please adjust '{file}' to match:\n"
f"\n"
f"authors:\n"
f" squidfunk:\n"
f" avatar: https://avatars.githubusercontent.com/u/932156\n"
f" description: Creator\n"
f" name: Martin Donath\n"
f"\n"
)
for _, w in warnings: for _, w in warnings:
log.warning(w) log.warning(w)
for _, e in errors: for _, e in errors:

View File

@ -53,8 +53,8 @@ class GroupPlugin(BasePlugin[GroupConfig]):
# little hacky, but has huge potential making plugin configuration easier. # little hacky, but has huge potential making plugin configuration easier.
# There's one little caveat: the `__init__` and `on_startup` methods of the # There's one little caveat: the `__init__` and `on_startup` methods of the
# plugins that are part of the group are called after all other plugins, so # plugins that are part of the group are called after all other plugins, so
# the `event_priority` decorator for `on_startup` events and is effectively # the `event_priority` decorator for `on_startup` methods is effectively
# useless. However, the `on_startup` event is only intended to set up the # useless. However, the `on_startup` method is only intended to set up the
# plugin and doesn't receive anything else than the invoked command and # plugin and doesn't receive anything else than the invoked command and
# whether we're running a dirty build, so there should be no problems. # whether we're running a dirty build, so there should be no problems.
@event_priority(150) @event_priority(150)

View File

@ -20,6 +20,112 @@
IN THE SOFTWARE. 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) %}
<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 %}
<a href="mailto:{{ author.email }}">
{{- author.name -}}
</a>
{%- 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 --> <!-- Determine date of last update -->
{% if page.meta %} {% if page.meta %}
{% if page.meta.git_revision_date_localized %} {% if page.meta.git_revision_date_localized %}
@ -40,86 +146,22 @@
<!-- Date of last update --> <!-- Date of last update -->
{% if updated %} {% if updated %}
<span class="md-source-file__fact"> {{ render_updated(updated) }}
<span class="md-icon" title="{{ lang.t('source.file.date.updated') }}">
{% include ".icons/material/clock-edit-outline.svg" %}
</span>
{{ updated }}
</span>
{% endif %} {% endif %}
<!-- Date of creation --> <!-- Date of creation -->
{% if created %} {% if created %}
<span class="md-source-file__fact"> {{ render_created(created) }}
<span class="md-icon" title="{{ lang.t('source.file.date.created') }}">
{% include ".icons/material/clock-plus-outline.svg" %}
</span>
{{ created }}
</span>
{% endif %} {% endif %}
<!-- Authors (git-authors plugin) --> <!-- Authors (git-authors plugin) -->
{% if git_info %} {% if git_info %}
{% set authors = git_info.get("page_authors") %} {{ render_authors(git_info.get("page_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 %}
<a href="mailto:{{ author.email }}">
{{- author.name -}}
</a>
{%- if loop.revindex > 1 %}, {% endif -%}
{% endfor %}
</nav>
</span>
{% endif %} {% endif %}
<!-- Authors (git-committers plugin) --> <!-- Authors (git-committers plugin) -->
{% if committers %} {% if committers %}
<span class="md-source-file__fact"> {{ render_committers(committers) }}
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
{% include ".icons/material/github.svg" %}
</span>
<span>GitHub</span>
<nav>
{% for author in committers[: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 = committers[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>
{% endif %} {% endif %}
</aside> </aside>
{% endif %} {% endif %}