Show More
@@ -111,12 +111,22 b' def single_ansi2latex(code):' | |||
|
111 | 111 | Return latex code and number of open brackets. |
|
112 | 112 | """ |
|
113 | 113 | for color in coloransi.color_templates: |
|
114 | colcode = getattr(coloransi.TermColors,color[0]) | |
|
114 | ||
|
115 | #Make sure to get the color code (which is a part of the overall style) | |
|
116 | # i.e. 0;31 is valid | |
|
117 | # 31 is also valid, and means the same thing | |
|
118 | #coloransi.color_templates stores the longer of the two formats %d;%d | |
|
119 | #Get the short format so we can parse that too. Short format only exist | |
|
120 | #if no other formating is applied (the other number must be a 0)! | |
|
121 | style_code = getattr(coloransi.TermColors, color[0]) | |
|
122 | color_code = style_code.split(';')[1] | |
|
123 | is_normal = style_code.split(';')[0] == '0' | |
|
124 | ||
|
115 | 125 | # regular fonts |
|
116 | if code == colcode: | |
|
126 | if (code == style_code) or (is_normal and code == color_code): | |
|
117 | 127 | return '\\'+color[0].lower()+'{', 1 |
|
118 | 128 | # bold fonts |
|
119 |
if code == |
|
|
129 | if code == style_code[:3]+str(1)+style_code[3:]: | |
|
120 | 130 | return '\\textbf{\\textcolor{'+color[0].lower()+'}{', 2 |
|
121 | 131 | return '', 0 |
|
122 | 132 |
General Comments 0
You need to be logged in to leave comments.
Login now