diff --git a/CitationStyleLanguagePlugin.php b/CitationStyleLanguagePlugin.php index 3b6e55b..45b7d3f 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 . ''; + $prefixPattern = '/.*DOI:/i'; + if (preg_match($prefixPattern, $renderedValue, $prefixMatches)) { + $renderedValue = preg_replace($prefixPattern, '', $renderedValue); + } + $suffixPattern = '#'.$item->DOI.'(.*)$#'; + if (preg_match($suffixPattern, $renderedValue, $suffixMatches)) { + $renderedValue = str_replace($suffixMatches[1], '', $renderedValue); + } + return $prefixMatches[0] . '' . $renderedValue . '' . $suffixMatches[1]; }, 'affixes' => true ], @@ -591,7 +599,7 @@ public function getCitation(PKPRequest $request, Submission $submission, string 'function' => function ($item, $renderedValue) { return '' . $renderedValue . ''; }, - 'affixes' => true + 'affixes' => false ], ];