Replacing deprecated method from cgi with html.escape()

This commit is contained in:
Kevin Driscoll 2019-10-30 13:28:35 -04:00
parent 85535b7baa
commit a7dfe5e517

View file

@ -9,7 +9,7 @@ snippet #577349 on http://code.activestate.com.
""" """
import re import re
import cgi from html import escape as html_escape
from .ansi import * from .ansi import *
@ -304,7 +304,7 @@ class TextToHTMLparser(object):
""" """
cdict = match.groupdict() cdict = match.groupdict()
if cdict["htmlchars"]: if cdict["htmlchars"]:
return cgi.escape(cdict["htmlchars"]) return html_escape(cdict["htmlchars"])
elif cdict["lineend"]: elif cdict["lineend"]:
return "<br>" return "<br>"
elif cdict["firstspace"]: elif cdict["firstspace"]: