cvs: phd /themes/pear peartheme.php pearweb.php

From: Date: Mon, 03 Nov 2008 20:34:45 +0000
Subject: cvs: phd /themes/pear peartheme.php pearweb.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2368@lists.php.net to get a copy of this message
cweiske Mon Nov 3 20:34:45 2008 UTC Modified files: /phd/themes/pear peartheme.php pearweb.php Log: Clean up pear html after generation http://cvs.php.net/viewvc.cgi/phd/themes/pear/peartheme.php?r1=1.17&r2=1.18&diff_format=u Index: phd/themes/pear/peartheme.php diff -u phd/themes/pear/peartheme.php:1.17 phd/themes/pear/peartheme.php:1.18 --- phd/themes/pear/peartheme.php:1.17 Sun Nov 2 23:34:49 2008 +++ phd/themes/pear/peartheme.php Mon Nov 3 20:34:45 2008 @@ -265,6 +265,18 @@ $this->chunked = $chunked; } + /** + * Clean up HTML from empty paragraph tags (<p>). + * + * @param string $str String to clean up + * + * @return string Cleaned up string. + */ + protected function cleanHtml($str) + { + return preg_replace('#<p>\\s*</p>#s', '', $str); + } + public function format_chunk($open, $name, $attrs, $props) { $id = null; if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearweb.php?r1=1.3&r2=1.4&diff_format=u Index: phd/themes/pear/pearweb.php diff -u phd/themes/pear/pearweb.php:1.3 phd/themes/pear/pearweb.php:1.4 --- phd/themes/pear/pearweb.php:1.3 Tue Oct 28 18:17:18 2008 +++ phd/themes/pear/pearweb.php Mon Nov 3 20:34:45 2008 @@ -34,10 +34,12 @@ } else { $filename = $id; } - $filename .= '.' . $this->ext; + $filename .= '.' . $this->ext; + + $contents = $this->cleanHtml(stream_get_contents($stream)); file_put_contents($this->outputdir . $filename, $this->header($id)); - file_put_contents($this->outputdir . $filename, $stream, FILE_APPEND); + file_put_contents($this->outputdir . $filename, $contents, FILE_APPEND); file_put_contents($this->outputdir . $filename, $this->footer($id), FILE_APPEND); v("Wrote %s", $this->outputdir . $filename, VERBOSE_CHUNK_WRITING);

« previous php.doc.cvs (#2368) next »