ansi2html icon indicating copy to clipboard operation
ansi2html copied to clipboard

reset

Open szepeviktor opened this issue 10 years ago • 9 comments

This is a very fine script!

Could you please handle reset?

# tput sgr0|hexdump  -C
00000000  1b 28 42 1b 5b 6d                                 |.(B.[m|

szepeviktor avatar Jun 01 '14 23:06 szepeviktor

And please add this to pre's style to break long lines:

    white-space: pre-wrap;
    word-wrap: break-word;

szepeviktor avatar Jun 01 '14 23:06 szepeviktor

And please add this to pre's style to break long lines:

This would be an easy pull-request. Would you like to be the one to add it?

ralphbean avatar Jun 05 '14 20:06 ralphbean

Please handle tput sgr0: revert back the current schema's color OR tell me how to reset that your script understands.

szepeviktor avatar Jun 05 '14 21:06 szepeviktor

http://manpages.ubuntu.com/manpages/hardy/man5/terminfo.5.html

s0ds         s0        Shift to codeset 0 (EUC set 0, ASCII)
...
s0ds=\E(B

So \E(B is "Shift to codeset 0". I do not know what it is. I'd like to just "turn off all attributes" by tput.

szepeviktor avatar Jun 05 '14 22:06 szepeviktor

I'll take a look at handling sgr0 when I can. It seems like it would need to close as many </span> tags as had been opened.

ralphbean avatar Jun 06 '14 21:06 ralphbean

Very dirty.

cat "${HC_LOG}.txt" \
    | ansi2html --title="$HC_DOMAIN" --linkify --font-size=13px --light-background -s xterm \
    | sed 's/\x1B(B\b//g' > "${HC_LOG}.html"

szepeviktor avatar Jun 06 '14 22:06 szepeviktor

A 3-year-old bug still not resolved? :(

wookayin avatar Dec 17 '17 02:12 wookayin

And please add this to pre's style to break long lines:

    white-space: pre-wrap;
    word-wrap: break-word;

That was added in 2014 for release 1.0.7 by commit 418bef2f03dd36e7ad0dac663db0e917879d3dee .

hartwork avatar Feb 03 '22 23:02 hartwork

Could you please handle reset?

# tput sgr0|hexdump  -C
00000000  1b 28 42 1b 5b 6d                                 |.(B.[m|

I'm unsure about how that^^ sgr0 differs from \x1b[0m (Wikipedia) semantically (if so). The latter is supported…

# hexdump -C <<<$'\x1b[0m'
00000000  1b 5b 30 6d 0a                                    |.[0m.|
00000005

# echo $'\x1b[31mhello red\x1b[0m and hello normal' | ansi2html --inline
<span style="color: #aa0000">hello red</span> and hello normal

…since 2013 release 0.10.0 commit fce66a6a905fb6aa006cfa1f6ad4716ebb46e63b.

hartwork avatar Feb 03 '22 23:02 hartwork