would that work?
https://github.com/tardyp/buildbot/commits/ansi


Pierre


On Thu, Aug 22, 2013 at 11:15 AM, Pierre Tardy <tardyp@gmail.com> wrote:

> aha!
> I missed the 3 lines paragraphe in wikipedia "spec" stating that "m"
> params can be multiple and separated by ;. The fix is quite easy. I'll give
> it a shot soon.
>
>
> Pierre
>
>
> On Thu, Aug 22, 2013 at 5:11 AM, Jared Grubb <notifications@github.com>wrote:
>
>> In master/buildbot/status/web/logs.py:
>>
>> > @@ -80,9 +84,26 @@ def content(self, entries):
>> >                  # jinja only works with unicode, or pure ascii, so assume utf-8 in logs
>> >                  if not isinstance(entry, unicode):
>> >                      entry = unicode(entry, 'utf-8', 'replace')
>> > -                html_entries.append(dict(type = logfile.ChunkTypes[type],
>> > -                                         text = entry,
>> > -                                         is_header = is_header))
>> > +                first_entry = True
>> > +                _type = logfile.ChunkTypes[type]
>> > +                for ansi_entry in entry.split("\033["):
>> > +                    code = ""
>> > +                    if not first_entry:
>> > +                        res = ANSI_RE.search(ansi_entry)
>> > +                        if res:
>> > +                            mode = res.group(4)
>> > +                            ansi_entry = ansi_entry[len(res.group(0)):]
>> > +                            if mode == 'm':
>> > +                                code = " ansi" + res.group(1)
>>
>> So, I gave this patch a shot on my server, but I think the RE here needs
>> to adjusted a bit...
>>
>> For example, our build tool outputs "[1;32m" but this translates it to
>> "ansi1" instead of "ansi32", so I get no colors. It does strip the junk out
>> of the text, so that's a plus. I wonder if this could be fixed easily?
>> Maybe add an optional "0;" or "1;" at the start of the RE to ignore them?
>> That wont get all the ANSI possibilities, but I think the majority of ANSI
>> output wont vary from "0;NNm", "1;NNm" or "NNm".
>>
>> —
>> Reply to this email directly or view it on GitHub<https://github.com/buildbot/buildbot/pull/795/files#r5915717>
>> .
>>
>
>