Skip to main content

ansi2html now supporting eix output

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.