improve newline handling, remove redundant newlines
This commit is contained in:
parent
d67c7fc926
commit
fc28e8c5c8
10
rebuild.php
10
rebuild.php
@ -214,14 +214,22 @@ class CProject {
|
||||
$this->shortdesc[0] = strtolower($this->shortdesc[0]); // cosmetic lowercase
|
||||
|
||||
// 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