Phorum / Core

The core of Phorum
http://www.phorum.org
68 stars 32 forks source link

Quote tag removes newline after first line #612

Closed Phorum closed 13 years ago

Phorum commented 13 years ago

When quoting, bbcode module doesn't insert newline after [quote]: {{{ [quote $author]$data[1][/quote] }}}

But phorum_format_messages() removing newline after first line: {{{ pregreplace("/\s(<\/(xmp|blockquote|pre).?>)\s_\Q$phorum_br\E/" ...) }}} Because of this it is removing first newline of quoted message.

I'm suggesting to insert more newlines when quoting: {{{ [quote $author]\n$data[1]\n[/quote] }}}

And in phorum_formatmessages() add $ to end of that regular expression to make it remove newline only after [quote]: {{{ /\s(<\/(xmp|blockquote|pre).?>)\s_\Q$phorum_br\E$/ }}}

Reported by: Alexey Torkhov atorkhov@gmail.com Imported from TRAC: http://trac.phorum.org/ticket/712

Phorum commented 13 years ago

People can add [quote] blocks themselves too. There is no guarantee that there will always be a newline after the [quote] block.

Can you give me an exact use case where the current method goes wrong? I tried several quote formats and to me, they all seem correct in the formatted output. If I know what behavior is buggy, I can come up with a fix, but currently I simply don't understand what problem case you are running into.

I'll put the ticket to "wontfix" for now. Feel free to reopen it if you have a problem case description for me.

By: mmakaay

Phorum commented 13 years ago

Yes, I sure had to add test case. The problem is in text: {{{ [quote]Hi!

Text...text[/quote] }}} it shows without empty line after "Hi!".

By: Alexey Torkhov atorkhov@gmail.com

Phorum commented 13 years ago

Fixed in [3197].

By: mmakaay

Phorum commented 13 years ago

I checked - looks like this changeset don't fixing this issue.

By: Alexey Torkhov atorkhov@gmail.com

Phorum commented 13 years ago

I did another small change. This is about the best that we can do with the current bbcode handling. I am already working on a new bbcode parser which is tokenizer based, so we can really process the contents instead of running regular expressions on the bodies. With that code, it will a lot easier to handle things like this more consistently.

By: mmakaay

Phorum commented 13 years ago

Ok, thanks. Yes, new bbcode parser would be great.

By: Alexey Torkhov atorkhov@gmail.com