mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Merge latests changes from Insiders
This commit is contained in:
parent
f855a67384
commit
aa62bcc4f6
@ -477,19 +477,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
||||
|
||||
# Validate authors and throw if errors occurred
|
||||
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:
|
||||
log.warning(w)
|
||||
for _, e in errors:
|
||||
|
@ -53,8 +53,8 @@ class GroupPlugin(BasePlugin[GroupConfig]):
|
||||
# little hacky, but has huge potential making plugin configuration easier.
|
||||
# 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
|
||||
# the `event_priority` decorator for `on_startup` events and is effectively
|
||||
# useless. However, the `on_startup` event is only intended to set up the
|
||||
# the `event_priority` decorator for `on_startup` methods is effectively
|
||||
# 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
|
||||
# whether we're running a dirty build, so there should be no problems.
|
||||
@event_priority(150)
|
||||
|
@ -1,6 +1,82 @@
|
||||
{#-
|
||||
This file was automatically generated - do not edit
|
||||
-#}
|
||||
{% 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 %}
|
||||
{% 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 %}
|
||||
{% 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 %}
|
||||
{% 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 %}
|
||||
{% 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>
|
||||
{% 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 %}
|
||||
{% 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 %}
|
||||
{% if page.meta %}
|
||||
{% if page.meta.git_revision_date_localized %}
|
||||
{% set updated = page.meta.git_revision_date_localized %}
|
||||
@ -14,68 +90,16 @@
|
||||
{% 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-icon" title="{{ lang.t('source.file.date.updated') }}">
|
||||
{% include ".icons/material/clock-edit-outline.svg" %}
|
||||
</span>
|
||||
{{ updated }}
|
||||
</span>
|
||||
{{ render_updated(updated) }}
|
||||
{% endif %}
|
||||
{% if created %}
|
||||
<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>
|
||||
{{ created }}
|
||||
</span>
|
||||
{{ render_created(created) }}
|
||||
{% endif %}
|
||||
{% if git_info %}
|
||||
{% set 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>
|
||||
{{ render_authors(git_info.get("page_authors")) }}
|
||||
{% endif %}
|
||||
{% if committers %}
|
||||
<span class="md-source-file__fact">
|
||||
<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 %}
|
||||
{% 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>
|
||||
{{ render_committers(committers) }}
|
||||
{% endif %}
|
||||
</aside>
|
||||
{% endif %}
|
||||
|
@ -477,19 +477,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
||||
|
||||
# Validate authors and throw if errors occurred
|
||||
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:
|
||||
log.warning(w)
|
||||
for _, e in errors:
|
||||
|
@ -53,8 +53,8 @@ class GroupPlugin(BasePlugin[GroupConfig]):
|
||||
# little hacky, but has huge potential making plugin configuration easier.
|
||||
# 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
|
||||
# the `event_priority` decorator for `on_startup` events and is effectively
|
||||
# useless. However, the `on_startup` event is only intended to set up the
|
||||
# the `event_priority` decorator for `on_startup` methods is effectively
|
||||
# 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
|
||||
# whether we're running a dirty build, so there should be no problems.
|
||||
@event_priority(150)
|
||||
|
@ -20,6 +20,112 @@
|
||||
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 -->
|
||||
{% if page.meta %}
|
||||
{% if page.meta.git_revision_date_localized %}
|
||||
@ -40,86 +146,22 @@
|
||||
|
||||
<!-- Date of last update -->
|
||||
{% if updated %}
|
||||
<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>
|
||||
{{ updated }}
|
||||
</span>
|
||||
{{ render_updated(updated) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- Date of creation -->
|
||||
{% if created %}
|
||||
<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>
|
||||
{{ created }}
|
||||
</span>
|
||||
{{ render_created(created) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- Authors (git-authors plugin) -->
|
||||
{% if git_info %}
|
||||
{% set 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>
|
||||
{{ render_authors(git_info.get("page_authors")) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- Authors (git-committers plugin) -->
|
||||
{% if committers %}
|
||||
<span class="md-source-file__fact">
|
||||
<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>
|
||||
{{ render_committers(committers) }}
|
||||
{% endif %}
|
||||
</aside>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user