fix author spacing (#2197)
This PR fixes issue https://github.com/alshedivat/al-folio/issues/2185 and addresses discussion https://github.com/alshedivat/al-folio/discussions/2153. - removes leading whitespace before commas in author list - fixes author spacing
This commit is contained in:
parent
2a056fe68e
commit
40b22ff274
|
|
@ -50,60 +50,60 @@
|
||||||
{% assign author_array_limit = site.max_author_limit %}
|
{% assign author_array_limit = site.max_author_limit %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for author in entry.author_array limit: author_array_limit %}
|
{%- for author in entry.author_array limit: author_array_limit -%}
|
||||||
{% assign author_is_self = false %}
|
{% assign author_is_self = false %}
|
||||||
{% assign author_last_name = author.last | remove: '¶' | remove: '&' | remove: '*' | remove: '†' | remove: '^' %}
|
{%- assign author_last_name = author.last | remove: '¶' | remove: '&' | remove: '*' | remove: '†' | remove: '^' -%}
|
||||||
{% if site.scholar.last_name contains author_last_name %}
|
{% if site.scholar.last_name contains author_last_name %}
|
||||||
{% if site.scholar.first_name contains author.first %}
|
{% if site.scholar.first_name contains author.first %}
|
||||||
{% assign author_is_self = true %}
|
{% assign author_is_self = true %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{%- endif -%}
|
||||||
{% assign coauthor_url = null %}
|
{% assign coauthor_url = null %}
|
||||||
{% assign clean_last_name = author_last_name | downcase | remove_accents %}
|
{%- assign clean_last_name = author_last_name | downcase | remove_accents -%}
|
||||||
{% if site.data.coauthors[clean_last_name] %}
|
{% if site.data.coauthors[clean_last_name] %}
|
||||||
{% for coauthor in site.data.coauthors[clean_last_name] %}
|
{%- for coauthor in site.data.coauthors[clean_last_name] -%}
|
||||||
{% if coauthor.firstname contains author.first %}
|
{% if coauthor.firstname contains author.first %}
|
||||||
{% assign coauthor_url = coauthor.url %}
|
{%- assign coauthor_url = coauthor.url -%}
|
||||||
{% break %}
|
{% break %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{%- endif -%}
|
||||||
|
|
||||||
{% if forloop.length > 1 %}
|
{%- if forloop.length > 1 -%}
|
||||||
{% if forloop.first == false %}, {% endif %}
|
{% if forloop.first == false %}, {% endif %}
|
||||||
{% if forloop.last and author_array_limit == author_array_size %}and {% endif %}
|
{%- if forloop.last and author_array_limit == author_array_size %}and {% endif -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if author_is_self %}
|
{%- if author_is_self -%}
|
||||||
<em>
|
<em>
|
||||||
{{- author.first }}
|
{{- author.first }}
|
||||||
{{ author.last -}}
|
{{ author.last -}}
|
||||||
</em>
|
</em>
|
||||||
{% else %}
|
{%- else -%}
|
||||||
{% if coauthor_url %}
|
{%- if coauthor_url -%}
|
||||||
<a href="{{coauthor_url}}">
|
<a href="{{coauthor_url}}">
|
||||||
{{- author.first }}
|
{{- author.first }}
|
||||||
{{ author.last -}}
|
{{ author.last -}}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{%- else -%}
|
||||||
{{ author.first }}
|
{{ author.first }}
|
||||||
{{ author.last }}
|
{{ author.last }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{%- endif -%}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% assign more_authors = author_array_size | minus: author_array_limit %}
|
{%- assign more_authors = author_array_size | minus: author_array_limit -%}
|
||||||
|
|
||||||
{% assign more_authors_hide = more_authors | append: ' more author' %}
|
{%- assign more_authors_hide = more_authors | append: ' more author' -%}
|
||||||
{% if more_authors > 0 %}
|
{% if more_authors > 0 %}
|
||||||
{% if more_authors > 1 %}
|
{%- if more_authors > 1 -%}
|
||||||
{% assign more_authors_hide = more_authors_hide | append: 's' %}
|
{% assign more_authors_hide = more_authors_hide | append: 's' %}
|
||||||
{% endif %}
|
{%- endif -%}
|
||||||
{% assign more_authors_show = '' %}
|
{% assign more_authors_show = '' %}
|
||||||
{% for author in entry.author_array offset: author_array_limit %}
|
{%- for author in entry.author_array offset: author_array_limit -%}
|
||||||
{% assign more_authors_show = more_authors_show | append: author.first | append: ' ' | append: author.last %}
|
{% assign more_authors_show = more_authors_show | append: author.first | append: ' ' | append: author.last %}
|
||||||
{% unless forloop.last %}
|
{% unless forloop.last %}
|
||||||
{% assign more_authors_show = more_authors_show | append: ', ' %}
|
{% assign more_authors_show = more_authors_show | append: ', ' %}
|
||||||
{% endunless %}
|
{% endunless %}
|
||||||
{% endfor %}
|
{%- endfor -%}
|
||||||
, and
|
, and
|
||||||
<span
|
<span
|
||||||
class="more-authors"
|
class="more-authors"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue