DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: How to keep the formatting

  1. #1
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    How to keep the formatting of the source we cut and paste here ??? its hard to read...........

  2. #2
    Join Date
    Jun 2000
    Posts
    417
    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">
    &lt;font face="courier"&gt;
    unindented code
    &amp;nbsp;&amp;nbsp;indented code one level
    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;indented code 2 levels
    unindented code
    &lt;/font&gt;
    </font>

    This will give you
    <font face="courier">
    unindented code
    &nbsp;&nbsp;indented code one level
    &nbsp;&nbsp;&nbsp;&nbsp;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 &amp;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]

  3. #3
    Join Date
    Jun 2000
    Posts
    417
    Actually on another note you could probably use the &lt;PRE&gt; 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 &lt;BR&gt; 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]

  4. #4
    Join Date
    Jun 2000
    Posts
    417
    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
  •  


Click Here to Expand Forum to Full Width