Messily, FCKeditor decides to put <p> tags around everything, so a quote comes out like this;

<p>[quote=andr&eacute;]</p>
<p>getting in the team may prove difficult if paul has entered as well!!!</p>
<p>[/quote]</p>

Obviously that means it doesn't display properly... I can't seem to come up with a foolproof way of correcting it without resorting to alter the modules code, does anyone have any ideas on this?

Thanks,

Pobster

CommentFileSizeAuthor
#9 quote.patch1.89 KBhypertext200

Comments

pobster’s picture

Status: Active » Needs review

If anyone is in the remotest bit interested in solving this problem, do this;

Add in at line 104;

    if (substr(trim($quote), 0, 3) == "<p>" && trim(substr(trim($quote), -4, 4) == "</p>")) {
      $quote = substr(trim($quote), 3, -4);
    }
//...rest of code, eg...
    // Add quoted text and preserve existing content (signature etc.).
    $form['comment_filter']['comment']['#default_value'] = '[quote='. $author .']'. $quote ."[/quote]\n". $form['comment_filter']['comment']['#default_value'];
    if (_quote_variable_get('subject_required')) {
      $form['subject']['#required'] = TRUE;
    }

It's not the best solution ever, but what it does is to strip away the <p> and </p> tags either side of the original node content/ comment. This means that the quote module outputs this;

<p>[quote=andr&eacute;]getting in the team may prove difficult if paul has entered as well!!![/quote]</p>

Rather than the above in the original post. That solves the problem.

Pobster

Zen’s picture

Status: Needs review » Closed (won't fix)

This is something the FCKeditor needs to handle, not this module.

Thanks.

pobster’s picture

I disagree, if it were down to FCKeditor then it'd have to 'learn' every filter and whether to strip out the paragraphs or not from it, that's infeasible? I don't think you understand the problem perhaps? When the text is output with the paragraphs in it the nice box which gets drawn around quotes only covers the very first line with [quote...] in it. The rest is just like normal text and hence looks awful? This isn't restricted to only FCKeditor either, it happens for all the rich text editors for Drupal 6.x I've tried so far?

Pobster

PPLandry’s picture

Try this one liner:

Replace
$form['comment_filter']['comment']['#default_value'] = '[quote='. $author .']'. trim($quote) ."[/quote]\n". $form['comment_filter']['comment']['#default_value'];

with
$form['comment_filter']['comment']['#default_value'] = '

[quote='. $author .']'. trim($quote) ."[/quote]

\n". $form['comment_filter']['comment']['#default_value'];

The trick is to simply enclose the quote in

so FCK does not mess with it

Tested on D5

PPLandry’s picture

Please ignore my last post. It worked only when clicking on the quote link. Here is a better solution, which works also when the [quote] is entered manually

function _quote_filter_process($text) {
// Thanks: function based on code from punbb.org
if (strstr($text, '[quote')) {
$pre = '

';
$post = '

';
$markup = $pre . t('Quote:') . $post;
$text = str_replace('[/quote]', '[/quote]

', $text);
$text = str_replace(array('[quote]', '[quote=]', '[/quote]'), array($markup, $markup, $post), $text);
$text = preg_replace('#\[quote=(?:"|\')?(.*?)["\']?(?:"|\')?\]#s', $pre . t('%name wrote:', array('%name' => '\\1')) . $post, $text);
}
return $text;
}
It is the same concept, making sure that the quote

is not closed until [/quote]

I disagree, that this is a FCKEditor issue. HTML doc says that all text must be enclosed by a P or a DIV tag, so FCKEditor is just following guidelines.

pobster’s picture

Status: Closed (won't fix) » Active

I also disagree that this is FCKeditors problem and so I'm reopening this issue for discussion.

Pobster

Zen’s picture

Status: Active » Closed (fixed)

Conversely, all filters will have to contend with the fact that fckeditor mistakes markup for text... all this module does is replace [quote] tags with HTML.. what other filters and modules do beyond this is out of this module's control and is left up to the site admin to play with filter orders etc. to get things right.

-K

Ralla’s picture

C/P from admin/settings/quote:

The quote filter allows users to quote other posts in their comments. Besides the following settings, the quote filter will need to be enabled for each input format (as required). Please make sure that the quote filter is arranged after any HTML filters and before the line break filter. For more information, please visit the project page.

That pretty much sums it up :)

hypertext200’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new1.89 KB

Apply this patch worked for me.

zyxifrash’s picture

As per #8, installed the quote module with FCKEditor live, enabled the quote filter in my Filtered HTML input format, everything worked perfectly out of the box - well, except the theming, had to override that to match my site. I checked the source, looked exactly as the original poster said, but it output just fine. Nothing needs to be patched.

BradM’s picture

Just confirming, if you set up the filter order as outlined in #8, no patching is needed. Works as expected out of the box. Using tinyMCE here with 5.x.

Zen’s picture

Status: Needs review » Closed (fixed)