diff --git a/py-packages/markslider/markslider/markslider.py b/py-packages/markslider/markslider/markslider.py index d211749..9b25211 100755 --- a/py-packages/markslider/markslider/markslider.py +++ b/py-packages/markslider/markslider/markslider.py @@ -20,7 +20,7 @@ """Markslider: a slideshow engine based on markdown.""" __author__ = "Ville Rantanen " -__version__ = "1.3.1" +__version__ = "1.3.2" import sys, os, argparse, re, datetime from argparse import ArgumentParser @@ -73,8 +73,8 @@ class slide_reader: self.max_width = None self.max_height = None self.data = [] - self.re_image_convert = re.compile("(.*)(!\[.*\])\((.*)\)>") - self.re_command = re.compile("(.*)`(.*)`>(.*)") + self.re_image_convert = re.compile(r"(.*)(!\[.*\])\((.*)\)>") + self.re_command = re.compile(r"(.*)`(.*)`>(.*)") # ~ self.control_chars = ''.join(map(unichr, range(0,32) + range(127,160))) # ~ self.control_char_re = re.compile('[%s]' % re.escape(self.control_chars)) self.background = [] @@ -207,19 +207,19 @@ class slide_reader: if self.opts.toc_depth > 1: for line in page: title = line.strip("# ") - if re.search("^##[^#]", line): + if re.search(r"^##[^#]", line): subh = [subh[0] + 1, 0, 0] TOC.append(" %d.%d. %s" % (h1 + 1, subh[0], title)) if self.opts.toc_depth == 2: continue - if re.search("^###[^#]", line): + if re.search(r"^###[^#]", line): subh = [subh[0], subh[1] + 1, 0] TOC.append( " %d.%d.%d. %s" % (h1 + 1, subh[0], subh[1], title) ) if self.opts.toc_depth == 3: continue - if re.search("^####[^#]", line): + if re.search(r"^####[^#]", line): subh = [subh[0], subh[1], subh[2] + 1] TOC.append( " %d.%d.%d.%d. %s" @@ -863,7 +863,7 @@ def colorify(s, opts): def cut_line(s, i): """cut a color tagged string, and remove control chars""" s = s[:i] - s = re.sub("\$$", "", re.sub("\$\{$", "", re.sub("\$\{.$", "", s))) + s = re.sub(r"\$$", "", re.sub(r"\$\{$", "", re.sub(r"\$\{.$", "", s))) return s @@ -888,16 +888,16 @@ def launch(reader, opts, offset): return s = reader.get_current_page()[offset[1]] urls = re.findall( - "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", + r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", s, ) - images = re.findall("!\[[^]]+\]\([^\)]+\)", s) + images = re.findall(r"!\[[^]]+\]\([^\)]+\)", s) # sanity check if s.find("`") == -1 and len(urls) == 0 and len(images) == 0: return - run_command = re.match("(.*)`(.*)`!(.*)", s) - show_command = re.match("(.*)`(.*)`>(.*)", s) + run_command = re.match(r"(.*)`(.*)`!(.*)", s) + show_command = re.match(r"(.*)`(.*)`>(.*)", s) if show_command != None: output = subprocess.check_output(show_command.group(2).strip(), shell=True) if type(output) == bytes: @@ -936,7 +936,7 @@ def launch(reader, opts, offset): ) return if len(images) > 0: - image = re.sub(".*\(([^\)]+)\).*", "\\1", images[0]) + image = re.sub(r".*\(([^\)]+)\).*", "\\1", images[0]) subprocess.call( "%s '%s' &" % (