From a1c200899c942a8e37880c2b3c59e02770ade7ac Mon Sep 17 00:00:00 2001 From: d9pouces Date: Tue, 25 Jul 2017 08:30:05 +0200 Subject: fix DeprecationWarning: invalid escape sequence --- markdown/inlinepatterns.py | 6 +++--- markdown/postprocessors.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index 218b416..f9d0610 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -140,7 +140,7 @@ REFERENCE_RE = NOIMG + BRK + r'\s?\[([^\]]*)\]' 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'((^| )(\*|_)( |$))' @@ -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): @@ -351,7 +351,7 @@ class HtmlPattern(Pattern): try: return self.markdown.serializer(value) except: - return '\%s' % value + return r'\%s' % value return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text) diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py index 8b311b2..7b9aa0b 100644 --- a/markdown/postprocessors.py +++ b/markdown/postprocessors.py @@ -102,7 +102,7 @@ class AndSubstitutePostprocessor(Postprocessor): 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))) -- cgit v1.2.3