-
How to keep the formatting of the source we cut and paste here ??? its hard to read...........
-
It takes a little bit of time, but I put it in fixed width font, courier is pretty standard, and replace spaces with nbsp, like this
<font face="courier">
<font face="courier">
unindented code
&nbsp;&nbsp;indented code one level
&nbsp;&nbsp;&nbsp;&nbsp;indented code 2 levels
unindented code
</font>
</font>
This will give you
<font face="courier">
unindented code
indented code one level
indented code two levels
unindented code
</font>
When I originally write the code I'm going to post I just use two spaces for indenting. Then I copy two &nbsp; to the clipboard, and go through and delete two spaces, paste, delete 2 spaces, paste, etc. Cuts down on the keystrokes.
It doesn't take more than a minute or so and improves the readability pretty well.
Just remember to preview first :)
[Edited by pwoneill on 01-11-2001 at 05:25 PM]
-
Actually on another note you could probably use the <PRE> tag of html. I think that adds extra newlines though which is why I don't use it, sometimes it looks worse than normal. Let's see
<pre>
int i=0;
for (i=0;i<10;i++) {
do_something();
}
</pre>
I made those all with only one line between them but because the bulletin board puts an extra <BR> after every line it puts two there.
It's harder to read the code with so much spacing so I don't do it that way.
Oh one other important note. After you preview, don't submit from there. Press Back on your browser and submit from the original page, otherwise it will get messed up.
[Edited by pwoneill on 01-11-2001 at 05:29 PM]
-
Actually this board has a CODE tag, let's see if it does the same thing with spacing as PRE does.
[CODE]
int i;
for(i=0;i<10;i++) {
do_something();
}
[/CODE]
Yeah it still adds spacing, plus the border around it so I wouldn't use that either :)
The first way requires the most extra typing, but gives the best formatting.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|