Any idea whats going on with this conversion. I'm seeing issues when a word is replaced. For example, the ansi is
months remaining �[1;31mtimes�[m�[1;32mmultiplied by�[m $10 with
and the result html is
months remaining times2mmultiplied by $10
Here is a screenshot from terminal
You can see that the html not getting generated properly for the new text in green from terminal.
It seems to be the '[m' sequences which confuse it. If I remove those something approaching correct comes out. From what I can find on the web the correct sequences involving 'm' look like this: ESC[#(;#)m. ie there should be at least a number preceeding the 'm' , and possibly a ';#' in addition. as in the other sequences in the string. (eg [1;31m) http://bluesock.org/~willg/dev/ansi.html
interesting. so this would be considered a bug in git then? This is being generated from git diff --color-words.
the [m appears to be a color reset, which should be possible to handle. I'll have a look.
nice. no rush on my end. I have managed to solve my issues by just parsing the ansi with regex. I appreciate the quick responses though.
It turns out '[m' was being handled correctly, what was causing the error were two sequences together eg [m[1;32m. The parser was mangling the second sequence. I've committed a fix for that. can you test it out?
From looking around, my best guess is that [0m is actually the reset code. Though if git produces [m it's at least common.
Does not seem to fix it. The ansi from git is:
months remainingESC�[1;31mtimesESC�[mESC�[1;32mmultiplied byESC�[m $10
and that turns into
months remaining <b><span style="color:#A00">times</span></b>2mmultiplied by $10
Again, I'm probably not going to be using it though since i solved my issues with regex since its only a few common ansi characters im looking for.