This may be obvious to more seasoned monks, so my apologies if this bores your socks off, but I had a small learning experience today that inspired me to write a few lines. As a relatively new monk I have tried to be careful to observe customs and conventions of the monestary when I post. Chief among these is the use of code tags. Imagine my surprise when a response I posted to a SoPW was subsequently considered for lack of code tags.

I was flummoxed until ikegami helpfully pointed out that the long regex would not wrap inside the code tags without a newline. Although I was sure I had included at least one newline, I went back and made certain that newlines preceded and followed the oneliner regex.

What I learned is that wrapping does not happen if the only newline between code tags immediately preceds the close code tag.
In other words, this won't wrap:

<code>really-long-regular-expression
[newline]</code>

but this will:

<code>[newline]
really-long-regular-expression</code>

On a side note, as evidenced by the consideration, it seems that monks abhor unwrapped text in much the same way that nature abhors a vacuum.

Replies are listed 'Best First'.
Re: Newline in code tags observation
by polettix (Vicar) on Mar 06, 2006 at 15:52 UTC
    This basically lets you have inline code without the need of a look-ahead. Just a suggestion: did you know that you can use <c> instead of <code>?

    Update: course you know, otherwise how could you write the examples?

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
      Thank you for the reply and the helpful suggestion.

      Indeed, I learned about <c> tags when I was working through the wrapping issue, but ended up using <code> for the snippets in the root node because it seemed a clearer way to illustrate the point. In fact, I used <c> around the <code> tags in the original node.
      Hey, I just used <c> again writing that last sentence.
      Hey, I just used <c> again writing that last sentence.
      Hey, I...