Show More
@@ -122,12 +122,13 b' def single_ansi2latex(code):' | |||||
122 | color_code = style_code.split(';')[1] |
|
122 | color_code = style_code.split(';')[1] | |
123 | is_normal = style_code.split(';')[0] == '0' |
|
123 | is_normal = style_code.split(';')[0] == '0' | |
124 |
|
124 | |||
125 |
# regular |
|
125 | # regular weight | |
126 | if (code == style_code) or (is_normal and code == color_code): |
|
126 | if (code == style_code) or (is_normal and code == color_code): | |
127 | return '\\'+color[0].lower()+'{', 1 |
|
127 | ||
128 | # bold fonts |
|
128 | return r'{\color{'+color[0].lower()+'}', 1 | |
|
129 | # bold | |||
129 | if code == style_code[:3]+str(1)+style_code[3:]: |
|
130 | if code == style_code[:3]+str(1)+style_code[3:]: | |
130 |
return '\ |
|
131 | return r'\textbf{\color{'+color[0].lower()+'}', 1 | |
131 | return '', 0 |
|
132 | return '', 0 | |
132 |
|
133 | |||
133 | def ansi2latex(text): |
|
134 | def ansi2latex(text): | |
@@ -149,8 +150,8 b' def ansi2latex(text):' | |||||
149 | texform, openbrack = single_ansi2latex(match.group()) |
|
150 | texform, openbrack = single_ansi2latex(match.group()) | |
150 | outstring += texform |
|
151 | outstring += texform | |
151 | last_end = match.end() |
|
152 | last_end = match.end() | |
152 |
|
153 | |||
153 | #Add the remainer of the string and THEN close any remaining color brackets. |
|
154 | # Add the remainer of the string and THEN close any remaining color brackets. | |
154 | outstring += text[last_end:] |
|
155 | outstring += text[last_end:] | |
155 | if openbrack: |
|
156 | if openbrack: | |
156 | outstring += '}'*openbrack |
|
157 | outstring += '}'*openbrack |
General Comments 0
You need to be logged in to leave comments.
Login now