summaryrefslogtreecommitdiff
path: root/dev-python/ansi2html/files/ansi2html-0.9.1-fix-0-control-code.patch
blob: 6e51d3f1d975d097d6041bc1380f17acad5d0cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From f4371f16fd9ba9bffdd32a877b32f78222aef87c Mon Sep 17 00:00:00 2001
From: Corentin Chary <corentin.chary@gmail.com>
Date: Sun, 22 Jul 2012 09:25:15 +0200
Subject: [PATCH 3/3] The 0 control code could be at the end of a sequence

Example: u"\x1b[32;01m * \x1b[39;49;00m *"
Note that here 39 and 49 "reset to default" codes are still
not handled.
---
 ansi2html/converter.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ansi2html/converter.py b/ansi2html/converter.py
index 0609a9e..23be2d0 100755
--- a/ansi2html/converter.py
+++ b/ansi2html/converter.py
@@ -147,7 +147,7 @@ class Ansi2HTMLConverter(object):
             if params[0] in [38, 48]:
                 params = ["%i-%i" % (params[0], params[2])] + params[3:]
 
-            if params == [0]:
+            if 0 in params:
                 # If the control code 0 is present, close all tags we've
                 # opened so far.  i.e. reset all attributes
                 yield '</span>' * n_open
-- 
1.7.9.5