参考文献的作者数变成6
This commit is contained in:
@@ -406,10 +406,11 @@ class PubmedService
|
||||
}
|
||||
|
||||
/**
|
||||
* 引用格式作者串:姓全写 + 名首字母,超过 $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
|
||||
*/
|
||||
public function authorsCitation(array $authors, int $maxAuthors = 3): string
|
||||
public function authorsCitation(array $authors, int $maxAuthors = 6, int $keep = 3): string
|
||||
{
|
||||
$list = [];
|
||||
foreach ($authors as $a) {
|
||||
@@ -435,8 +436,9 @@ class PubmedService
|
||||
}
|
||||
|
||||
$maxAuthors = max(1, $maxAuthors);
|
||||
$keep = min(max(1, $keep), $maxAuthors);
|
||||
if (count($list) > $maxAuthors) {
|
||||
return implode(', ', array_slice($list, 0, $maxAuthors)) . ', et al';
|
||||
return implode(', ', array_slice($list, 0, $keep)) . ', et al';
|
||||
}
|
||||
return implode(', ', $list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user