Hi Adam,

Adam Borowski wrote:
> > > http://angband.pl/svn/kbtin/trunk/ansi2html.c
> > > 
> > > It can handle all standard SGR codes.  There's no support for xterm-256
> > > colors, but I can add that if it would be useful for someone.
> > 
> > JFTR: "echo q | env TERM=xterm htop | ansi2html" doesn't catch all
> > codes either.
> 
> htop is a full-screen rather than a line based program.  Instead of a body
> of text with color tags, it produces codes for a terminal with an
> addressable cursor: instead of lines separated with \n, it says "go to
> position 0,15; write 'foo' there".

I see, so I'd probably better stick to "classic" screenshots for
everything which looks like colored curses (sic!). Seems less effort,
despite being less cool, too. :-)

Unfortunately htop doesn't support a "batch mode" like the original
top does: "top -b -n 1" -- with that it wouldn't be a problem.

> If you're interesting in coloring syslogs/IRC logs/MUD logs/build logs[1]/
> colordiffs/etc, which can often take tens of megabytes, you'd want to limit
> yourself to plain ANSI text.  Ie, anything that "less -R" can show.

Yeah, you're right there.

> > But "screen -c /dev/null -L ccal ; cat screenlog.0 | ./ansi2html > 
> > ccal.html"
> > works fine with your implementation. "screen -c /dev/null -L htop ; cat
> > screenlog.0 | ./ansi2html > htop2.html" and quickly pressing works only
> > slightly better.
> 
> I see the problem with ccal is that it disables all coloring if stdout is
> not a terminal (isatty() in C, [ -t 1 ] in bash).  Most programs like ls,
> git or colorgcc do this as well but have an argument like --color=always.
> 
> There's a number of programs which fake a tty.  It might be clearer to use a
> dedicated one, but that would add a dependency, abusing "script" (priority:
> Required) doesn't:
> 
> script -q /dev/null -c "ccal"

Right, script is probably the better and less hackish way than screen,
thanks!

Anyway, the blog posting for which I needed that stuff is now online:
http://noone.org/blog/English/Computer/Debian/CoolTools/ccal.futile

> > P.S.: Looking at http://angband.pl/svn/kbtin/trunk/COPYING I'd expect
> > ansi2html is GPL'ed code, right?
> 
> Yes, but only because the program it's bundled with is a code base starting
> in the 80s; ansi2html can be of any license if you wish so.

BTW: I had to modify the resulting code to not using <style> tags but
only style attributs as <style> in the middle of an HTML body (because
the header won't be used on the planets) worked in my blog but got
posted quoted on Planet Debian. I also prefer to use <span> instead of
<b>, but that may be because of the age of ansi2html.

> [1]. I've seen ANSI color codes in build logs quite a few times.  It might
> be a good idea to process them with ansi2html or another such program.  But
> then, this may unleash a wave of colorgcc use on us :p

Hehe. colorgcc and colormake are candidates for my blogging column,
too. Interestingly if you use colorgcc together with colormake, the
output is not colored at all.

                Regards, Axel
-- 
 ,''`.  |  Axel Beckert <a...@debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE
  `-    |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to