ansi2html

1 개요[ | ]

ansi2html
/usr/local/bin/ansi2html

2 설치[ | ]

root@localhost:~# pip install ansi2html
Collecting ansi2html
  Downloading ansi2html-1.6.0-py3-none-any.whl (14 kB)
Installing collected packages: ansi2html
Successfully installed ansi2html-1.6.0

3 실행예시[ | ]

root@localhost:~# ls -al --color /dev/pts
total 0
drwxr-xr-x  2 root root      0 Jan 28 08:31 .
drwxr-xr-x 17 root root   3700 Jan 28 08:31 ..
crw-------  1 root tty  136, 0 Mar 19 10:36 0
crw-------  1 root tty  136, 1 Mar 19 12:18 1
crw-------  1 root tty  136, 2 Mar 19 12:18 2
c---------  1 root root   5, 2 Jan 28 08:31 ptmx
root@localhost:~# ls -al --color /dev/pts | ansi2html -p
total 0
drwxr-xr-x  2 root root      0 Jan 28 08:31 <span class="ansi1 ansi34">.</span>
drwxr-xr-x 17 root root   3700 Jan 28 08:31 <span class="ansi1 ansi34">..</span>
crw-------  1 root tty  136, 0 Mar 19 10:36 <span class="ansi1 ansi33 ansi40">0</span>
crw-------  1 root tty  136, 1 Mar 19 12:20 <span class="ansi1 ansi33 ansi40">1</span>
crw-------  1 root tty  136, 2 Mar 19 12:20 <span class="ansi1 ansi33 ansi40">2</span>
c---------  1 root root   5, 2 Jan 28 08:31 <span class="ansi1 ansi33 ansi40">ptmx</span>
root@localhost:~# ls -al --color /dev/pts | ansi2html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
.ansi2html-content { display: inline; white-space: pre-wrap; word-wrap: break-word; }
.body_foreground { color: #AAAAAA; }
.body_background { background-color: #000000; }
.body_foreground > .bold,.bold > .body_foreground, body.body_foreground > pre > .bold { color: #FFFFFF; font-weight: normal; }
.inv_foreground { color: #000000; }
.inv_background { background-color: #AAAAAA; }
.ansi1 { font-weight: bold; }
.ansi33 { color: #aa5500; }
.ansi34 { color: #0000aa; }
.ansi40 { background-color: #000316; }
</style>
</head>
<body class="body_foreground body_background" style="font-size: normal;" >
<pre class="ansi2html-content">
total 0
drwxr-xr-x  2 root root      0 Jan 28 08:31 <span class="ansi1 ansi34">.</span>
drwxr-xr-x 17 root root   3700 Jan 28 08:31 <span class="ansi1 ansi34">..</span>
crw-------  1 root tty  136, 0 Mar 19 10:36 <span class="ansi1 ansi33 ansi40">0</span>
crw-------  1 root tty  136, 1 Mar 19 12:18 <span class="ansi1 ansi33 ansi40">1</span>
crw-------  1 root tty  136, 2 Mar 19 12:18 <span class="ansi1 ansi33 ansi40">2</span>
c---------  1 root root   5, 2 Jan 28 08:31 <span class="ansi1 ansi33 ansi40">ptmx</span>

</pre>
</body>

</html>

4 같이 보기[ | ]

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}