How to use the ansi2html.ansi2html 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 abcdabcd987 / acm-compiler-judge / core / views.py View on Github external
def download_buildlog(id):
    l = db_session.query(BuildLog).filter(BuildLog.id == id).first()
    if not l:
        return abort(404)
    path = os.path.join(settings.CORE_BUILD_LOG_PATH, '{:d}.txt'.format(l.id))
    if not os.path.exists(path):
        return abort(404)
    with open(path) as f:
        text = f.read()
    html = ansi2html(text, palette='console')
    return render_template('buildlog.html', log=html, buildlog=l)
github abcdabcd987 / acm-compiler-judge / core / views.py View on Github external
def download_runlog(id):
    r = db_session.query(TestRun).filter(TestRun.id == id).first()
    if not r:
        return abort(404)
    path = os.path.join(settings.CORE_TESTRUN_STDERR_PATH, '{:d}.txt'.format(r.id))
    if not os.path.exists(path):
        return abort(404)
    with open(path) as f:
        text = f.read()
    html = ansi2html(text, palette='console')
    return render_template('runlog.html', log=html, testrun=r)