Hi,
First, someone can explain me how works the intelligent paragraph breaks?
I have activated the integrated drupal new line break, and this intelligent paragraph break as well, and then there're some strange behaviour.

First, if I look at the html code, there're two <p> at the beginning of the article.
Second, there're many <p> tags inside the article. This is not a real problem, BUT when we create a list, bbcode should remove the <p> surrounding the list, as a list cannot be in a <p>.

So I think, what is needed :
1/ remove the first <p> and the last </p>, because there's no need to have the whole article surrounding by those tags.
2/ remove the <p> surrounding the lists.

I don't know how to do that, I'm not a regexp expert yet...

Comments

Julien PHAM’s picture

I don't know if this is really a bbcode issue, but I think the way bbcode works, it is in bbcode where it is the easier to change. Because usually with filtered html people do not use lists, except with bbcode, and this problems happens mostly with lists...

Julien PHAM’s picture

This is a bbcode issue, I tested without bbcode and I have not this issue.
http://drupal.org/node/51126

naudefj’s picture

Assigned: Unassigned » naudefj
Priority: Critical » Normal
Status: Active » Fixed

> 1/ remove the first <p> and the last </p>, because there's no need to have the whole article surrounding by those tags.

The first <p> is opening the first paragraph and the last <p> is closing the last paragraph.

> 2/ remove the <p> surrounding the lists.

Fixed in CVS - see http://cvs.drupal.org/viewcvs/drupal/contributions/modules/bbcode/bbcode...

Julien PHAM’s picture

I need to do some testing, but until now (I haven't tested last cvs yet):

imagine we have two paragraphs, with the text : paragraph1 for the first, and the text paragraph2 for the second.

bbcode created a code like this:

<p><p>paragraph1</p><p>paragraph2</p></p>

I think it is nonsense to enclose the whole article into a paragraph by itself, because a text is not always a paragraph.

Julien PHAM’s picture

Still does not work.
Look, I'll give you two examples (with the 1.21 version of bbcode).

I'm doing something like:

  • ligne 1
  • ligne 2

BBcode gives me a code like this:

<p><p><ul class="bb-list"><li>ligne 1<br />
</li><li>ligne 2<br />

</li></ul></p>
</p>

Which is not xhtml compliant because the (ul) tag is enclosed into a (p) tag.

Without bbcode, drupal gives me a code like this:

<ul>
<li>ligne 1</li>
<li>ligne 2

</ul>

Which is easier, and which is xhtml compliant.

It is really nonsense to enclose the whole article into a (p) tag, and really, there shouldn't be (p) tags surrounding the (ul) one.

naudefj’s picture

> I think it is nonsense to enclose the whole article into a paragraph by itself, because a text is not always a paragraph.

If you can show me the BBCode lines that causes this I fix it immediately!
I think something else is putting that in - maybe your template or another filter.

> Still does not work.

It's working for me! Have you applied the patch?
Do you have any other filters enabled? If so, disbale them and test again.

Julien PHAM’s picture

mmmm... the only other filter I have is the integrated drupal filter which will goes to the line automatically. Should I have this one enabled or disabled?

I have activated this one and the bbcode intelligent paragraph breaking.

And I have setup html filter to escape all tags.

What should I put on and off to make it work?

Until then, I have still modified the .inc file this way, by adding some lines at the end :

    '#<p><p>#si'                            => '<p>',
    '#<\/p>\n<\/p>#si'                      => '</p>',

    '#<p>(?:.*?)<ol(.*?)>#si'               => '<ol\\1>',
    '#<\/ol(.*?)>(?:.*?)<\/p>#si'           => '</ol\\1>',

    '#<p>(?:.*?)<ul(.*?)>#si'               => '<ul\\1>',
    '#<\/ul(.*?)>(?:.*?)<\/p>#si'           => '</ul\\1>',

This way I remove double (p) and (/p) tags, and I remove the (p) before the (ul) and (ol), and the (/p) after...

naudefj’s picture

Yes, please disable it, remove your code and test again.

Julien PHAM’s picture

I did... it works, thanks ;)

Julien PHAM’s picture

Status: Fixed » Active

Now there's another bug which goes with this issue.
So I disabled the drupal new line break.

But now, except for paragraphs, there is no line break, you see what I mean?

If, in my article, I skip two lines, then bbcode puts me (p) code, that's fine.

But if I just go to the line, bbcode should put the (br /) tag, but it does not.

naudefj’s picture

Yes, I'm aware of this problem. As workaround, we've added a [br] tag. However, we still need to find a better way of dealing with this.

Julien PHAM’s picture

That is why I had activated the drupal line break, but it is not compatible with bbcode it seems. What is exactly the issue? You succeeded in replacing two line breaks by a (p) tag, but not just one line break?

Perhaps you should look at the way drupal handles this. For now I have no idea on how to do this either...

Julien PHAM’s picture

The problem with the [br] tag is that when you'll find the issue to change new lines to (br /), then the br tag added with your issue will create too many line breaks :) So I hope we'll find a way to deal with it before my site goes into production ;)

naudefj’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)