escaping < and > to sintaxhighlighter
To put code here I use sintaxhighlighter, a great tool to color and indent my codes.The only problem is have to escape '<' and '>' characters.. that are really commons
in C source files..
I was making this by hand.. ybut my codes are becoming larger.. so I make
this little perl scrip to do boring thigs to me
#!/usr/bin/perlI named it as make_htmlable O_O..
use warnings;
use strict;
$/ = undef;
my ($file) = @ARGV;
open (F, "<$file") || die $!;
my $str = <F>;
$str =~ s/</&�lt;/g;
$str =~ s/>/&�gt;/g;
print $str;
so you can use like this:
./make_htmlable c-source-file.c | xclip
and then paste the code between <pre></pre>
tags with midle mouse buttom
ps: xclip read input and save in clipboard.. so u can paste as above