PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_BBCodeParser » Bug #512

[list] in a [list] breaks the first [list]

Details

Submitted2004-01-03 17:40 UTC
Frommarduk at k-d-w dot org
Assignedquipo
StatusClosed
PackageHTML_BBCodeParser
PHP Version4.3.4
OSWindows XP
Roadmaps(Not assigned)

Comments

[2004-01-03 17:40 UTC] marduk at k-d-w dot org

Description:
------------
If you try to write a [list] into another [list] the level one list is broken

Reproduce code:
---------------
[list]
[*] Subject 1
[list]
[*] First
[*] Second
[/list]
[*] Subject 2
[/list]

Expected result:
----------------
<ul>
<li> Subject 1
</li>
<ul>
<li> First
</li>
<li> Second
</li>
</ul>
<li> Subject 2
</li>
</ul>

Actual result:
--------------
<ul>
<li> Subject 1
</li>
[list]
<li> First
</li>
<li> Second
</li>
</ul>
<li> Subject 2
</li>

[2004-01-11 10:33 UTC] sjr at php dot net

Try using the [li] and [/li] tags instead of the [*] shorthand.

Input code:
-------------
[list]
[li] Subject 1
[list]
[li] First[/li]
[li] Second[/li]
[/list][/li]
[li] Subject 2[/li]
[/list]

Actual output code:
-------------
<ul>
<li> Subject 1
<ol>
<li> First</li>
<li> Second</li>
</ol></li>
<li> Subject 2</li>
</ul>

Expected output code:
-------------
<ul>
<li> Subject 1
<ul>
<li> First</li>
<li> Second</li>
</ul></li>
<li> Subject 2</li>
</ul>

As you see, this still isn't completely ok. The [list] tag without a type parameter (like 1, a, A), should be replaced by an [ulist] tag by a regexp.

[2004-01-11 10:39 UTC] sjr at php dot net

The problem with using the [*] shorthand is, that everything following it until there's a newline, is replaced by a regexp with [li]\\1[/li].
By design, the only tag allowed within <ul> and <ol> is <li>. So the second [list] tag isn't allowed, and won't be parsed.