summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/trac2md.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/tools/trac2md.py b/tools/trac2md.py
index 628f0c0..03d8861 100755
--- a/tools/trac2md.py
+++ b/tools/trac2md.py
@@ -162,16 +162,9 @@ def WikiToMD(content):
#
# Convert bullet lists. The start and end of a list needs
- # an empty line. wikiformat uses both '*' and '-' for its
- # lists. However, markdown only supports '*'.
+ # an empty line.
#
- if line.startswith('- '):
- if not in_list:
- new_content.append("\n")
- in_list = True
- line = line[1:]
- line = '*%s' % (line)
- elif line.startswith('* '):
+ if line.startswith('- ') or line.startswith('* '):
# No need to modify the line, just add the new line
if not in_list:
new_content.append("\n")
@@ -179,8 +172,7 @@ def WikiToMD(content):
elif line.startswith(' '):
# Check for nested lists
nested_line = line.lstrip(' ')
- if nested_line.startswith('* ') or \
- nested_line.startswith('- '):
+ if nested_line.startswith('* ') or nested_line.startswith('- '):
# Adjust the nested list level as needed
indent = len(line) - len(nested_line)
if indent > prev_indent:
@@ -190,8 +182,7 @@ def WikiToMD(content):
prev_indent = indent
# Set the proper indentation for markdown
- line = ('%s*%s' % (' ' * nested_level,
- nested_line[1:]))
+ line = ' ' * nested_level + nested_line
else:
if in_list:
# Add the closing empty line