The BBCode:

[quote]This quote

contains

paragraph breaks.[/quote]

produces the HTML:

<div class="content">
  <p>
    <div class="bb-quote">
      Quote:<blockquote class="bb-quote-body">This quote</blockquote>
    </div>
  </p>

  <p>contains</p>

  <p>paragraph breaks.</p>
</div>

(HTML indentation re-done manually to make the issue more clear.)

The div.bb-quote should affect the entire quote rather than only the first paragraph. Presumably, this calls for putting the three paragraphs inside the div and blockquote tags rather than the div/blockquote being placed inside the first paragraph.

Comments

reikiman’s picture

I'm seeing the same bug as reported by one of my users: http://visforvoltage.org/forum/6374-quotations-are-all-buggered

reikiman’s picture

FWIW I have both the quote module & bbcode enabled. Both of them do [quote] processing.

I took a look at my input filters and have found a fix.

First, putting the quote filter before bbcode filter made the situation worse.

Second, I noticed I have the HTML Corrector filter installed. Turning that filter off in input formats corrected the problem. Hence it appears the HTML Corrector interferes causing the problem.

Dave Sherohman’s picture

I have confirmed that this problem is masked by disabling the HTML corrector. The example BBCode markup given in the original report now produces the HTML output:

<div class="content">
  <p>
    <div class="bb-quote">Quote:
      <blockquote class="bb-quote-body">This quote
  </p>

  <p>contains</p>

  <p>paragraph breaks.
      </blockquote>
    </div>
  </p>

(Again, manually reformatted to clarify structure.)

Given that this markup is not correctly nested, I would argue that this is a bug in the BBCode module and should be fixed by moving the opening and closing paragraph tags inside of the div.bb-quote and blockquote, as hypothesized in the original bug report.

Dave Sherohman’s picture

It appears that the nesting comes up correctly (and to HTML Corrector's satisfaction) by changing lines 183-186 of bbcode-filter.inc to:

    // Quoting with or without specifying the source
    '#\[quote(?::\w+)?\]#i'                                    => '</p><div class="bb-quote">'.$quote_text.'<blockquote class="bb-quote-body"><p>',
    '#\[quote=(?:&quot;|"|\')?(.*?)["\']?(?:&quot;|"|\')?\]#i' => '</p><div class="bb-quote"><b>'.$quote_user.'</b><blockquote class="bb-quote-body"><p>',
    '#\[/quote(?::\w+)?\]#si'                                  => '</p></blockquote></div><p>',

It's basically just adding a </p> at the start and a <p> at the end of each line's output string.

This does have the minor drawback of producing empty <p></p> pairs before and after each quote block, but at least the HTML is now properly nested and will display properly with HTML Corrector active.

While it may not be the optimal solution, this change resolves the issue at hand.