aboutsummaryrefslogtreecommitdiffstats
path: root/markdown.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-11-13 15:26:44 -0500
committerWaylan Limberg <waylan@gmail.com>2008-11-13 23:27:55 -0500
commitb02b01dbf51c1409211703a4aa32aa6cff9164d7 (patch)
tree4291af429fd01ddb2ab4aaf3a2e58f77054576b1 /markdown.py
parent57a69d3bf45f41de4b9b2d646469436514be2475 (diff)
downloadmarkdown-b02b01dbf51c1409211703a4aa32aa6cff9164d7.tar.gz
markdown-b02b01dbf51c1409211703a4aa32aa6cff9164d7.tar.bz2
markdown-b02b01dbf51c1409211703a4aa32aa6cff9164d7.zip
Replaced all uses of 4 spaces with TAB_LENGTH in BlockParser.
Diffstat (limited to 'markdown.py')
-rwxr-xr-xmarkdown.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/markdown.py b/markdown.py
index 9a8e2d4..4441617 100755
--- a/markdown.py
+++ b/markdown.py
@@ -228,8 +228,8 @@ class BlockProcessor:
newtext = []
lines = text.split('\n')
for line in lines:
- if line.startswith(' '*4):
- newtext.append(line[4:])
+ if line.startswith(' '*TAB_LENGTH):
+ newtext.append(line[TAB_LENGTH:])
elif not line.strip():
newtext.append('')
else:
@@ -240,8 +240,8 @@ class BlockProcessor:
""" Remove a tab from front of lines but allowing dedented lines. """
lines = text.split('\n')
for i in range(len(lines)):
- if lines[i].startswith(' '*4):
- lines[i] = lines[i][4:]
+ if lines[i].startswith(' '*TAB_LENGTH):
+ lines[i] = lines[i][TAB_LENGTH:]
return '\n'.join(lines)
def test(self, parent, block):
@@ -301,7 +301,7 @@ class ListIndentProcessor(BlockProcessor):
"""
def test(self, parent, block):
- return block.startswith(' '*4) and \
+ return block.startswith(' '*TAB_LENGTH) and \
(parent.tag == "li" or \
(len(parent) and parent[-1] and \
(parent[-1].tag == "ul" or parent[-1].tag == "ol")
@@ -332,7 +332,7 @@ class CodeBlockProcessor(BlockProcessor):
""" Process code blocks. """
def test(self, parent, block):
- return block.startswith(' '*4)
+ return block.startswith(' '*TAB_LENGTH)
def run(self, parent, blocks):
sibling = self.lastChild(parent)
@@ -428,7 +428,7 @@ class OListProcessor(BlockProcessor):
# Loop through items in block, recursively parsing each with the
# appropriate parent.
for item in items:
- if item.startswith(' '*4):
+ if item.startswith(' '*TAB_LENGTH):
# Item is indented. Parse with last item as parent
self.parser.parseBlocks(lst[-1], [item])
else:
@@ -447,7 +447,7 @@ class OListProcessor(BlockProcessor):
items.append(m.group(3))
elif self.INDENT_RE.match(line):
# This is an indented (possibly nested) item.
- if items[-1].startswith(' '*4):
+ if items[-1].startswith(' '*TAB_LENGTH):
# Previous item was indented. Append to that item.
items[-1] = '%s\n%s' % (items[-1], line)
else: