Skip to content

Commit

Permalink
fix DeprecationWarning: invalid escape sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
d9pouces authored and waylan committed Jul 25, 2017
1 parent b7db1ec commit a1c2008
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions markdown/inlinepatterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def build_inlinepatterns(md_instance, **kwargs):
SHORT_REF_RE = NOIMG + r'\[([^\]]+)\]'

# ![alt text][2]
IMAGE_REFERENCE_RE = r'\!' + BRK + '\s?\[([^\]]*)\]'
IMAGE_REFERENCE_RE = r'\!' + BRK + r'\s?\[([^\]]*)\]'

# stand-alone * or _
NOT_STRONG_RE = r'((^| )(\*|_)( |$))'
Expand Down Expand Up @@ -170,7 +170,7 @@ def dequote(string):
return string


ATTR_RE = re.compile("\{@([^\}]*)=([^\}]*)}") # {@id=123}
ATTR_RE = re.compile(r"\{@([^\}]*)=([^\}]*)}") # {@id=123}


def handleAttributes(text, parent):
Expand Down Expand Up @@ -351,7 +351,7 @@ def get_stash(m):
try:
return self.markdown.serializer(value)
except:
return '\%s' % value
return r'\%s' % value

return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)

Expand Down
2 changes: 1 addition & 1 deletion markdown/postprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run(self, text):
class UnescapePostprocessor(Postprocessor):
""" Restore escaped chars """

RE = re.compile('%s(\d+)%s' % (util.STX, util.ETX))
RE = re.compile(r'%s(\d+)%s' % (util.STX, util.ETX))

def unescape(self, m):
return util.int2str(int(m.group(1)))
Expand Down

0 comments on commit a1c2008

Please sign in to comment.