Only show authors' email addresses if so configured in git-authors (#6494)

Honour the git-authors plugin's setting to render the authors' names
as links pointing to their email address:

* If the git-authors plugin is enabled and its show_email_address
  option is not set, or is set to true, render the author's name as a
  "mailto:" link.
* If the git-authors plugin is enabled and its show_email_address
  option is set to false, render the author's name in plain text with
  no link.
* If the git-authors plugin is not enabled (or not installed), don't
  show author information.
This commit is contained in:
Florian Haas 2023-12-12 17:35:20 +01:00 committed by GitHub
parent 2ca5cf0ea0
commit 9b98c77725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,7 @@
</span>
{% endmacro %}
{% 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 %}
@ -28,9 +29,13 @@
</span>
<nav>
{% for author in authors %}
{%- if git_authors.config.show_email_address %}
<a href="mailto:{{ author.email }}">
{{- author.name -}}
</a>
{%- else -%}
{{- author.name -}}
{% endif -%}
{%- if loop.revindex > 1 %}, {% endif -%}
{% endfor %}
</nav>

View File

@ -44,6 +44,7 @@
<!-- 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 %}
@ -54,9 +55,13 @@
</span>
<nav>
{% for author in authors %}
{%- if git_authors.config.show_email_address %}
<a href="mailto:{{ author.email }}">
{{- author.name -}}
</a>
{%- else -%}
{{- author.name -}}
{% endif -%}
{%- if loop.revindex > 1 %}, {% endif -%}
{% endfor %}
</nav>