We are moving to Git Issues for bug tracking in future releases. During transition, content will be in both tools. If you'd like to file a new bug, please create an issue.

View | Details | Raw Unified | Return to bug 6119 | Differences between
and this patch

Collapse All | Expand All

(-)a/classes/citation/CitationListTokenizerFilter.inc.php (-4 / +10 lines)
 Lines 36-46   class CitationListTokenizerFilter extends Filter { Link Here 
36
	function &process(&$input) {
36
	function &process(&$input) {
37
		// The default implementation assumes that raw citations are
37
		// The default implementation assumes that raw citations are
38
		// separated with line endings.
38
		// separated with line endings.
39
		// 1) Remove empty lines and normalize line endings
39
		// 1) Remove empty lines and normalize line endings.
40
		$input = String::regexp_replace('/[\r\n]+/s', "\n", $input);
40
		$input = String::regexp_replace('/[\r\n]+/s', "\n", $input);
41
		// 2) Break up at line endings
41
		// 2) Remove trailing/leading line breaks.
42
		$citations = explode("\n", $input);
42
		$input = trim($input, "\n");
43
		// 3) Remove numbers from the beginning of each citation
43
		// 3) Break up at line endings.
44
		if (empty($input)) {
45
			$citations = array();
46
		} else {
47
			$citations = explode("\n", $input);
48
		}
49
		// 4) Remove numbers from the beginning of each citation.
44
		foreach($citations as $index => $citation) {
50
		foreach($citations as $index => $citation) {
45
			$citations[$index] = String::regexp_replace('/^\s*[\[#]?[0-9]+[.)\]]?\s*/', '', $citation);
51
			$citations[$index] = String::regexp_replace('/^\s*[\[#]?[0-9]+[.)\]]?\s*/', '', $citation);
46
		}
52
		}
(-)a/tests/classes/citation/CitationListTokenizerFilterTest.inc.php (+3 lines)
 Lines 30-35   class CitationListTokenizerFilterTest extends PKPTestCase { Link Here 
30
			'citation4'
30
			'citation4'
31
		);
31
		);
32
		self::assertEquals($expectedResult, $tokenizer->process($rawCitationList));
32
		self::assertEquals($expectedResult, $tokenizer->process($rawCitationList));
33
34
		$rawCitationList = '';
35
		self::assertEquals(array(), $tokenizer->process($rawCitationList));
33
	}
36
	}
34
}
37
}
35
?>
38
?>

Return to bug 6119