converter

Module Contents

ANSI_FULL_RESET = 0
ANSI_INTENSITY_INCREASED = 1
ANSI_INTENSITY_REDUCED = 2
ANSI_INTENSITY_NORMAL = 22
ANSI_STYLE_ITALIC = 3
ANSI_STYLE_NORMAL = 23
ANSI_UNDERLINE_ON = 4
ANSI_UNDERLINE_OFF = 24
ANSI_CROSSED_OUT_ON = 9
ANSI_CROSSED_OUT_OFF = 29
ANSI_VISIBILITY_ON = 28
ANSI_VISIBILITY_OFF = 8
ANSI_FOREGROUND_CUSTOM_MIN = 30
ANSI_FOREGROUND_CUSTOM_MAX = 37
ANSI_FOREGROUND_256 = 38
ANSI_FOREGROUND_DEFAULT = 39
ANSI_BACKGROUND_CUSTOM_MIN = 40
ANSI_BACKGROUND_CUSTOM_MAX = 47
ANSI_BACKGROUND_256 = 48
ANSI_BACKGROUND_DEFAULT = 49
ANSI_NEGATIVE_ON = 7
ANSI_NEGATIVE_OFF = 27
ANSI_FOREGROUND_HIGH_INTENSITY_MIN = 90
ANSI_FOREGROUND_HIGH_INTENSITY_MAX = 97
ANSI_BACKGROUND_HIGH_INTENSITY_MIN = 100
ANSI_BACKGROUND_HIGH_INTENSITY_MAX = 107
VT100_BOX_CODES
_latex_template = \documentclass{scrartcl}

usepackage[utf8]{inputenc} usepackage{fancyvrb} usepackage[usenames,dvipsnames]{xcolor} %% definecolor{red-sd}{HTML}{7ed2d2}

title{%(title)s}

fvset{commandchars=\{}}

begin{document}

begin{Verbatim} %(content)s end{Verbatim} end{document}

_html_template
class _State[source]

Bases: object

reset(self)[source]
adjust(self, ansi_code, parameter=None)[source]
to_css_classes(self)[source]
linkify(line, latex_mode)[source]
map_vt100_box_code(char)[source]
_needs_extra_newline(text)[source]
class CursorMoveUp[source]

Bases: object

class Ansi2HTMLConverter(latex=False, inline=False, dark_bg=True, line_wrap=True, font_size='normal', linkify=False, escaped=True, markup_lines=False, output_encoding='utf-8', scheme='ansi2html', title='')[source]

Bases: object

Convert Ansi color codes to CSS+HTML

Example: >>> conv = Ansi2HTMLConverter() >>> ansi = ” “.join(sys.stdin.readlines()) >>> html = conv.convert(ansi)

apply_regex(self, ansi)[source]
_apply_regex(self, ansi, styles_used)[source]
_collapse_cursor(self, parts)[source]

Act on any CursorMoveUp commands by deleting preceding tokens

prepare(self, ansi='', ensure_trailing_newline=False)[source]

Load the contents of ‘ansi’ into this object

attrs(self)[source]

Prepare attributes for the template

convert(self, ansi, full=True, ensure_trailing_newline=False)[source]
produce_headers(self)[source]
main()[source]

$ ls –color=always | ansi2html > directories.html $ sudo tail /var/log/messages | ccze -A | ansi2html > logs.html $ task burndown | ansi2html > burndown.html