improve newline handling, remove redundant newlines
This commit is contained in:
parent
d67c7fc926
commit
fc28e8c5c8
12
rebuild.php
12
rebuild.php
@ -213,15 +213,23 @@ class CProject {
|
||||
$this->shortdesc = array_shift($parts);
|
||||
$this->shortdesc[0] = strtolower($this->shortdesc[0]); // cosmetic lowercase
|
||||
|
||||
// Filter longdesc
|
||||
// Filter longdesc
|
||||
$this->longdesc = str_replace("\r", "", $this->longdesc); // filter windows CR
|
||||
|
||||
$prefix_html = '';
|
||||
$this->longdesc = preg_replace_callback('~\r?\nWritten in ([^\\r\\n]+)~ms', function($matches) use (&$prefix_html) {
|
||||
$this->longdesc = preg_replace_callback('~\r?\nWritten in ([^\\n]+)~ms', function($matches) use (&$prefix_html) {
|
||||
$prefix_html .= (
|
||||
(SHIELDS_PREFIX ? mkshield('build', 'success', 'brightgreen').' ' : '').
|
||||
mkshield('written in', $matches[1], 'blue')
|
||||
);
|
||||
return '';
|
||||
}, $this->longdesc);
|
||||
|
||||
while(strpos($this->longdesc, "\n\n\n") !== false) {
|
||||
$this->longdesc = str_replace("\n\n\n", "\n\n", $this->longdesc);
|
||||
}
|
||||
$this->longdesc = rtrim($this->longdesc, "\n");
|
||||
|
||||
$this->prefix_html = $prefix_html;
|
||||
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user