Skip to content

Commit aa62bcc

Browse files
committed
Merge latests changes from Insiders
1 parent f855a67 commit aa62bcc

File tree

6 files changed

+194
-154
lines changed

6 files changed

+194
-154
lines changed

material/plugins/blog/plugin.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -477,19 +477,6 @@ def _resolve_authors(self, config: MkDocsConfig):
477477

478478
# Validate authors and throw if errors occurred
479479
errors, warnings = config.validate()
480-
if not config.authors and warnings:
481-
log.warning(
482-
f"Action required: the format of the authors file changed.\n"
483-
f"All authors must now be located under the 'authors' key.\n"
484-
f"Please adjust '{file}' to match:\n"
485-
f"\n"
486-
f"authors:\n"
487-
f" squidfunk:\n"
488-
f" avatar: https://avatars.githubusercontent.com/u/932156\n"
489-
f" description: Creator\n"
490-
f" name: Martin Donath\n"
491-
f"\n"
492-
)
493480
for _, w in warnings:
494481
log.warning(w)
495482
for _, e in errors:

material/plugins/group/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def on_startup(self, *, command, dirty):
5353
# little hacky, but has huge potential making plugin configuration easier.
5454
# There's one little caveat: the `__init__` and `on_startup` methods of the
5555
# plugins that are part of the group are called after all other plugins, so
56-
# the `event_priority` decorator for `on_startup` events and is effectively
57-
# useless. However, the `on_startup` event is only intended to set up the
56+
# the `event_priority` decorator for `on_startup` methods is effectively
57+
# useless. However, the `on_startup` method is only intended to set up the
5858
# plugin and doesn't receive anything else than the invoked command and
5959
# whether we're running a dirty build, so there should be no problems.
6060
@event_priority(150)
Lines changed: 80 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,82 @@
11
{#-
22
This file was automatically generated - do not edit
33
-#}
4+
{% macro render_updated(date) %}
5+
<span class="md-source-file__fact">
6+
<span class="md-icon" title="{{ lang.t('source.file.date.updated') }}">
7+
{% include ".icons/material/clock-edit-outline.svg" %}
8+
</span>
9+
{{ date }}
10+
</span>
11+
{% endmacro %}
12+
{% macro render_created(date) %}
13+
<span class="md-source-file__fact">
14+
<span class="md-icon" title="{{ lang.t('source.file.date.created') }}">
15+
{% include ".icons/material/clock-plus-outline.svg" %}
16+
</span>
17+
{{ date }}
18+
</span>
19+
{% endmacro %}
20+
{% macro render_authors(authors) %}
21+
<span class="md-source-file__fact">
22+
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
23+
{% if authors | length == 1 %}
24+
{% include ".icons/material/account.svg" %}
25+
{% else %}
26+
{% include ".icons/material/account-group.svg" %}
27+
{% endif %}
28+
</span>
29+
<nav>
30+
{% for author in authors %}
31+
<a href="mailto:{{ author.email }}">
32+
{{- author.name -}}
33+
</a>
34+
{%- if loop.revindex > 1 %}, {% endif -%}
35+
{% endfor %}
36+
</nav>
37+
</span>
38+
{% endmacro %}
39+
{% macro render_committers_github(title) %}
40+
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
41+
{% include ".icons/material/github.svg" %}
42+
</span>
43+
<span>{{ title }}</span>
44+
{% endmacro %}
45+
{% macro render_committers_gitlab(title) %}
46+
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
47+
{% include ".icons/material/gitlab.svg" %}
48+
</span>
49+
<span>{{ title }}</span>
50+
{% endmacro %}
51+
{% macro render_committers(authors) %}
52+
<span class="md-source-file__fact">
53+
{% if committers_source == "gitlab" %}
54+
{{ render_committers_gitlab("GitLab") }}
55+
{% else %}
56+
{{ render_committers_github("GitHub") }}
57+
{% endif %}
58+
<nav>
59+
{% for author in authors[:4] %}
60+
<a href="{{ author.url }}" class="md-author" title="@{{ author.login }}">
61+
{% set separator = "&" if "?" in author.avatar else "?" %}
62+
<img src="{{ author.avatar }}{{ separator }}size=72" alt="{{ author.name or 'GitHub user' }}">
63+
</a>
64+
{% endfor %}
65+
{% set more = authors[4:] | length %}
66+
{% if more > 0 %}
67+
{% if page.edit_url %}
68+
<a href="{{ page.edit_url | replace('edit', 'blob') }}" class="md-author md-author--more">
69+
+{{ more }}
70+
</a>
71+
{% else %}
72+
<span class="md-author md-author--more">
73+
+{{ more }}
74+
</span>
75+
{% endif %}
76+
{% endif %}
77+
</nav>
78+
</span>
79+
{% endmacro %}
480
{% if page.meta %}
581
{% if page.meta.git_revision_date_localized %}
682
{% set updated = page.meta.git_revision_date_localized %}
@@ -14,68 +90,16 @@
1490
{% if updated or created or git_info or committers %}
1591
<aside class="md-source-file">
1692
{% if updated %}
17-
<span class="md-source-file__fact">
18-
<span class="md-icon" title="{{ lang.t('source.file.date.updated') }}">
19-
{% include ".icons/material/clock-edit-outline.svg" %}
20-
</span>
21-
{{ updated }}
22-
</span>
93+
{{ render_updated(updated) }}
2394
{% endif %}
2495
{% if created %}
25-
<span class="md-source-file__fact">
26-
<span class="md-icon" title="{{ lang.t('source.file.date.created') }}">
27-
{% include ".icons/material/clock-plus-outline.svg" %}
28-
</span>
29-
{{ created }}
30-
</span>
96+
{{ render_created(created) }}
3197
{% endif %}
3298
{% if git_info %}
33-
{% set authors = git_info.get("page_authors") %}
34-
<span class="md-source-file__fact">
35-
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
36-
{% if authors | length == 1 %}
37-
{% include ".icons/material/account.svg" %}
38-
{% else %}
39-
{% include ".icons/material/account-group.svg" %}
40-
{% endif %}
41-
</span>
42-
<nav>
43-
{% for author in authors %}
44-
<a href="mailto:{{ author.email }}">
45-
{{- author.name -}}
46-
</a>
47-
{%- if loop.revindex > 1 %}, {% endif -%}
48-
{% endfor %}
49-
</nav>
50-
</span>
99+
{{ render_authors(git_info.get("page_authors")) }}
51100
{% endif %}
52101
{% if committers %}
53-
<span class="md-source-file__fact">
54-
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
55-
{% include ".icons/material/github.svg" %}
56-
</span>
57-
<span>GitHub</span>
58-
<nav>
59-
{% for author in committers[:4] %}
60-
<a href="{{ author.url }}" class="md-author" title="@{{ author.login }}">
61-
{% set separator = "&" if "?" in author.avatar else "?" %}
62-
<img src="{{ author.avatar }}{{ separator }}size=72" alt="{{ author.name or 'GitHub user' }}">
63-
</a>
64-
{% endfor %}
65-
{% set more = committers[4:] | length %}
66-
{% if more > 0 %}
67-
{% if page.edit_url %}
68-
<a href="{{ page.edit_url | replace('edit', 'blob') }}" class="md-author md-author--more">
69-
+{{ more }}
70-
</a>
71-
{% else %}
72-
<span class="md-author md-author--more">
73-
+{{ more }}
74-
</span>
75-
{% endif %}
76-
{% endif %}
77-
</nav>
78-
</span>
102+
{{ render_committers(committers) }}
79103
{% endif %}
80104
</aside>
81105
{% endif %}

src/plugins/blog/plugin.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -477,19 +477,6 @@ def _resolve_authors(self, config: MkDocsConfig):
477477

478478
# Validate authors and throw if errors occurred
479479
errors, warnings = config.validate()
480-
if not config.authors and warnings:
481-
log.warning(
482-
f"Action required: the format of the authors file changed.\n"
483-
f"All authors must now be located under the 'authors' key.\n"
484-
f"Please adjust '{file}' to match:\n"
485-
f"\n"
486-
f"authors:\n"
487-
f" squidfunk:\n"
488-
f" avatar: https://avatars.githubusercontent.com/u/932156\n"
489-
f" description: Creator\n"
490-
f" name: Martin Donath\n"
491-
f"\n"
492-
)
493480
for _, w in warnings:
494481
log.warning(w)
495482
for _, e in errors:

src/plugins/group/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def on_startup(self, *, command, dirty):
5353
# little hacky, but has huge potential making plugin configuration easier.
5454
# There's one little caveat: the `__init__` and `on_startup` methods of the
5555
# plugins that are part of the group are called after all other plugins, so
56-
# the `event_priority` decorator for `on_startup` events and is effectively
57-
# useless. However, the `on_startup` event is only intended to set up the
56+
# the `event_priority` decorator for `on_startup` methods is effectively
57+
# useless. However, the `on_startup` method is only intended to set up the
5858
# plugin and doesn't receive anything else than the invoked command and
5959
# whether we're running a dirty build, so there should be no problems.
6060
@event_priority(150)

0 commit comments

Comments
 (0)