From 06e368f66eb42bc279c753b08ccb873c52e320d3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 16 May 2013 15:35:59 +0200 Subject: Fix the parser for the rainbow plugin --- src/xhtml.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/xhtml.py b/src/xhtml.py index 11435ab3..1deca67a 100644 --- a/src/xhtml.py +++ b/src/xhtml.py @@ -443,9 +443,13 @@ def poezio_colors_to_html(string): check_property('text-decoration', 'underline') if attr_char in digits: - number = int(attr_char) - check_property('color', number_to_color_names.get(number, 'black')) - string = string[next_attr_char+3:] + number_str = string[next_attr_char+1:string.find('}', next_attr_char)] + number = int(number_str) + if number in number_to_color_names: + check_property('color', number_to_color_names.get(number, 'black')) + else: + check_property('color', ncurses_color_to_html(number)) + string = string[next_attr_char+len(number_str)+2:] else: string = string[next_attr_char+2:] next_attr_char = string.find('\x19') -- cgit v1.2.3