Skip to content

Commit

Permalink
pkp#120 prefixes and suffixes in the DOI and URL citation element sho…
Browse files Browse the repository at this point in the history
…uld not be linked
  • Loading branch information
bozana committed Jun 27, 2024
1 parent ddff425 commit 3a8f640
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CitationStyleLanguagePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,23 @@ public function getCitation(PKPRequest $request, Submission $submission, string
$additionalMarkup = [
'DOI' => [
'function' => function ($item, $renderedValue) {
return '<a href="https://doi.org/' . $item->DOI . '">' . $renderedValue . '</a>';
$doiWithUrl = 'https://doi.org/'.$item->DOI;
if (str_contains($renderedValue, $doiWithUrl)) {
$doiLink = '<a href="' . $doiWithUrl . '">' . $doiWithUrl . '</a>';
return str_replace($doiWithUrl, $doiLink, $renderedValue);
} else {
$doiLink = '<a href="' . $doiWithUrl . '">' . $item->DOI . '</a>';
return str_replace($item->DOI, $doiLink, $renderedValue);

}
},
'affixes' => true
],
'URL' => [
'function' => function ($item, $renderedValue) {
return '<a href="' . $item->URL . '">' . $renderedValue . '</a>';
},
'affixes' => true
'affixes' => false
],
];

Expand Down

0 comments on commit 3a8f640

Please sign in to comment.