#115 Convert wiki/RST format to Markdown for Trac Ticket Migration
Opened by mreynolds. Modified
mreynolds/pagure-importer issue91  into  master

Download 115.patch

This patch convert a majority of wiki/RST formats to Markdown. It also strips the wikilink format from custom fields, and converts the trac priority to the Pagure priority format.

1 new commit added

  • Fix pep8 errors

This method is around 120 lines of code, which makes it challenging to read. I recommend breaking it into smaller helper methods so that each logical component is easier to understand, and most importantly, easier to test.

Would you not want to replace \r with \n?

This change looks reasonable to me. In addition to my other recommendations, I suggest writing automated tests for this code. It would help prove that it works as expected, and it actually seems like it could be a fun set of tests too.

Actually, in Trac I always see this pattern: "\r\n". I never see "\r" by itself

rebased

This is really helpful; thanks, @mreynolds.

It could also detect commit hashes and generate code links like Trac does. I used the following (which you are welcome to take in the event that there isn't a better way to do this):

def convert_hashes(line):
    hashes = re.findall(r"\b[0-9a-f]{40}\b", line)
    for h in hashes:
        line = line.replace(h, "[%s](/gssproxy/c/%s)" % (h[:7], h))
    return line

(Of course, "gssproxy" would need to be replaced with the correct project name.)

Metadata