diff --git a/material/plugins/blog/plugin.py b/material/plugins/blog/plugin.py index 4c0f4e7ec..472c1aa7c 100644 --- a/material/plugins/blog/plugin.py +++ b/material/plugins/blog/plugin.py @@ -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: diff --git a/material/plugins/group/plugin.py b/material/plugins/group/plugin.py index b2b334d99..e3f4df85d 100644 --- a/material/plugins/group/plugin.py +++ b/material/plugins/group/plugin.py @@ -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) diff --git a/material/templates/partials/source-file.html b/material/templates/partials/source-file.html index becac5ded..ea24d77af 100644 --- a/material/templates/partials/source-file.html +++ b/material/templates/partials/source-file.html @@ -1,6 +1,82 @@ {#- This file was automatically generated - do not edit -#} +{% macro render_updated(date) %} + + + {% include ".icons/material/clock-edit-outline.svg" %} + + {{ date }} + +{% endmacro %} +{% macro render_created(date) %} + + + {% include ".icons/material/clock-plus-outline.svg" %} + + {{ date }} + +{% endmacro %} +{% macro render_authors(authors) %} + + + {% if authors | length == 1 %} + {% include ".icons/material/account.svg" %} + {% else %} + {% include ".icons/material/account-group.svg" %} + {% endif %} + + + +{% endmacro %} +{% macro render_committers_github(title) %} + + {% include ".icons/material/github.svg" %} + + {{ title }} +{% endmacro %} +{% macro render_committers_gitlab(title) %} + + {% include ".icons/material/gitlab.svg" %} + + {{ title }} +{% endmacro %} +{% macro render_committers(authors) %} + + {% if committers_source == "gitlab" %} + {{ render_committers_gitlab("GitLab") }} + {% else %} + {{ render_committers_github("GitHub") }} + {% endif %} + + +{% 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 %} {% endif %} diff --git a/src/plugins/blog/plugin.py b/src/plugins/blog/plugin.py index 4c0f4e7ec..472c1aa7c 100644 --- a/src/plugins/blog/plugin.py +++ b/src/plugins/blog/plugin.py @@ -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: diff --git a/src/plugins/group/plugin.py b/src/plugins/group/plugin.py index b2b334d99..e3f4df85d 100644 --- a/src/plugins/group/plugin.py +++ b/src/plugins/group/plugin.py @@ -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) diff --git a/src/templates/partials/source-file.html b/src/templates/partials/source-file.html index f85e5b236..d2de99c9c 100644 --- a/src/templates/partials/source-file.html +++ b/src/templates/partials/source-file.html @@ -20,6 +20,112 @@ IN THE SOFTWARE. --> + +{% macro render_updated(date) %} + + + {% include ".icons/material/clock-edit-outline.svg" %} + + {{ date }} + +{% endmacro %} + + +{% macro render_created(date) %} + + + {% include ".icons/material/clock-plus-outline.svg" %} + + {{ date }} + +{% endmacro %} + + + + +{% macro render_authors(authors) %} + + + {% if authors | length == 1 %} + {% include ".icons/material/account.svg" %} + {% else %} + {% include ".icons/material/account-group.svg" %} + {% endif %} + + + +{% endmacro %} + + + + +{% macro render_committers_github(title) %} + + {% include ".icons/material/github.svg" %} + + {{ title }} +{% endmacro %} + + +{% macro render_committers_gitlab(title) %} + + {% include ".icons/material/gitlab.svg" %} + + {{ title }} +{% endmacro %} + + +{% macro render_committers(authors) %} + + {% if committers_source == "gitlab" %} + {{ render_committers_gitlab("GitLab") }} + {% else %} + {{ render_committers_github("GitHub") }} + {% endif %} + + +{% endmacro %} + + + {% if page.meta %} {% if page.meta.git_revision_date_localized %} @@ -40,86 +146,22 @@ {% if updated %} - - - {% include ".icons/material/clock-edit-outline.svg" %} - - {{ updated }} - + {{ render_updated(updated) }} {% endif %} {% if created %} - - - {% include ".icons/material/clock-plus-outline.svg" %} - - {{ created }} - + {{ render_created(created) }} {% endif %} {% if git_info %} - {% set authors = git_info.get("page_authors") %} - - - {% if authors | length == 1 %} - {% include ".icons/material/account.svg" %} - {% else %} - {% include ".icons/material/account-group.svg" %} - {% endif %} - - - + {{ render_authors(git_info.get("page_authors")) }} {% endif %} {% if committers %} - - - {% include ".icons/material/github.svg" %} - - GitHub - - + {{ render_committers(committers) }} {% endif %} {% endif %}