The paragraph tag may not contain any block-level tags.

The following BBCode renders a <pre> in a <p>:

The code
[code]
code line 1
code line 2
[/code]
is an example...

Comments

jpetso’s picture

I found that this is the same with [list][*][/list] and [hr], both may not appear inside a

tag. (Maybe there are more of those tags still?)
A workaround is to have spacing between the paragraphs, like

Things I did today:

[list]
[*]nothing
[/list]

So what?

But that can't be the proper solution, obviously, as it depends on the user's knowledge. I would assume that solving this may be a bit difficult, as it involves playing together with Drupal's builtin linebreak filter.

jpetso’s picture

Still, it seems that _appending_ something to those tags doesn't make a real difference validator-wise... so

This is a paragraph inside a <p> tag.

[hr]
This is a non-paragraph line following a simple <br/> linebreak.

is still valid (even if

tags are not used for the hr/text combination then).
Not that it makes for cleaner HTML, but it's still valid.

naudefj’s picture

Priority: Normal » Minor
Status: Active » Closed (works as designed)

Try so set "Smart paragraph and line breaks:" to "Line breaks only".

Standart’s picture

Title: Paragraph (<p>) contains block-level tag <pre> » Invalid nesting of block-level elements if "smart paragraph and line breaks" is turned on
Priority: Minor » Normal
Status: Closed (works as designed) » Active

The way this module handles "smart paragraph and line breaks" is buggy. I consider it a bug if an input filter renders invalid XHTML.

I added the line break converter included in Drupal core to the processing chain after BBCode and it works beautifully (renders valid XHTML including the handling of <pre> and everything).

Why does the BBCode module provide this functionality anyway? In the sense of Drupal's modularity I would suggest to completely remove this feature and advise the users to use Drupal's line break converter instead.

naudefj’s picture

Priority: Normal » Minor
Status: Active » Closed (works as designed)

Are you using Drupal's line break converter or the BBCode module's line break converter?

PS: Many sites prefer the paragraph breaks. So, we cannot simply remove it. It would be great however, if you can supply patches to "fix" the so-called "bugs".

Standart’s picture

Priority: Minor » Normal
Status: Closed (works as designed) » Active

The BBCode module feature "smart paragraph and line breaks" produces invalid XHTML code. If you turn it off and use Drupal's line break converter you get valid XHTML. This is a bug because the task of an input filter is to produce valid XHTML code.

So why does the BBCode module provide this functionality, anyway?

I'd not suggest to backport the removal to 4.7. BTW, why don't you publish a 4.7.x-1.x version of the module. If bigger changes were made then, a 4.7.x-2.x would tell users about that. I don't get the point in "Many sites prefer the paragraph breaks". As I sad they could use Drupal's perfectly working filter.

I'd be happy to provide a patch removing the line break feature of the BBCode module and adding a hint to the help functions. But I won't if you're reluctant to accept this change anyway.

naudefj’s picture

Priority: Normal » Minor
Status: Active » Closed (works as designed)

Different people require different functionality. That's why there are three options:

- BBCode Smart paragraph and line breaks
- BBCode Line Break converter
- Disable and use whatever you like (your choice).

All three options behave differently. I will see if I can include some documentation about these options in a future release.

If you don't agree with this, you are welcome to provide an alternative BBCode implementation.

Standart’s picture

Priority: Minor » Normal
Status: Closed (works as designed) » Active

I'm totally fine with deactivating the "smart" paragraphs, using Drupal's same functionality. So this is not about satisfying me personally. I still don't see why the BBCode module provides a broken feature that is provided by Drupal core perfectly. As I understand the Drupal module architecture, especially input filters, we, as a community, should provide modules providing a single feature - in this case converting BBCode-style tags into valid XHTML.

Still this is a bug and not by design. How could the core module (filter.module) provide this feature in a valid way if it were?

I understand the existing choices and I don't think extending the documentation is necessary. I can imagine administrators requiring the breaks-only feature as people using BBCode may need a typewriter kind-of behaviour. Anyway, this is not the case with the paragraph feature.

I don't see how it helps anyone if I write my own module (in fact forking the existing one) and publish it as BBCode2 or something. Let's work on the existing one to get better. I'm open for any discussion. However, I don't feel you are.

naudefj’s picture

Priority: Normal » Minor
Status: Active » Closed (works as designed)

Not all users care about XHTML (hardly a bug!). If you want XHTML, go option (2) or (3). However, (3) doesn't work well with [code] tags. Etc, etc... So, this is by design. All that is short is maybe a bit more documentation explaining these options.

In fact, I got sick of person A wanting page breaks, B wants double-line breaks and C wants nothing (like yourself). At this moment we can please everyone, and there is no way we are going back. If we can make (1) more XHTML friendly, then that is the route to take.

Standart’s picture

Priority: Minor » Normal
Status: Closed (works as designed) » Active

Not all users care about XHTML (hardly a bug!).

Needless to comment on that.

However, (3) doesn't work well with [code] tags.

Turning "smart paragraphs" off and using Drupal's built-in filter works perfectly with [code] tags and renders valid XHTML.

In fact, I got sick of person A wanting page breaks, B wants double-line breaks and C wants nothing (like yourself).

I understand that. But you still didn't tell me why there's a feature implemented which exists in Drupal core. The only reason could be, that it is implemented better. It's not! Why not concentrate on the important features of this module? Who wanted the paragraph feature and why?

If you didn't "close" this issue all the time claiming it were by design, others would give their two cents, too, as it should be in an open source community. IMO "by design" doesn't mean, that it's part of the current design. It means that it's absolutely impossible to change the discussed point as long as you want to use the existing code as a base.

naudefj’s picture

Priority: Normal » Minor
Status: Active » Closed (works as designed)

I don't have time for this. Why don't you load bbcode-test.txt into a node, test with all provided options, study the output, and setup a comparison chart. After that, we can continue our discussion, hell maybe even implement some of your (then informed) suggestions.

Standart’s picture

Status: Closed (works as designed) » Active

Ok.

So if you think testing is necessary (I agree) and implementing the results is an option (I welcome that) please leave this active, as it is.

"I don't have time for this" != by design

jpetso’s picture

I just wanted to say that I agree with Standart's point of view. Since Drupal 5 uses XHTML Strict by default, any slight non-compliance causes the W3C validator to fail for this site (which is at least important for some of the users, even if not for all) and risks the site being rendered incorrectly, when the browser interprets XHTML Strict as strict as they should.

So this is a bug, and just because you don't care about XHTML compliance doesn't mean it isn't important.

If I find time, I'll try to look into this issue code-wise.

naudefj’s picture

Status: Active » Postponed

This is a feature, not a bug. If you don't like it, you can simply switch it off in the BBCode settings page.

Anyway, well tested patches are always welcome.

naudefj’s picture

Status: Postponed » Closed (duplicate)

Close as a duplicate of http://drupal.org/node/206642