sourcecode tag stripping </tr> and reading <br>

  • Unknown's avatar

    I am trying to post some perl sourcecode , and since there is no perl support, i am using php, when trying to post this code, the
    gets read into a break instead of displaying
    and some of the </tr> tags are gone. Any ideas?

    #!/usr/bin/perl -w
    use CGI qw(:standard);
    use CGI::Carp qw(fatalsToBrowser);
    print “Content-type:text/htmlnn”;
    @colors = qw(00 33 66 99 CC FF);

    foreach (@colors) {
    $number++;
    }
    $number = ($number – 1);
    print “<h1>Web Safe Colors</h1> n”;
    for ($i=0; $i<=$number; $i++) {
    print “<table cellpadding=’2′ cellspacing=’1′ border=’0′ bgcolor=’#000000′> n”;
    for ($j=0; $j<=$number; $j++) {
    print “<tr> n”;
    for ($k=0; $k<=$number; $k++) {
    if ($colors[$j] eq “00”) {
    $textcolor = “#FFFFFF”;
    } elsif ($colors[$j] eq “33”) {
    $textcolor = “#FFFFFF”;
    } elsif ($colors[$j] eq “66”) {
    $textcolor = “#FFFFFF”;
    } else {
    $textcolor = “#000000”;
    }
    print “<td bgcolor=’#$colors[$i]$colors[$j]$colors[$k]’ width=’100′ align=’center’>”.
    “<font color=’$textcolor’><b>#$colors[$i]$colors[$j]$colors[$k]</b></font></td> n”;
    }
    print “</tr> n”;
    }
    print “</table> n
    n”;
    }

  • Unknown's avatar

    Use the

     tags:<pre>put the code here</pre>
  • Unknown's avatar

    I’m using the [sourcecode language = 'php']
    [/sourcecode]

    tags and it’s still stripping tags between them

  • Unknown's avatar

    Using the

    
    

    tags allows the entire chunk of code to be displayed correctly, but then there is no syntax highlighting or anything. Kind of bunk.

    So, here is the code i’m trying to post on my blog.

    #!/usr/bin/perl -w
    use CGI qw(:standard);
    use CGI::Carp qw(fatalsToBrowser);
    print "Content-type:text/htmlnn";
    @colors = qw(00 33 66 99 CC FF);
    
    foreach (@colors) {
        $number++;
    }
    $number = ($number - 1);
    print "<h1>Web Safe Colors</h1>";
    for ($i=0; $i<=$number; $i++) {
        print "<table cellpadding='2' cellspacing='1' border='0' bgcolor='#000000'>";
        for ($j=0; $j<=$number; $j++) {
            print "<tr>  n";
            for ($k=0; $k<=$number; $k++) {
                if ($colors[$j] eq "00") {
                    $textcolor = "#FFFFFF";
                } elsif ($colors[$j] eq "33") {
                    $textcolor = "#FFFFFF";
                } elsif ($colors[$j] eq "66") {
                    $textcolor = "#FFFFFF";
                } else {
                    $textcolor = "#000000";
                }
                print "<td bgcolor='#$colors[$i]$colors[$j]$colors[$k]' width='100' align='center'>".
                "<font color='$textcolor'><b>#$colors[$i]$colors[$j]$colors[$k]</b></font></td>";
            }
            print "</tr>";
        }
        print "</table>";
    }
    

    and wordpress is stripping the </td>, </tr>, </table> and the
    tags.

  • Unknown's avatar

    Here is an example of the issue, i have the code displayed once using the pre tags, and once using the sourcecode tags..

    http://codeacious.wordpress.com/2008/08/31/display-a-table-of-web-safe-colors-using-a-perl-cgi-script/

    You can easily see that some of the tags are missing.

  • The topic ‘sourcecode tag stripping </tr> and reading <br>’ is closed to new replies.