参考文献的作者数变成6
This commit is contained in:
@@ -399,14 +399,16 @@ class CrossrefService
|
||||
}
|
||||
|
||||
/**
|
||||
* 引用格式作者串:姓全写 + 名首字母,超过 $maxAuthors 个取前 N 个 + et al
|
||||
* 例:Smith JA, Jones B, Lee C, et al
|
||||
* 引用格式作者串:姓全写 + 名首字母
|
||||
* 著录规则:作者数 <= $maxAuthors 时全部列出,超过时只列前 $keep 个再加 et al
|
||||
* 例:7 个作者 → Smith JA, Jones B, Lee C, et al
|
||||
*
|
||||
* @param array $aDoiInfo Crossref message
|
||||
* @param int $maxAuthors 最多展示作者数,超过则截断加 et al
|
||||
* @param int $maxAuthors 全部列出的上限,超过则截断
|
||||
* @param int $keep 截断后保留的作者数
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthorsCitation($aDoiInfo = [], $maxAuthors = 3)
|
||||
public function getAuthorsCitation($aDoiInfo = [], $maxAuthors = 6, $keep = 3)
|
||||
{
|
||||
$list = [];
|
||||
if (!empty($aDoiInfo['author'])) {
|
||||
@@ -436,8 +438,9 @@ class CrossrefService
|
||||
}
|
||||
|
||||
$maxAuthors = max(1, (int)$maxAuthors);
|
||||
$keep = min(max(1, (int)$keep), $maxAuthors);
|
||||
if (count($list) > $maxAuthors) {
|
||||
$list = array_slice($list, 0, $maxAuthors);
|
||||
$list = array_slice($list, 0, $keep);
|
||||
return implode(', ', $list) . ', et al';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user