From 40b22ff27497593e7e81a58432a8cb910781d4d8 Mon Sep 17 00:00:00 2001
From: Ethan Olesinski <47125809+eolesinski@users.noreply.github.com>
Date: Wed, 14 Feb 2024 10:54:44 -0500
Subject: [PATCH] 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
---
_layouts/bib.liquid | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/_layouts/bib.liquid b/_layouts/bib.liquid
index e4d0d148f165..6f50f562b4d4 100644
--- a/_layouts/bib.liquid
+++ b/_layouts/bib.liquid
@@ -50,60 +50,60 @@
{% assign author_array_limit = site.max_author_limit %}
{% 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_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.first_name contains author.first %}
{% assign author_is_self = true %}
{% endif %}
- {% endif %}
+ {%- endif -%}
{% 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] %}
- {% for coauthor in site.data.coauthors[clean_last_name] %}
+ {%- for coauthor in site.data.coauthors[clean_last_name] -%}
{% if coauthor.firstname contains author.first %}
- {% assign coauthor_url = coauthor.url %}
+ {%- assign coauthor_url = coauthor.url -%}
{% break %}
{% endif %}
{% endfor %}
- {% endif %}
+ {%- endif -%}
- {% if forloop.length > 1 %}
+ {%- if forloop.length > 1 -%}
{% 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 %}
- {% if author_is_self %}
+ {%- if author_is_self -%}
{{- author.first }}
{{ author.last -}}
- {% else %}
- {% if coauthor_url %}
+ {%- else -%}
+ {%- if coauthor_url -%}
{{- author.first }}
{{ author.last -}}
- {% else %}
+ {%- else -%}
{{ author.first }}
{{ author.last }}
{% endif %}
- {% endif %}
+ {%- endif -%}
{% 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 > 1 %}
+ {%- if more_authors > 1 -%}
{% assign more_authors_hide = more_authors_hide | append: 's' %}
- {% endif %}
+ {%- endif -%}
{% 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 %}
{% unless forloop.last %}
{% assign more_authors_show = more_authors_show | append: ', ' %}
{% endunless %}
- {% endfor %}
+ {%- endfor -%}
, and