Hi,
The bbcode filter works quite fine, but I have a little issue with lists, when you imbricate several lists.

For example if you do:

[list]
[*]first element
[list]
[*]subelement
[/list]
[*]second element
[/list]

The html result is:

<ol class="bb-list" style="list-style-type:circle;"><li>first element<br />
<ol class="bb-list" style="list-style-type:circle;"><li>subelement<br />

</li></ol><br />
<li>second element<br />
</li></ol>

Notice there's a missing (/li) tag.

The correct xhtml formatting would have been:

<ol class="bb-list" style="list-style-type:circle;"><li>first element<br />
<ol class="bb-list" style="list-style-type:circle;"><li>subelement<br /></li></ol>
</li>
<li>second element<br /></li></ol>

Thanks

Comments

Julien PHAM’s picture

btw when we use [list] without any parameter, you should use (ul) tag instead of (ol) one, (ol) is for numbered lists.

naudefj’s picture

The use of (ol) instead of (ul) is intentional. Without it we cannot have nested [list] tags (unless we rewrite the entire engine to be non-regex based).

As workaround, some BBCode variants introduced a separate [ulist] tag.

Julien PHAM’s picture

Ok, this is not really a problem. But the first one about xhtml is a problem ;)
And a question: with ol you put a class with a list style type... so it is not possible to put several list indents with different style types ? Such as a round for the first level, a square for the second, ...

The circle type is setup directly into the bbcode filter? If we would like another style type I have to modify the bbcode one?

naudefj’s picture

> Such as a round for the first level, a square for the second, ...

How about this:

[list=c]
[*]x
[*][list=s]
   [*]x.1
   [*]x.2
   [/list]
[*]y
[*]z
[/list]

I'll look into the xhtml problem later.

naudefj’s picture

Assigned: Unassigned » naudefj
Status: Active » Fixed
Julien PHAM’s picture

Status: Fixed » Active

Mmmm still does not work, or I missed something, and I use the latest cvs version...

When I do :

[list=s]
[*]exposition par les producteurs et grossistes :
[list=s]
  [*]de produits agricoles,
  [*]de produits alimentaires,
  [*]des produits de l'horticulture,
[/list]
[*]présentation de matériels agricoles anciens,
[*]démonstrations sportives,
[*]dégustation de produits du terroir,
[*]présentation d'animaux de la ferme,
[*]activités hippiques,
[*]animations diverses, folklore régional,
[*]restauration,
[*]jeux pour enfants.

bbcode translates it as :

<ol class="bb-list" style="list-style-type:square;;"><li>exposition par les producteurs et grossistes :<br />
<ol class="bb-list" style="list-style-type:square;;"><li>de produits agricoles,<br />
  </li><li>de produits alimentaires,<br />
  </li><li>des produits de l&#039;horticulture,<br />
</li></ol><br />
<li>présentation de matériels agricoles anciens,<br />
</li><li>démonstrations sportives,<br />

</li><li>dégustation de produits du terroir,<br />
</li><li>présentation d&#039;animaux de la ferme,<br />
</li><li>activités hippiques,<br />
</li><li>animations diverses, folklore régional,<br />
</li><li>restauration,<br />
</li><li>jeux pour enfants.<br />
</li></ol><br />

I think the problem is with the two first lines, because we open a (li) tag, then we open a (ol) tag without closing the first (li) tag, this (li) tag is only closed after the (ol) one.

The problem is recurrent with bbcode and lists, and is cause by the fact that (li) tags are only closed on the beginning of the next line and not the end of the line itself.

We have to close the (li) tag before opening a new (ol) tag.

naudefj’s picture

This is what I get:

<ol class="bb-list" style="list-style-type:square;"><li>exposition par les producteurs et grossistes :<br />
<ol class="bb-list" style="list-style-type:square;"><li>de produits agricoles,<br />
  </li><li>de produits alimentaires,<br />
  </li><li>des produits de l'horticulture,<br />
</li></ol><br />

</li><li>présentation de matériels agricoles anciens,<br />
</li><li>démonstrations sportives,<br />
</li><li>dégustation de produits du terroir,<br />
</li><li>présentation d'animaux de la ferme,<br />
</li><li>activités hippiques,<br />
</li><li>animations diverses, folklore régional,<br />
</li><li>restauration,<br />
</li><li>jeux pour enfants.<br />
</li></ol>

Nothing wrong with the above output!

Julien PHAM’s picture

Sure there is something wrong, we should close the (li) with a (/li) "before" opening a new (ol) tag. Look at the first line, we do not close the (li) tag and we open a (ol) one.
And this kind of stuff returns xhtml error.

Try to validate the following page with xhtml (link at the bottom of the page) and you'll see what I mean:
http://min.lledrith.info/?q=node/103

naudefj’s picture

I've checked-in a patch that should solve the problem. Please download all files (not just the filter) and let me know how it goes.

Julien PHAM’s picture

Status: Active » Fixed

It seems it works, thanks

Anonymous’s picture

Status: Fixed » Closed (fixed)