Re: BBCodeParser (transition to Text_Wiki)
| From: | Seth Price | Date: | Sat, 15 Oct 2005 14:24:48 +0000 |
| Subject: | Re: BBCodeParser (transition to Text_Wiki) | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40211@lists.php.net to get a copy of this message | ||
You see, that was much more useful. Here is the patch for the new test case:
--- BBCodeParser.bak.phpt 2005-10-15 08:48:59.000000000 -0500+++ BBCodeParser.phpt 2005-10-15 09:11:52.000000000 -0500 @@ -60,6 +60,7 @@
$this->assertEquals('<ul><li>[xxx]txt[/xxx]</li></ul>', $bbc->$funcNam('[ulist][xxx]txt[/xxx][/ulist]'));
$this->assertEquals('<ul><li>txt</li></ul>', $bbc->$funcNam('[ulist][li]txt[/li][/ulist]'));
$this->assertEquals('<ul><li>txt</li><li>txt</li></ul>', $bbc->$funcNam('[ulist][li]txt[li]txt[/ulist]'));
+ $this->assertEquals("<ul>\n<li>txt</li><li>txt</li></ul>", $bbc->$funcNam("[ulist]\n[li]txt[li]txt[/ulist]"));
$this->assertEquals('<ul><li>txt</li></ul>', $bbc->$funcNam('[ulist][*]txt[/ulist]'));
$this->assertEquals('<ul><li><ol><li>txt</li></ol></li></ul>', $bbc->$funcNam('[ulist][*][list][*]txt[/ulist]'));
$this->assertEquals('<ol><li>txt</li></ol>', $bbc->$funcNam('[list][li]txt[/li][/list]'));
And here is the fix to HTML_BBCodeParser:
--- BBCodeParser.bak.php 2005-10-15 09:16:50.000000000 -0500 +++ BBCodeParser.php 2005-10-15 09:18:26.000000000 -0500@@ -429,7 +429,8 @@
$prevTag = end($newTagArray);
switch ($tag['type']) {
case 0:
- if(($child = $this->_childNeeded(end($openTags), 'text')) &&
+ if( trim($tag['text']) &&
+ ($child = $this->_childNeeded(end($openTags), 'text')) &&
$child !== false &&
/*
If someone could commit these changes, that would be great.
~Seth
On Oct 15, 2005, at 1:16 AM, bertrand Gugger wrote:
Hi Seth, input: [ulist] [*]unordered item 1 [*]unordered item 2 [/ulist] CVS version: ouput: <ul><li> </li><li>unordered item 1 </li><li>unordered item 2 </li></ul> # pear uninstall HTML_BBCodeParser uninstall ok: channel://pear.php.net/HTML_BBCodeParser-1.1 You have new mail in /var/spool/mail/root # pear install HTML_BBCodeParser downloading HTML_BBCodeParser-1.1.tgz ... Starting to download HTML_BBCodeParser-1.1.tgz (8,821 bytes) .....done: 8,821 bytes install ok: channel://pear.php.net/HTML_BBCodeParser-1.1 ouput: <ul> <li>unordered item 1 </li> <li>unordered item 2 </li> </ul> I don't care of your "test cases" I won't get sick again looking in such spaghetti code. à+ --bertrand "toggg" Gugger --PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php