Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,16 @@ def trac2markdown(text, base_path, multilines = True, trac_ticket_url=None) :
line = re.sub(r'\#([1-9]\d{0,4})', r'[#\1](%s/\1)' % trac_ticket_url, line)
if line.startswith('||'):
if not is_table:
sep = re.sub(r'[^|]', r'-', line)
sep = re.sub(r'\|\|=', r'||:', line) # take care of left align
sep = re.sub(r'=\|\|', r':||', sep) # take care of right align
sep = re.sub(r'[^|,^:]', r'-', sep)
line = line + '\n' + sep
is_table = True
# The wiki markup allows the alignment directives to be specified on a cell-by-cell
# basis. This is used in many examples. AFAIK this can't be properly translated into
# the GitHub markdown as it only allows to align statements column by column.
line = re.sub(r'\|\|=', r'||', line) # ignore cellwise align instructions
line = re.sub(r'=\|\|', r'||', line) # ignore cellwise align instructions
line = re.sub(r'\|\|', r'|', line)
else:
is_table = False
Expand Down