##// END OF EJS Templates
minirst: make regular expressions bytes
Pulkit Goyal -
r31317:0bd32d7c default
parent child Browse files
Show More
@@ -64,7 +64,7 b' def replace(text, substs):'
64 64 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
65 65 return utext.encode(encoding.encoding)
66 66
67 _blockre = re.compile(r"\n(?:\s*\n)+")
67 _blockre = re.compile(br"\n(?:\s*\n)+")
68 68
69 69 def findblocks(text):
70 70 """Find continuous blocks of lines in text.
@@ -138,12 +138,12 b' def findliteralblocks(blocks):'
138 138 i += 1
139 139 return blocks
140 140
141 _bulletre = re.compile(r'(\*|-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
142 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
143 r'((.*) +)(.*)$')
144 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
145 _definitionre = re.compile(r'[^ ]')
146 _tablere = re.compile(r'(=+\s+)*=+')
141 _bulletre = re.compile(br'(\*|-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
142 _optionre = re.compile(br'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
143 br'((.*) +)(.*)$')
144 _fieldre = re.compile(br':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
145 _definitionre = re.compile(br'[^ ]')
146 _tablere = re.compile(br'(=+\s+)*=+')
147 147
148 148 def splitparagraphs(blocks):
149 149 """Split paragraphs into lists."""
@@ -286,7 +286,7 b' def prunecontainers(blocks, keep):'
286 286 i += 1
287 287 return blocks, pruned
288 288
289 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
289 _sectionre = re.compile(br"""^([-=`:.'"~^_*+#])\1+$""")
290 290
291 291 def findtables(blocks):
292 292 '''Find simple tables
@@ -432,7 +432,7 b' def findadmonitions(blocks, admonitions='
432 432 """
433 433 admonitions = admonitions or _admonitions
434 434
435 admonitionre = re.compile(r'\.\. (%s)::' % '|'.join(sorted(admonitions)),
435 admonitionre = re.compile(br'\.\. (%s)::' % '|'.join(sorted(admonitions)),
436 436 flags=re.IGNORECASE)
437 437
438 438 i = 0
General Comments 0
You need to be logged in to leave comments. Login now