Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include all primary authors in export formats. #2367

Merged
merged 4 commits into from Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -60,16 +60,24 @@ if (is_array($series)) {
}
}

$author = $this->driver->tryMethod('getPrimaryAuthor');
if (!empty($author)) {
echo "author = {{$author}},\n";
$mergeAuthors = function (array $a): string {
return implode(
' and ',
array_map(
function ($s) {
return str_replace(' and ', ' {and} ', $s);
},
$a
)
);
};

if ($authors = $mergeAuthors($this->driver->tryMethod('getPrimaryAuthors', [], []))) {
echo "author = {{$authors}},\n";
}

$secondaryAuthors = $this->driver->tryMethod('getSecondaryAuthors');
if (is_array($secondaryAuthors)) {
foreach ($secondaryAuthors as $current) {
echo "editor = {{$current}},\n";
}
if ($authors = $mergeAuthors($this->driver->tryMethod('getSecondaryAuthors', [], []))) {
demiankatz marked this conversation as resolved.
Show resolved Hide resolved
echo "editor = {{$authors}},\n";
}

$pubPlaces = $this->driver->tryMethod('getPlacesOfPublication');
Expand Down
Expand Up @@ -10,16 +10,12 @@ if (is_array($formats) && !empty($formats)) {
echo "%0 Book\n";
}

$author = $this->driver->tryMethod('getPrimaryAuthor');
if (!empty($author)) {
echo "%A $author\n";
foreach ($this->driver->tryMethod('getPrimaryAuthors', [], []) as $current) {
echo "%A $current\n";
}

$secondaryAuthors = $this->driver->tryMethod('getSecondaryAuthors');
if (is_array($secondaryAuthors)) {
foreach ($secondaryAuthors as $current) {
echo "%E $current\n";
}
foreach ($this->driver->tryMethod('getSecondaryAuthors', [], []) as $current) {
echo "%E $current\n";
}

$pubPlaces = $this->driver->tryMethod('getPlacesOfPublication');
Expand Down
Expand Up @@ -58,16 +58,12 @@ if (!empty($journalTitle)) {
}
}

$author = $this->driver->tryMethod('getPrimaryAuthor');
if (!empty($author)) {
echo "A1 - $author\n";
foreach ($this->driver->tryMethod('getPrimaryAuthors', [], []) as $current) {
echo "A1 - $current\n";
}

$secondaryAuthors = $this->driver->tryMethod('getSecondaryAuthors');
if (is_array($secondaryAuthors)) {
foreach ($secondaryAuthors as $current) {
echo "A2 - $current\n";
}
foreach ($this->driver->tryMethod('getSecondaryAuthors', [], []) as $current) {
echo "A2 - $current\n";
}

$languages = $this->driver->tryMethod('getLanguages');
Expand Down
Expand Up @@ -40,19 +40,15 @@ if (!empty($journalTitle)) {
}
}

$author = $this->driver->tryMethod('getPrimaryAuthor');
if (!empty($author)) {
echo "A1 $author\n";
foreach ($this->driver->tryMethod('getPrimaryAuthors', [], []) as $current) {
echo "A1 $current\n";
}

$secondaryAuthors = $this->driver->tryMethod('getSecondaryAuthors');
if (is_array($secondaryAuthors)) {
foreach ($secondaryAuthors as $current) {
echo "A2 $current\n";
}
foreach ($this->driver->tryMethod('getSecondaryAuthors', [], []) as $current) {
echo "A2 $current\n";
}

$languages = $this->driver->tryMethod('getLanguages');
$languages = $this->driver->tryMethod('getLanguages', [], []);
demiankatz marked this conversation as resolved.
Show resolved Hide resolved
if (is_array($languages)) {
foreach ($languages as $lang) {
echo "LA $lang\n";
Expand Down
12 changes: 4 additions & 8 deletions themes/root/templates/RecordDriver/AbstractBase/export-ris.phtml
Expand Up @@ -63,16 +63,12 @@ if (is_array($series)) {
}
}

$author = $this->driver->tryMethod('getPrimaryAuthor');
if (!empty($author)) {
echo 'AU - ' . "$author\r\n";
foreach ($this->driver->tryMethod('getPrimaryAuthors', [], []) as $current) {
echo 'AU - ' . "$current\r\n";
}

$secondaryAuthors = $this->driver->tryMethod('getSecondaryAuthors');
if (is_array($secondaryAuthors)) {
foreach ($secondaryAuthors as $current) {
echo 'A2 - ' . "$current\r\n";
}
foreach ($this->driver->tryMethod('getSecondaryAuthors', [], []) as $current) {
echo 'A2 - ' . "$current\r\n";
}

$pubPlaces = $this->driver->tryMethod('getPlacesOfPublication');
Expand Down