Skip to content

Commit

Permalink
pkp#9946 Do not remove numbers from the beginning of each citation:
Browse files Browse the repository at this point in the history
  • Loading branch information
GaziYucel authored and bozana committed May 31, 2024
1 parent 5ab5d86 commit 7233357
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions classes/citation/CitationListTokenizerFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/classes/citation/CitationListTokenizerFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 7233357

Please sign in to comment.