ansi2html now supporting eix output 2013-09-30

I was close to writing something like ansi2html myself when I googled that name to see if it was available… and found Ralph Bean had done that work before. Nice!

The idea is to turn colorized shell output (making use of ANSI escape codes) into HTML. For example:

# echo -e '\x1b[31mRED TEXT\x1b[0m'
RED TEXT

# echo -e '\x1b[31mRED TEXT\x1b[0m' | ansi2html --inline
<span style="color: #aa0000;">RED TEXT</span>

Sadly, ansi2html 0.9.4 didn't handle eix output very well. This is the HTML I got from "eix dvdbackup -F | ansi2html --inline" (rendered by your browser):

[I] media-video/dvdbackup
     Available versions:  0.4.1 (~)0.4.2{tbz2} {nls}
     Installed versions:  0.4.2{tbz2}(21:23:36 30.09.2013)(nls)
     Homepage:            http://dvdbackup.sourceforge.net/
     Description:         Backup content from DVD to hard disk

So I started fixing ansi2html. Release 0.10.0 is not perfect yet but handles eix output a lot better:

[I] media-video/dvdbackup
     Available versions:  0.4.1 (~)0.4.2{tbz2} {nls}
     Installed versions:  0.4.2{tbz2}(21:23:36 30.09.2013)(nls)
     Homepage:            http://dvdbackup.sourceforge.net/
     Description:         Backup content from DVD to hard disk

To give it a spin on Gentoo, emerge dev-python/ansi2html.

Creative Commons License
The ansi2html now supporting eix output by Sebastian Pipping, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

2 Comments
Laurent Bachelier October 1st, 2013

Eh, looks like I was not the only one with that idea, I have been using it for a while for my overlay: https://github.com/laurentb/gentoo-overlay/tree/master/tools

Thanks for the fixes!

Laurent Bachelier October 1st, 2013

Oh, it’s actually a different project, in Python. Still, much better.

Leave a Reply