How can I change the default diff format of Gitweb to `--color-words`?
How did you use HTML :: FromANSI ? As it works for me using the following command working as intended
git diff --color-words HEAD^ HEAD |
perl -wle '
use HTML::FromANSI;
my @lines = <STDIN>;
foreach my $line (@lines) {
chomp $line;
print ansi2html($line);
}' > tmp.html
Although, if you want to use useful output rather than subtle white text on a black background, you probably need to customize HTML :: FromANSI. The above scriptlet is just a proof of concept (not in the best style).
BTW I'm not sure about the quality of the HTML :: FromANSI module; it didn't install (using cpan
) for me effortlessly (but it might be an issue with Term :: VT102 :: Boundless this module requires).
ansi2html
have problems with some lines (I think lines with embedded / trailing end-of-line and empty line / line) generating a warning Use of uninitialized value in concatenation (.) or string at .../HTML/FromANSI.pm line 353, <STDIN> line NN.
. This is why I had to chomp
strings (and this may be the problem you are having with HTML :: FromANSI working).
Also the HTML generated by this module is pretty awful, using a legacy and deprecated tag <font face='...' style ='...'>
along with a modern tag <span style='...'>
; also I see no way to use CSS instead of inline style.
source to share