aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/__init__.py4
-rw-r--r--markdown/blockprocessors.py8
-rw-r--r--markdown/inlinepatterns.py12
-rw-r--r--markdown/preprocessors.py7
4 files changed, 14 insertions, 17 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 9aa3432..107f702 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -234,8 +234,8 @@ class Markdown(object):
)
# For backward compat (until deprecation)
# check that this is an extension.
- if ('.' not in ext_name and not (hasattr(module, 'makeExtension')
- or (class_name and hasattr(module, class_name)))):
+ if ('.' not in ext_name and not (hasattr(module, 'makeExtension') or
+ (class_name and hasattr(module, class_name)))):
# We have a name conflict
# eg: extensions=['tables'] and PyTables is installed
raise ImportError
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py
index a516fb4..29db022 100644
--- a/markdown/blockprocessors.py
+++ b/markdown/blockprocessors.py
@@ -231,8 +231,8 @@ class CodeBlockProcessor(BlockProcessor):
sibling = self.lastChild(parent)
block = blocks.pop(0)
theRest = ''
- if (sibling is not None and sibling.tag == "pre"
- and len(sibling) and sibling[0].tag == "code"):
+ if (sibling is not None and sibling.tag == "pre" and
+ len(sibling) and sibling[0].tag == "code"):
# The previous block was a code block. As blank lines do not start
# new code blocks, append this block to the previous, adding back
# linebreaks removed from the split into a list.
@@ -517,8 +517,8 @@ class EmptyBlockProcessor(BlockProcessor):
# Add remaining lines to master blocks for later.
blocks.insert(0, theRest)
sibling = self.lastChild(parent)
- if (sibling is not None and sibling.tag == 'pre'
- and len(sibling) and sibling[0].tag == 'code'):
+ if (sibling is not None and sibling.tag == 'pre' and
+ len(sibling) and sibling[0].tag == 'code'):
# Last block is a codeblock. Append to preserve whitespace.
sibling[0].text = util.AtomicString(
'%s%s' % (sibling[0].text, filler)
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 27690bf..95d358d 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -94,10 +94,10 @@ The actual regular expressions for patterns
NOBRACKET = r'[^\]\[]*'
BRK = (
- r'\[('
- + (NOBRACKET + r'(\[')*6
- + (NOBRACKET + r'\])*')*6
- + NOBRACKET + r')\]'
+ r'\[(' +
+ (NOBRACKET + r'(\[')*6 +
+ (NOBRACKET + r'\])*')*6 +
+ NOBRACKET + r')\]'
)
NOIMG = r'(?<!\!)'
@@ -162,8 +162,8 @@ LINE_BREAK_RE = r' \n'
def dequote(string):
"""Remove quotes from around a string."""
- if ((string.startswith('"') and string.endswith('"'))
- or (string.startswith("'") and string.endswith("'"))):
+ if ((string.startswith('"') and string.endswith('"')) or
+ (string.startswith("'") and string.endswith("'"))):
return string[1:-1]
else:
return string
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py
index 9330a91..7fd38d3 100644
--- a/markdown/preprocessors.py
+++ b/markdown/preprocessors.py
@@ -216,14 +216,11 @@ class HtmlBlockPreprocessor(Preprocessor):
block)
# keep checking conditions below and maybe just append
- if data_index < len(block) \
- and (util.isBlockLevel(left_tag)
- or left_tag == '--'):
+ if data_index < len(block) and (util.isBlockLevel(left_tag) or left_tag == '--'):
text.insert(0, block[data_index:])
block = block[:data_index]
- if not (util.isBlockLevel(left_tag)
- or block[1] in ["!", "?", "@", "%"]):
+ if not (util.isBlockLevel(left_tag) or block[1] in ["!", "?", "@", "%"]):
new_blocks.append(block)
continue