Gossamer Forum
Quote Reply
[code]
Why does code in code tags display improperly, randomly?

eg.....

Code:
sub one {

print two();

}

sub two {

return 5;

}

That code above has a blank line between every line but after posting there are no blank line.

If you checkout this post with the same code, all blank lines but one are gone....

http://www.gossamer-threads.com/...view&post=170173

Am I doing something to cause it?

Quote Reply
Re: [PaulW] [code] In reply to
Check your blank lines. You need to make sure there's a space in there or it won't be interpreted as a blank line.

i.e.

Code:
make sure there's a blank line underneath this with a SPACE or some sort of character in there.

hmm. did that work?

Code:
now let's try that again with a blank line but no space or characters

does that still work?

As you can see from my example. That's the problem that's causing this.


- wil
Quote Reply
Re: [Wil] [code] In reply to
eh?

a space where?
Quote Reply
Re: [PaulW] [code] In reply to
When you put a a carriage return in, there are no characters on that line. If you put a space on that blank line, or a . or any character the system will interpret it as a blank line. If you just leave it without any characters on it, the system will chew up the blank line and not output it correctly.

You'll find this in a lot of places on the web. The most visually obvious way to overcome this is to put a period as the first character of any blank line, i.e.:

Code:
this is 1st line
.
second line after CR/period.
.
and again. now looks what happens when I CR but no period or no character
on that line?

this should be a new line but it won't be interpreted because the blank line
above does not have any characters on it. If I would of simply entered a space it would of interepted it.

Just like that one now.

Do you get what I'm trying to say?

- wil
Quote Reply
Re: [Wil] [code] In reply to
This seems to be an IE-specific bug. Mozilla and Netscape work correctly with <br>'s inside <pre> tags. I'll have to convert all blank lines to " "...

I hate browsers.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [jagerman] [code] In reply to
s,\w+$,reverse epacsteN,e+print,if$_='I hate browsers';

Last edited by:

PaulW: Nov 26, 2001, 3:43 PM
Quote Reply
Re: [jagerman] [code] In reply to
Yes, that should do the trick.

Hey, funny looking subject line? :-)

- wil