Is it possible to have 'less space' in quotes?

Started by Dwev, March 28, 2018, 09:49:10 AM

Previous topic - Next topic

Dwev

If someone quotes someone else on our SMF forum the code is as follows:

[quote]
Quoted text
[/quote]


I would like to get rid of the two line breaks in there, so it would become as follows:

[quote]Quoted text[/quote]

Can someone point me to where (and how) in the PHP-files this can be done?

Possibly on the same subject: I see this happening a lot with other bbcode on our forum as well, maybe this is all related and regulated by the same PHP-file?

GL700Wing

Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Dwev

I had seen this Tip, but if I'm right this applies only to extra returns at the end of a message?

Or am I wrong?

GL700Wing

Quote from: Dwev on March 28, 2018, 03:07:25 PM
I had seen this Tip, but if I'm right this applies only to extra returns at the end of a message?

Or am I wrong?

One of the code blocks does the following : "Remove leading/trailing line breaks within quoted messages."
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Dwev

Now I'm not sure in which thread I should continue, but since this is the newest one I'll do it here:

So I went to Sources/Subs-Post.php and searched for:

// Put it back together!
if (!$previewing)
$message = strtr(implode('', $parts), array('  ' => '&nbsp; ', "\n" => '<br />', $context['utf8'] ? "\xC2\xA0" : "\xA0" => '&nbsp;'));
else


And replaced it with the following:

// Put it back together!
if (!$previewing)
{
$message = strtr(implode('', $parts), array('  ' => '&nbsp; ', "\n" => '<br />', $context['utf8'] ? "\xC2\xA0" : "\xA0" => '&nbsp;'));

$breakFrom = "<br\s*?/?>";
$breakTo = "<br />";

// Replace two or more line breaks anywhere in the message with two line breaks.
$message = preg_replace('~(' . $breakFrom . $breakFrom . ')+~sim', $breakTo . $breakTo, $message);

// Remove leading/trailing line breaks from messages.
$message = preg_replace('~^(' . $breakFrom . ')+~sim', '', $message);
$message = preg_replace('~(' . $breakFrom . ')+$~sim', '', $message);

// Remove leading/trailing line breaks around quoted messages.
$message = preg_replace('~(' . $breakFrom . ')+\[quote~sim', $breakTo . '[quote', $message);
$message = preg_replace('~\[/quote\](' . $breakFrom . ')+~sim', '[/quote]' . $breakTo, $message);

// Remove leading/trailing line breaks within quoted messages.
$message = preg_replace('~\[quote(.*?)\](' . $breakFrom . ')+~sim', '[quote$1]' . $breakTo, $message);
$message = preg_replace('~(' . $breakFrom . ')+\[/quote\]~sim', $breakTo . '[/quote]', $message);
}
else


But I don't see any difference, quotes are still in the following format:

[quote]
Quoted text
[/quote]


So still line breaks around them.

Hope you'll bear with me, because I don't know much about PHP (and that's a understatement...  ;)).

GL700Wing

Change:
// Remove leading/trailing line breaks within quoted messages.
$message = preg_replace('~\[quote(.*?)\](' . $breakFrom . ')+~sim', '[quote$1]' . $breakTo, $message);
$message = preg_replace('~(' . $breakFrom . ')+\[/quote\]~sim', $breakTo . '[/quote]', $message);


To:
// Remove leading/trailing line breaks within quoted messages.
$message = preg_replace('~\[quote(.*?)\](' . $breakFrom . ')+~sim', '[quote$1]', $message);
$message = preg_replace('~(' . $breakFrom . ')+\[/quote\]~sim', '[/quote]', $message);


Note:  You wont be able to see the effect you want until after the message has been posted but if you then modify it you'll see that the extra line breaks have been removed.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Dwev

@ GL700Wing: first an apology, after trying the previous code I tested for spaces inside quotes, and I didn't see a difference.

Not long after I realised that it did have an effect: it was removing the line breaks outside of quotes.

Now about the new code you posted: so I first applied the previous code, and next I applied the code you gave last.

But the effect was still the same, I'm sorry to say:

[quote]
Quoted text
[/quote]

GL700Wing

Quote from: Dwev on March 29, 2018, 05:23:07 AM
@ GL700Wing: first an apology, after trying the previous code I tested for spaces inside quotes, and I didn't see a difference.

Not long after I realised that it did have an effect: it was removing the line breaks outside of quotes.

Now about the new code you posted: so I first applied the previous code, and next I applied the code you gave last.

But the effect was still the same, I'm sorry to say:

[quote]
Quoted text
[/quote]


The removal of the internal line breaks won't apply until the post is saved - have you saved the post and then clicked on either Modify or Quote to see what it looks like?

Just curious as to why you want to remove these line breaks anyway ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Kindred

You do realize that this

[quote]
test
[/quote]


and this
[quote]test[/quote]


have the EXACT SAME display result?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GL700Wing

Quote from: Kindred on March 29, 2018, 07:01:37 AM
You do realize that this

[quote]
test
[/quote]


and this
[quote]test[/quote]


have the EXACT SAME display result?
I do but I'm not sure the OP does ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Dwev

#10
Quote from: GL700Wing on March 29, 2018, 05:36:48 AMThe removal of the internal line breaks won't apply until the post is saved - have you saved the post and then clicked on either Modify or Quote to see what it looks like?

Stupid me, I didn't.
I'l start over.

QuoteJust curious as to why you want to remove these line breaks anyway ...

Getting rid of line breaks makes the text with codes much easier to edit, more oversight.
Which makes life a lot easier for the different correctors on our forum, and I'm hoping that users got more oversight as well.
(maybe even resulting in better formatted messages, I know, one can dream...  ;)).

Kindred

really?   I disagree.

When editing, I find it much easier to have the code breaks (or, in this case quote breaks) to be on separate lines
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Dwev

In the end the argument from Kindred made me change my mind, and I kept the original settings.

Advertisement: