Page 1 of 1

BBCode - Linewrapping

Posted: Mon Jan 22, 2007 12:05 pm
by Jtb
Hi,

the following doesn't work correctly with the BBCode-Plugin:

{code}
Test
1
2
3
4
{/code}

(change { to [ and } to ] ;))

Result:

Code: Select all

Test 1 2 3 4
But should be

Code: Select all

Test
1
2
3
4

Solution: change css in serendipity_event_bbcode.php:

Code: Select all

.bb-code, .bb-php {
    font-family: courier, "courier new";
    background-color: #DDDDDD;
    padding: 10px;
    white-space:pre;
}
New is "white-space:pre;"

Re: BBCode - Linewrapping

Posted: Mon Jan 22, 2007 1:31 pm
by garvinhicking
Hi!

Great bugfix, many thanks. Just committed :)

Regards,
Garvin

Posted: Mon Jan 22, 2007 5:42 pm
by Jtb
mmh, BB-quote uses the same stylesheet..

I assume this is another bug because quote shouldn't have courier as font:
This isn't courier

Fix:

Code: Select all

207,208c207,208
<               '/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si'                                      => "<div class=\"bb-code-title\">QUOTE:<div class=\"bb-code\">\\1</div></div>",
<               '/(?<!\\\\)\[quote(?::\w+)?=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\](.*?)\[\/quote\]/si'   => "<div class=\"bb-code-title\">QUOTE \\1:<div class=\"bb-code\">\\2</div></div>",
---
>               '/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si'                                      => "<div class=\"bb-code-title\">QUOTE:<div class=\"bb-quote\">\\1</div></div>",
>               '/(?<!\\\\)\[quote(?::\w+)?=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\](.*?)\[\/quote\]/si'   => "<div class=\"bb-code-title\">QUOTE \\1:<div class=\"bb-quote\">\\2</div></div>",
271c271
< .bb-code, .bb-php, .bb-code-title, .bb-php-title {
---
> .bb-quote, .bb-code, .bb-php, .bb-code-title, .bb-php-title {
288a289,290
>     white-space:pre;
>     overflow:scroll;
289a292,297
>
> .bb-quote {
>     background-color: #DDDDDD;
>     padding: 10px;
> }
>

Posted: Tue Jan 23, 2007 9:24 am
by garvinhicking
Hi!

Hm, that patch doesn't apply to the latest bbcode plugin:

http://svn.berlios.de/wsvn/serendipity/ ... rev=0&sc=0

Could you make a diff again (-u preferred)?

HTH,
Garvin

Posted: Tue Jan 23, 2007 10:04 am
by Jtb
no problem - here it is:

Code: Select all

--- old.txt     2007-01-23 10:02:55.000000000 +0100
+++ new.txt     2007-01-23 10:05:16.000000000 +0100
@@ -204,8 +204,8 @@
               '/(?<!\\\\)\[img(?::\w+)?=([0-9]*?)x([0-9]*?)\]' . $pattern_url . '\[\/img(?::\w+)?\]/si'       => "<img width=\"\\1\" height=\"\\2\" src=\"\\3\" alt=\"\\3\" class=\"bb-image\" />",

               // [quote]
-              '/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si'                                      => "<div class=\"bb-code-title\">QUOTE:</div><div class=\"bb-code\">\\1</div>",
-              '/(?<!\\\\)\[quote(?::\w+)?=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\](.*?)\[\/quote\]/si'   => "<div class=\"bb-code-title\">QUOTE \\1:</div><div class=\"bb-code\">\\2</div>",
+              '/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si'                                      => "<div class=\"bb-code-title\">QUOTE:</div><div class=\"bb-quote\">\\1</div>",
+              '/(?<!\\\\)\[quote(?::\w+)?=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\](.*?)\[\/quote\]/si'   => "<div class=\"bb-code-title\">QUOTE \\1:</div><div class=\"bb-quote\">\\2</div>",

               // [list]
               '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\*(?::\w+)?\](.*?)(?=(?:\s*<br\s*\/?>\s*)?\[\*|(?:\s*<br\s*\/?>\s*)?\[\/?list)/si' => "\n<li class=\"bb-listitem\">\\1</li>",
@@ -268,7 +268,7 @@
                         return true;
                     }
 ?>
-.bb-code, .bb-php, .bb-code-title, .bb-php-title {
+.bb-quote .bb-code, .bb-php, .bb-code-title, .bb-php-title {
     margin-left: 20px;
     margin-right: 20px;
     color: black;
@@ -290,6 +290,12 @@
     overflow: auto;
     max-height: 24em;
 }
+
+.bb-quote {
+    background-color: #DDDDDD;
+    padding: 10px;
+}
+
 .bb-list-ordered-d {
     list-style-type: decimal;
 }

Posted: Tue Jan 23, 2007 10:17 am
by garvinhicking
Hi!

Very much appreciated, thanks & committed :)

Regards,
Garvin