summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-05-16 15:35:59 +0200
committermathieui <mathieui@mathieui.net>2013-05-16 15:35:59 +0200
commit06e368f66eb42bc279c753b08ccb873c52e320d3 (patch)
tree2f7bacd8fc8e857046301de52b1c91e53c190408 /src
parent785b21ff0219406afdc1b401f4522f44629770f9 (diff)
downloadpoezio-06e368f66eb42bc279c753b08ccb873c52e320d3.tar.gz
poezio-06e368f66eb42bc279c753b08ccb873c52e320d3.tar.bz2
poezio-06e368f66eb42bc279c753b08ccb873c52e320d3.tar.xz
poezio-06e368f66eb42bc279c753b08ccb873c52e320d3.zip
Fix the parser for the rainbow plugin
Diffstat (limited to 'src')
-rw-r--r--src/xhtml.py10
1 files changed, 7 insertions, 3 deletions
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')