From 0d1187cb19082bc48bdbd7134aaf20f398b98772 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 6 May 2020 15:16:05 -0400
Subject: [PATCH] Strip trailing commas from displayed author names. - RDA
 cataloging makes it more likely that VuFind's index will contain trailing
 commas on indexed authors; this normalizes the display.

---
 .../templates/RecordDriver/DefaultRecord/data-authors.phtml     | 2 +-
 .../templates/RecordDriver/DefaultRecord/result-list.phtml      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml
index 5a30567231d..f8fdeac225c 100644
--- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml
+++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml
@@ -16,7 +16,7 @@ $formattedAuthors = [];
     <?php ob_start(); ?>
     <span class="author-data" property="<?=$this->escapeHtml($schemaLabel)?>">
       <a href="<?=$this->record($this->driver)->getLink('author', $author)?>">
-        <?=$this->escapeHtml($author)?>
+        <?=$this->escapeHtml(rtrim($author, ','))?>
       </a>
       <?php
         // Display additional data using the appropriate translation prefix
diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml
index b44fa08be2b..fbfa818e6cf 100644
--- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml
+++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml
@@ -32,7 +32,7 @@
           <?php $summAuthors = $this->driver->getPrimaryAuthorsWithHighlighting(); if (!empty($summAuthors)): ?>
             <?=$this->transEsc('by')?>
             <?php $authorCount = count($summAuthors); foreach ($summAuthors as $i => $summAuthor): ?>
-              <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?>
+              <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>"><?=$this->highlight(rtrim($summAuthor, ','))?></a><?=$i + 1 < $authorCount ? ',' : ''?>
             <?php endforeach; ?>
           <?php endif; ?>
 
-- 
GitLab