OK, I'm new to Perlmonks so go easy on me ;)

I've posted a few questions to date and have had problems with the formatting of my code using the CODE tags

My scripts have been written in Vi and then pasted in between CODE tags. The appearance of the script once posted to perlmonks is very spaced out, see Glob problem question for example.

How can I stop this happening

Replies are listed 'Best First'.
Re: Problem with CODE tags
by mirod (Canon) on Aug 21, 2001 at 15:58 UTC

    Do you use Opera to post? It tends to add newlines after each line I write. What happens is that the code looks good when I preview it, but then newlines are added, that look like spaces in the preview (hence the preview looks fine). Then when I actually post the node the newlnes appear. If I edit the code some more newlines are added...

    What I do then is I just write the text part of the node, preview it, then add the code just before submitting. If I need to edit the node later either I remove the spaces at the end of each line (for short snippets of code) or I just delete the code from the node and replace it with the one I keep in my text editor.

      I use Opera too and I get the same problem. When you submit, Opera seems to add a ^M to the end of each \n, so the problem actually gets worse and worse every time you preview (double the newlines every time). You can actually delete the extraneous ^Ms cos although you can't see them, they're on the end of every line, so if you go to the end of the line and get rid of any whitespace you shouldn't see this problem.
        Unfortunately, I have been having this problem ever since I began using Opera, and tried to post code snippets througout various questions. Like what was said earlier, I have found that adding in the code after previewing tends to be faster than having to manually deleting every extra new line, especially if you have a very long question :-).

        Aside from that, the first I saw that there was something wrong with my code, it was funny, because each time I previewed it, it kept growing more spaced, and more spaced, and more spaced... it was funny, but you'd have to have been there.

        Andy Summers
      I have been using Opera and that's exactly the problem I've been experiencing!

      Thanks for the advice.

Re: Problem with CODE tags
by Masem (Monsignor) on Aug 21, 2001 at 18:27 UTC
    I'll point out that I edited the node in question as there were (from my WinXX POV) two unprintable characters at the end of each line. As others have mentioned, it's probably from a bad cut&paste.

    -----------------------------------------------------
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
    It's not what you know, but knowing how to find it if you don't know that's important