コード例 #1
0
 def test_ansi2html_alt_syntax(self):
     # Xterm maintains a color palette whose entries are identified
     # by an index beginning with zero.  If 88- or 256-color support
     # is compiled, the following apply:
     # o All parameters are decimal integers.
     # o RGB values range from zero (0) to 255.
     # o ISO-8613-3 can be interpreted in more than one way; xterm
     #   allows the semicolons in this control to be replaced by
     #   colons (but after the first colon, colons must be used).
     #
     # These ISO-8613-3 controls are supported:
     #   Pm = 3 8 ; 2 ; Pr; Pg; Pb -> Set foreground color to the
     # closest match in xterm's palette for the given RGB Pr/Pg/Pb.
     #   Pm = 3 8 ; 5 ; Ps -> Set foreground color to the second Ps.
     #   Pm = 4 8 ; 2 ; Pr; Pg; Pb -> Set background color to the
     # closest match in xterm's palette for the given RGB Pr/Pg/Pb.
     #   Pm = 4 8 ; 5 ; Ps -> Set background color to the second Ps.
     #       -- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
     self.assertEqual(c2h.ansi2html('\033[38;2;255;255;255m*'),
                      '<span style="color: #ffffff">*</span>')
     self.assertEqual(c2h.ansi2html('\033[38;2;255:255:255m*'),
                      '<span style="color: #ffffff">*</span>')
コード例 #2
0
 def test_ansi2html_alt_syntax(self):
     # Xterm maintains a color palette whose entries are identified
     # by an index beginning with zero.  If 88- or 256-color support
     # is compiled, the following apply:
     # o All parameters are decimal integers.
     # o RGB values range from zero (0) to 255.
     # o ISO-8613-3 can be interpreted in more than one way; xterm
     #   allows the semicolons in this control to be replaced by
     #   colons (but after the first colon, colons must be used).
     #
     # These ISO-8613-3 controls are supported:
     #   Pm = 3 8 ; 2 ; Pr; Pg; Pb -> Set foreground color to the
     # closest match in xterm's palette for the given RGB Pr/Pg/Pb.
     #   Pm = 3 8 ; 5 ; Ps -> Set foreground color to the second Ps.
     #   Pm = 4 8 ; 2 ; Pr; Pg; Pb -> Set background color to the
     # closest match in xterm's palette for the given RGB Pr/Pg/Pb.
     #   Pm = 4 8 ; 5 ; Ps -> Set background color to the second Ps.
     #       -- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
     self.assertEqual(c2h.ansi2html('\033[38;2;255;255;255m*'),
                      '<span style="color: #ffffff">*</span>')
     self.assertEqual(c2h.ansi2html('\033[38;2;255:255:255m*'),
                      '<span style="color: #ffffff">*</span>')
コード例 #3
0
 def test_ansi2html_short_reset(self):
     self.assertEqual(c2h.ansi2html('\033[31m*\033[m.'),
                      '<span style="color: #cc0000">*</span>.')
コード例 #4
0
 def test_ansi2html_xterm_256_color(self):
     self.assertEqual(c2h.ansi2html('\033[38;5;255m*'),
                      '<span style="color: #eeeeee">*</span>')
コード例 #5
0
 def test_ansi2html_regular(self):
     self.assertEqual(c2h.ansi2html('\033[31m*'),
                      '<span style="color: #cc0000">*</span>')
コード例 #6
0
 def test_ansi2html_explicit_non_bold(self):
     self.assertEqual(c2h.ansi2html('\033[0;31m*'),
                      '<span style="color: #cc0000">*</span>')
コード例 #7
0
 def test_ansi2html_bold(self):
     self.assertEqual(c2h.ansi2html('\033[1;31m*'),
                      '<span style="color: #ef2828">*</span>')
コード例 #8
0
 def test_ansi2html_hi_intensity(self):
     self.assertEqual(c2h.ansi2html('\033[91m*'),
                      '<span style="color: #ef2828">*</span>')
コード例 #9
0
 def test_ansi2html(self):
     self.assertEqual(
         c2h.ansi2html('Hello, \033[1;37minvisible\033[m world! <>&'),
         'Hello, <span style="color: #ededeb">invisible</span> world! &lt;&gt;&amp;')
コード例 #10
0
 def test_ansi2html_xterm_256_color(self):
     self.assertEqual(c2h.ansi2html('\033[38;5;255m*'),
                      '<span style="color: #eeeeee">*</span>')
コード例 #11
0
 def test_ansi2html_short_reset(self):
     self.assertEqual(c2h.ansi2html('\033[31m*\033[m.'),
                      '<span style="color: #cc0000">*</span>.')
コード例 #12
0
 def test_ansi2html_regular(self):
     self.assertEqual(c2h.ansi2html('\033[31m*'),
                      '<span style="color: #cc0000">*</span>')
コード例 #13
0
 def test_ansi2html_explicit_non_bold(self):
     self.assertEqual(c2h.ansi2html('\033[0;31m*'),
                      '<span style="color: #cc0000">*</span>')
コード例 #14
0
 def test_ansi2html_bold(self):
     self.assertEqual(c2h.ansi2html('\033[1;31m*'),
                      '<span style="color: #ef2828">*</span>')
コード例 #15
0
 def test_ansi2html_hi_intensity(self):
     self.assertEqual(c2h.ansi2html('\033[91m*'),
                      '<span style="color: #ef2828">*</span>')
コード例 #16
0
 def test_ansi2html(self):
     self.assertEqual(
         c2h.ansi2html('Hello, \033[1;37minvisible\033[m world! <>&'),
         'Hello, <span style="color: #ededeb">invisible</span> world! &lt;&gt;&amp;'
     )