From 9532080a4f571c7bf82f6f1742ea3cb45a1c3ce6 Mon Sep 17 00:00:00 2001 From: Bozana Bokan Date: Wed, 26 Jun 2024 13:03:22 +0200 Subject: [PATCH] pkp/citationStyleLanguage#120 prefixes and suffixes in the DOI and URL citation element should not be linked --- CitationStyleLanguagePlugin.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CitationStyleLanguagePlugin.php b/CitationStyleLanguagePlugin.php index 3b6e55b..440cdb3 100644 --- a/CitationStyleLanguagePlugin.php +++ b/CitationStyleLanguagePlugin.php @@ -583,7 +583,15 @@ public function getCitation(PKPRequest $request, Submission $submission, string $additionalMarkup = [ 'DOI' => [ 'function' => function ($item, $renderedValue) { - return '' . $renderedValue . ''; + $doiWithUrl = 'https://doi.org/'.$item->DOI; + if (str_contains($renderedValue, $doiWithUrl)) { + $doiLink = '' . $doiWithUrl . ''; + return str_replace($doiWithUrl, $doiLink, $renderedValue); + } else { + $doiLink = '' . $item->DOI . ''; + return str_replace($item->DOI, $doiLink, $renderedValue); + + } }, 'affixes' => true ], @@ -591,7 +599,7 @@ public function getCitation(PKPRequest $request, Submission $submission, string 'function' => function ($item, $renderedValue) { return '' . $renderedValue . ''; }, - 'affixes' => true + 'affixes' => false ], ];