Forum Problem with <code> Tag

4 replies [Last post]
Offline
Last seen: 27 weeks 2 days ago
Joined: 09/29/2011
Posts:

I used the following text in another post, and it seemed to close my "code" tag prematurely, leaving the second chunk in a regular non-code font/style. (I have replaced each of the code tag's angle brackets with square brackets so they are not parsed out by the editor.)

[code]
int a = 5;
int b = 6;

// Commence the swapping!
a = a + b; // a will now equal 11, b will stay at 6
b = a - b; // a stays at 11, b becomes 5
a = a - b; // a now equals 6, b stays at 5
[/code]

piwh1000's picture
Offline
Last seen: 7 hours 14 min ago
Joined: 02/15/2008
Posts:
Hey our forums currently

Hey our forums currently don't support the code function. But they definitely should. Will add this on our list of things to do.

Developer - Compilr.com

tim.speed's picture
Offline
Last seen: 17 hours 27 min ago
Joined: 02/24/2010
Posts:
echo "test";

use < and > around code instead of [ and ]


echo "test";

-----------------
Tim Speed
Compilr Developer and CTO

Offline
Last seen: 27 weeks 2 days ago
Joined: 09/29/2011
Posts:
Post HTML tags, cont.

Mssr Speed:
I imagine you looked at my example and not my explanation, yes?
One line works, two lines separated by a space does not:
--------------
<code>echo "test";

echo "test 2";</code>
--------------
becomes...
--------------
echo "test";

echo "test 2";
--------------
i.e. Certain whitespace breaks the <code> tag.

Mssr Hankinson:
Hrmm...if it's busted, would it be better to remove <code> from the "Allowed HTML tags" list? I wonder if the others break in the same way.
Here is Google link that

should span multiple lines

Seems your parser regards a blank line as a break in the current tag/phrase. Multiple lines in a row with no blank lines in between have no problems, however.

tim.speed's picture
Offline
Last seen: 17 hours 27 min ago
Joined: 02/24/2010
Posts:
Sorry I tend to skim over

Sorry I tend to skim over things too quickly sometimes, we will add this to our to-do list I'd like to add code tags with full syntax highlighting.

-----------------
Tim Speed
Compilr Developer and CTO