How to use the ansi2html.style.get_styles function in ansi2html

To help you get started, we’ve selected a few ansi2html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enigmagroup / enigmabox-openwrt / webinterface / files / root / opt / enigmabox / webinterface / ansi2html / converter.py View on Github external
def produce_headers(self):
        return '<style type="text/css">\n%(style)s\n</style>\n' % {
            'style' : "\n".join(map(str, get_styles(self.dark_bg)))
        }
github ralphbean / ansi2html / ansi2html / converter.py View on Github external
escaped=True,
                 markup_lines=False,
                 output_encoding='utf-8',
                ):

        self.inline = inline
        self.dark_bg = dark_bg
        self.font_size = font_size
        self.linkify = linkify
        self.escaped = escaped
        self.markup_lines = markup_lines
        self.output_encoding = output_encoding
        self._attrs = None

        if inline:
            self.styles = dict([(item.klass.strip('.'), item) for item in get_styles(self.dark_bg)])

        self.ansi_codes_prog = re.compile('\033\\[' '([\\d;]*)' '([a-zA-z])')
github enigmagroup / enigmabox-openwrt / webinterface / files / root / opt / enigmabox / webinterface / ansi2html / converter.py View on Github external
escaped=True,
                 markup_lines=False,
                 output_encoding='utf-8',
                ):

        self.inline = inline
        self.dark_bg = dark_bg
        self.font_size = font_size
        self.linkify = linkify
        self.escaped = escaped
        self.markup_lines = markup_lines
        self.output_encoding = output_encoding
        self._attrs = None

        if inline:
            self.styles = dict([(item.klass.strip('.'), item) for item in get_styles(self.dark_bg)])

        self.ansi_codes_prog = re.compile('\033\\[' '([\\d;]*)' '([a-zA-z])')
github ralphbean / ansi2html / ansi2html / converter.py View on Github external
def convert(self, ansi, full=True):
        attrs = self.prepare(ansi)
        if not full:
            return attrs["body"]
        else:
            return _template.format(
                style="\n".join(map(str, get_styles(self.dark_bg))),
                font_size=self.font_size,
                content=attrs["body"],
                output_encoding=self.output_encoding,
            )
github HaoPeiwen / Sniffer / src / converter.py View on Github external
):

        self.latex = latex
        self.inline = inline
        self.dark_bg = dark_bg
        self.font_size = font_size
        self.linkify = linkify
        self.escaped = escaped
        self.markup_lines = markup_lines
        self.output_encoding = output_encoding
        self.scheme = scheme
        self.title = title
        self._attrs = None

        if inline:
            self.styles = dict([(item.klass.strip('.'), item) for item in get_styles(self.dark_bg, self.scheme)])

        self.ansi_codes_prog = re.compile('\033\\[' '([\\d;]*)' '([a-zA-z])')
github HaoPeiwen / Sniffer / src / converter.py View on Github external
def produce_headers(self):
        return '<style type="text/css">\n%(style)s\n</style>\n' % {
            'style' : "\n".join(map(str, get_styles(self.dark_bg, self.scheme)))
        }
github ralphbean / ansi2html / ansi2html / converter.py View on Github external
def produce_headers(self):
        return '<style type="text/css">\n{style}\n</style>\n'.format(
            style="\n".join(map(str, get_styles(self.dark_bg)))
        )
github HaoPeiwen / Sniffer / src / converter.py View on Github external
def convert(self, ansi, full=True, ensure_trailing_newline=False):
        attrs = self.prepare(ansi, ensure_trailing_newline=ensure_trailing_newline)
        if not full:
            return attrs["body"]
        else:
            if self.latex:
                _template = _latex_template
            else:
                _template = _html_template
            return _template % {
                'style' : "\n".join(map(str, get_styles(self.dark_bg, self.scheme))),
                'title' : self.title,
                'font_size' : self.font_size,
                'content' :  attrs["body"],
                'output_encoding' : self.output_encoding,
            }