| 271 | |
| 272 | // Replace each code with a closing and opening span. |
| 273 | function span() { |
| 274 | var out = '</span>'; |
| 275 | var styles = []; |
| 276 | |
| 277 | if (bold) styles.push('font-weight: bold'); |
| 278 | if (italic) styles.push('font-variant: italic'); |
| 279 | |
| 280 | var deco = []; |
| 281 | if (blink) deco.push('blink'); |
| 282 | if (underline) deco.push('underline'); |
| 283 | if (strike) styles.push('line-through'); |
| 284 | if (deco.length) styles.push('text-decoration: ' + deco.join(' ')); |
| 285 | |
| 286 | var color = invert ? bg : fg + (bold ? 'b' : ''), |
| 287 | background = invert ? fg : bg; |
| 288 | |
| 289 | var klass = [ 'termkitAnsiFg' + color, 'termkitAnsiBg' + background ]; |
| 290 | |
| 291 | out += '<span class="'+ klass.join(' ') +'" style="' + styles.join(';') + '">'; |
| 292 | |
| 293 | return out; |
| 294 | } |
| 295 | |
| 296 | // Supported codes. |
| 297 | for (i in codes) { |