cvs: php4 /pear/PEAR Common.php

From: Date: Sun, 26 May 2002 23:33:06 +0000
Subject: cvs: php4 /pear/PEAR Common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4117@lists.php.net to get a copy of this message
ssb Sun May 26 19:33:06 2002 EDT Modified files: /php4/pear/PEAR Common.php Log: * try being smart about de-indenting release notes from the xml Index: php4/pear/PEAR/Common.php diff -u php4/pear/PEAR/Common.php:1.63 php4/pear/PEAR/Common.php:1.64 --- php4/pear/PEAR/Common.php:1.63 Sun May 26 08:51:32 2002 +++ php4/pear/PEAR/Common.php Sun May 26 19:33:01 2002 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.63 2002/05/26 12:51:32 ssb Exp $ +// $Id: Common.php,v 1.64 2002/05/26 23:33:01 ssb Exp $ require_once 'PEAR.php'; require_once 'Archive/Tar.php'; @@ -488,6 +488,19 @@ } break; case 'notes': + // try to "de-indent" release notes in case someone + // has been over-indenting their xml ;-) + $data = preg_replace('/^[\r\n]+/', '', $this->cdata); + $indent_len = strspn($data, " \t"); + $indent = substr($data, 0, $indent_len); + $newdata = ''; + foreach (explode("\n", $data) as $line) { + print "indent_len=$indent_len\n"; + if (substr($line, 0, $indent_len) == $indent) { + $newdata .= substr($line, $indent_len) . "\n"; + } + } + $data = $newdata; if ($this->in_changelog) { $this->current_release['release_notes'] = $data; } else {

« previous php.pear.cvs (#4117) next »