comparison mercurial/minirst.py @ 34695:e178fcaa3933

python3: use our bytes-only version of cgi.escape everywhere As suggested by Yuya in D965. Differential Revision: https://phab.mercurial-scm.org/D1067
author Augie Fackler <augie@google.com>
date Thu, 05 Oct 2017 14:16:20 -0400
parents 0fa781320203
children f0b6fbea00cf
comparison
equal deleted inserted replaced
34694:2976cf87a60a 34695:e178fcaa3933
18 when adding support for new constructs. 18 when adding support for new constructs.
19 """ 19 """
20 20
21 from __future__ import absolute_import 21 from __future__ import absolute_import
22 22
23 import cgi
24 import re 23 import re
25 24
26 from .i18n import _ 25 from .i18n import _
27 from . import ( 26 from . import (
28 encoding, 27 encoding,
29 pycompat, 28 pycompat,
29 url,
30 util, 30 util,
31 ) 31 )
32 32
33 def section(s): 33 def section(s):
34 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s)) 34 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
550 out = [] 550 out = []
551 headernest = '' 551 headernest = ''
552 listnest = [] 552 listnest = []
553 553
554 def escape(s): 554 def escape(s):
555 return cgi.escape(s, True) 555 return url.escape(s, True)
556 556
557 def openlist(start, level): 557 def openlist(start, level):
558 if not listnest or listnest[-1][0] != start: 558 if not listnest or listnest[-1][0] != start:
559 listnest.append((start, level)) 559 listnest.append((start, level))
560 out.append('<%s>\n' % start) 560 out.append('<%s>\n' % start)