in reply to Re: Code that contains </code> (easy)
in thread Code that contains </code>

I don't want to change the actual content of the code just so that it displays ok in a Perl Monks writeup! Lets try <pre> tags instead of <code>...

#!/usr/bin/perl
use strict;
print "Put your code in <CODE></CODE> tags!\n";
OK that works, but you have to do something to the tags (at first I used <i></i>, then changed to &lt; at aristotle's suggestion).

Replies are listed 'Best First'.
Re^3: Code that contains </code> (easy)
by Aristotle (Chancellor) on Aug 06, 2003 at 14:35 UTC
    That's not even necessary. If you're using <pre>, you can just change one of the angle brackets to its entity name (like &lt;) and PM will obligingly look past the <code></code> tags. But using <pre> means your code/output will not be autowrapped, nor will it be easily downloadable, and you have to manually escape any PM approved HTML tags as well as any of your ampersands that look like entities.

    Makeshifts last the longest.

Re^3: Code that contains </code> (change)
by tye (Sage) on Aug 06, 2003 at 14:53 UTC

    You don't want to change the code so you prefer to change the < (in the code) to &lt;?? And how is this not changing the code? A smaller change would be to add a \ before the / or the >.

    And you aren't bothered that people can't download the code simply any longer? If you end up with even slightly long lines in your code, then others certainly will be bothered by you using PRE tags instead of CODE tags.

                    - tye
      You don't want to change the code so you prefer to change the < (in the code) to &lt;??
      I change the < to an &lt; in the PerlMonks writeup, so that the code displays in the browser as it would in an editor, which is very different to changing the actual perl code so that it didn't contain </code>, for instance, changing "</code>" to "</"."code>".
      And you aren't bothered that people can't download the code simply any longer?
      I am new here, so was unaware of the issues relating to code download.