Put regex multiline specifier at beginning of regex string

Python 3.11 appears to want global regex options to be set at the
beginning of the regex string. Setting them elsewhere results in:

  re.error: global flags not at the start of the expression at position foo

A followup change will switch lodgeit over to python3.11 making this
necessary cleanup beforehand.

Change-Id: Idc21e39f7f4e3a9a3bcdc657f0fd6b352a20d617
This commit is contained in:
Clark Boylan 2023-10-09 11:50:26 -07:00
parent 5f6c89b500
commit ac772da1f6
1 changed files with 2 additions and 2 deletions

View File

@ -62,8 +62,8 @@ STYLES = dict((x, x.title()) for x in get_all_styles())
DEFAULT_STYLE = 'friendly'
_section_marker_re = re.compile(r'^(?<!\\)###\s*(.*?)(?:\[(.+?)\])?\s*$(?m)')
_escaped_marker = re.compile(r'^\\(?=###)(?m)')
_section_marker_re = re.compile(r'(?m)^(?<!\\)###\s*(.*?)(?:\[(.+?)\])?\s*$')
_escaped_marker = re.compile(r'(?m)^\\(?=###)')
def highlight(code, language, _preview=False, _linenos=True):