diff --git a/classes/citation/CitationListTokenizerFilter.inc.php b/classes/citation/CitationListTokenizerFilter.inc.php index c893f668d98..6e0ae4384f5 100644 --- a/classes/citation/CitationListTokenizerFilter.inc.php +++ b/classes/citation/CitationListTokenizerFilter.inc.php @@ -47,11 +47,8 @@ function &process(&$input) { } else { $citations = explode("\n", $input); } - // 4) Remove numbers from the beginning of each citation. - foreach($citations as $index => $citation) { - $citations[$index] = PKPString::regexp_replace('/^\s*[\[#]?[0-9]+[.)\]]?\s*/', '', $citation); - } - + // 4) Remove whitespace from the beginning and the end of each citation. + $citations = array_map('trim', $citations); return $citations; } } diff --git a/tests/classes/citation/CitationListTokenizerFilterTest.php b/tests/classes/citation/CitationListTokenizerFilterTest.php index 7d0ba539ae5..aec1cc7110c 100644 --- a/tests/classes/citation/CitationListTokenizerFilterTest.php +++ b/tests/classes/citation/CitationListTokenizerFilterTest.php @@ -25,10 +25,10 @@ public function testCitationListTokenizerFilter() { $tokenizer = new CitationListTokenizerFilter(); $rawCitationList = "\t1. citation1\n\n2 citation2\r\n 3) citation3\n[4]citation4"; $expectedResult = array( - 'citation1', - 'citation2', - 'citation3', - 'citation4' + '1. citation1', + '2 citation2', + '3) citation3', + '[4]citation4' ); self::assertEquals($expectedResult, $tokenizer->process($rawCitationList));