Hi,

There's a problem in the way bbcode handles list.

For example: if I write:

[list]
[*]first element

[*]second element

Notice the line break between the two elements. This is because I want a line break.

Then for the second element, bbcode writes something like :

<p></li><li>second element

bbcode puts the (p) tag before the closing tag for the first element, and it returns an error...

Try to validate my page:
http://min.lledrith.info/?q=node/97

And you'll notice many xhtml errors, but I have not used special formatting, just image ones and this list one...

Thanks

Comments

naudefj’s picture

Are you using the latest CVS version? If not, please download the latest and re-test.

naudefj’s picture

Assigned: Unassigned » naudefj
Priority: Critical » Minor
Julien PHAM’s picture

I just did...
I downloaded the latest CVS, and I tried to create a page with the following code:

[list]
[*]first element

[*]second element
[/list]

And the html result is:

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

<p></li><li>second element
</li></ol></p>

Notice that the (p) tag is before the closing (/li) tag, which is not xhtml compliant. I think this is because bbcode closes (li) tags on a new line, just before the next (li) opening...

naudefj’s picture

Remove the open lines from your list. BBCode interprets it as you starting another paragraph.

Julien PHAM’s picture

Yes but... no ;)
Because I want a line break between the two elements... so you say it is impossible to have a line break between the two elements without coding it myself with [br] tags? I can do this but I'm sure end users will put line breaks inside the list... and I cannot verify all articles for such things...

Perhaps an idea would be to code bbcode to always use (br) tags instead of (p) tags? I think it could be a good idea because a line break is not always a new paragraph. Example: for now, if I write

[i]one line

another line[/i]

It does not work because bbcode creates two paragraphs... it will work if bbcode just puts (br) instead...

Perhaps then a setting where the admin can choose whether to use (p) or (br) for new lines.

And, correct me if I'm wrong, but if we put TWO line breaks, it does not work in bbcode, bbcode creates just one paragraph...

So really I think bbcode, at least as an option, should put (br) instead of (p).

naudefj’s picture

That is exactly what Drupal's "Line break converter" does. Just disable BBCode's "Smart paragraph and line breaks" and enable the "Line break converter".

Julien PHAM’s picture

No, I tried your solution, I even created a new format without bbcode and just with drupal's line break converter, and it still puts (p) and not (br) when I put two line breaks...

And moreover with drupal's line break converter, it puts the whole list inside a new paragraph... so no xhtml anymore...

naudefj’s picture

The latest version (CVS) now supports different line and paragraph break modes. Please download and test to see if it resolves your problem.

See http://drupal.org/cvs?commit=27222

Julien PHAM’s picture

Status: Active » Fixed

It seems it works fine, thanks... Now my articles pass xhtml validation...

Anonymous’s picture

Status: Fixed » Closed (fixed)