[Cryptech-Commits] [user/sra/pelican] 15/68: No, Gogs is fine with both "*" and "-", problem is something else.

git at cryptech.is git at cryptech.is
Mon Jul 19 22:24:54 UTC 2021


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch pelican
in repository user/sra/pelican.

commit 0e114758f6595b55eee51e498e048f2407874a5a
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Thu Mar 21 14:14:53 2019 +0000

    No, Gogs is fine with both "*" and "-", problem is something else.
---
 tools/trac2md.py | 17 ++++-------------
 1 file 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



More information about the Commits mailing list