public function BibtexEncoder::lineEndingsReplace in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php \Drupal\bibcite_bibtex\Encoder\BibtexEncoder::lineEndingsReplace()
Convert line endings function.
Different sources uses different line endings in exports. Convert all line endings to unix which is expected by BibtexParser.
Parameters
string $data: Input string from file.
Return value
string Unix formatted string
1 call to BibtexEncoder::lineEndingsReplace()
- BibtexEncoder::decode in modules/
bibcite_bibtex/ src/ Encoder/ BibtexEncoder.php
File
- modules/
bibcite_bibtex/ src/ Encoder/ BibtexEncoder.php, line 90
Class
- BibtexEncoder
- BibTeX format encoder.
Namespace
Drupal\bibcite_bibtex\EncoderCode
public function lineEndingsReplace($data) {
/*
* \R is escape sequence of newline, equivalent to the following: (\r\n|\n|\x0b|\f|\r|\x85)
* @see http://www.pcre.org/original/doc/html/pcrepattern.html Newline sequences.
*/
return preg_replace("/\\R/", "\n", $data);
}