aboutsummaryrefslogtreecommitdiffstats
path: root/markdown
diff options
context:
space:
mode:
authorKar Epker <karepker+services@gmail.com>2015-06-01 18:29:30 -0400
committerKar Epker <karepker+services@gmail.com>2015-06-01 18:29:30 -0400
commitd3cc9895fee28161f2537c0cbedf75b89cfd0a89 (patch)
tree1d211a0183871607e87b607c1bbfe6d48273ded0 /markdown
parentcced40a37862de25c74f805dcb23fe3dd84766d5 (diff)
downloadmarkdown-d3cc9895fee28161f2537c0cbedf75b89cfd0a89.tar.gz
markdown-d3cc9895fee28161f2537c0cbedf75b89cfd0a89.tar.bz2
markdown-d3cc9895fee28161f2537c0cbedf75b89cfd0a89.zip
Changed formatting of regex strings. Fixed flake8 issues.
Diffstat (limited to 'markdown')
-rw-r--r--markdown/blockprocessors.py19
-rw-r--r--markdown/extensions/sane_lists.py10
2 files changed, 10 insertions, 19 deletions
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py
index 43a384d..d4bb2ac 100644
--- a/markdown/blockprocessors.py
+++ b/markdown/blockprocessors.py
@@ -311,18 +311,13 @@ class OListProcessor(BlockProcessor):
def __init__(self, parser):
BlockProcessor.__init__(self, parser)
# Detect an item (``1. item``). ``group(1)`` contains contents of item.
- self.RE = re.compile(
- ''.join([r'^[ ]{0,', str(self.tab_length - 1),
- r'}\d+\.[ ]+(.*)']))
+ self.RE = re.compile(r'^[ ]{0,%d}\d+\.[ ]+(.*)' % (self.tab_length - 1))
# Detect items on secondary lines. they can be of either list type.
- self.CHILD_RE = re.compile(
- ''.join([r'^[ ]{0,', str(self.tab_length - 1),
- r'}((\d+\.)|[*+-])[ ]+(.*)']))
+ self.CHILD_RE = re.compile(r'^[ ]{0,%d}((\d+\.)|[*+-])[ ]+(.*)' %
+ (self.tab_length - 1))
# Detect indented (nested) items of either type
- self.INDENT_RE = re.compile(
- ''.join([r'^[ ]{', str(self.tab_length), ',',
- str(self.tab_length * 2 - 1),
- r'}((\d+\.)|[*+-])[ ]+.*']))
+ self.INDENT_RE = re.compile(r'^[ ]{%d,%d}((\d+\.)|[*+-])[ ]+.*' %
+ (self.tab_length, self.tab_length * 2 - 1))
def test(self, parent, block):
return bool(self.RE.match(block))
@@ -421,9 +416,7 @@ class UListProcessor(OListProcessor):
def __init__(self, parser):
OListProcessor.__init__(self, parser)
# Detect an item (``1. item``). ``group(1)`` contains contents of item.
- self.RE = re.compile(
- ''.join([r'^[ ]{0,', str(self.tab_length - 1),
- r'}[*+-][ ]+(.*)']))
+ self.RE = re.compile(r'^[ ]{0,%d}[*+-][ ]+(.*)' % (self.tab_length - 1))
class HashHeaderProcessor(BlockProcessor):
diff --git a/markdown/extensions/sane_lists.py b/markdown/extensions/sane_lists.py
index f464ac0..3b2da05 100644
--- a/markdown/extensions/sane_lists.py
+++ b/markdown/extensions/sane_lists.py
@@ -28,9 +28,8 @@ class SaneOListProcessor(OListProcessor):
def __init__(self, parser):
OListProcessor.__init__(self, parser)
- self.CHILD_RE = re.compile(
- ''.join([r'^[ ]{0,', str(self.tab_length - 1),
- r'}((\d+\.))[ ]+(.*)']))
+ self.CHILD_RE = re.compile(r'^[ ]{0,%d}((\d+\.))[ ]+(.*)' %
+ (self.tab_length - 1))
class SaneUListProcessor(UListProcessor):
@@ -39,9 +38,8 @@ class SaneUListProcessor(UListProcessor):
def __init__(self, parser):
UListProcessor.__init__(self, parser)
- self.CHILD_RE = re.compile(
- ''.join([r'^[ ]{0,', str(self.tab_length - 1),
- r'}(([*+-]))[ ]+(.*)']))
+ self.CHILD_RE = re.compile(r'^[ ]{0,%d}(([*+-]))[ ]+(.*)' %
+ (self.tab_length - 1))
class SaneListExtension(Extension):