Switch to unified view

a/scripts/teamforge-import.py b/scripts/teamforge-import.py
...
...
553
553
554
bracket_macro = re.compile(r'\[(.*?)\]')
554
bracket_macro = re.compile(r'\[(.*?)\]')
555
h1 = re.compile(r'^!!!', re.MULTILINE)
555
h1 = re.compile(r'^!!!', re.MULTILINE)
556
h2 = re.compile(r'^!!', re.MULTILINE)
556
h2 = re.compile(r'^!!', re.MULTILINE)
557
h3 = re.compile(r'^!', re.MULTILINE)
557
h3 = re.compile(r'^!', re.MULTILINE)
558
re_stats = re.compile(r'#+ .* [Ss]tatistics\n+(.*\[sf:.*?Statistics\].*)+\n')
558
def wiki2markdown(markup):
559
def wiki2markdown(markup):
559
    '''
560
    '''
560
    Partial implementation of http://help.collab.net/index.jsp?topic=/teamforge520/reference/wiki-wikisyntax.html
561
    Partial implementation of http://help.collab.net/index.jsp?topic=/teamforge520/reference/wiki-wikisyntax.html
561
    '''
562
    '''
562
    def bracket_handler(matchobj):
563
    def bracket_handler(matchobj):
...
...
576
            return '<%s>' % snippet
577
            return '<%s>' % snippet
577
    markup = bracket_macro.sub(bracket_handler, markup)
578
    markup = bracket_macro.sub(bracket_handler, markup)
578
    markup = h1.sub('#', markup)
579
    markup = h1.sub('#', markup)
579
    markup = h2.sub('##', markup)
580
    markup = h2.sub('##', markup)
580
    markup = h3.sub('###', markup)
581
    markup = h3.sub('###', markup)
582
    markup = re_stats.sub('', markup)
581
    return markup
583
    return markup
582
584
583
def find_image_references(markup):
585
def find_image_references(markup):
584
    'yields filenames'
586
    'yields filenames'
585
    for matchobj in bracket_macro.finditer(markup):
587
    for matchobj in bracket_macro.finditer(markup):
...
...
774
    '''
776
    '''
775
777
776
    new_markup = wiki2markdown(markup)
778
    new_markup = wiki2markdown(markup)
777
    assert '\n[[img src=myimage.jpg]]\n[[img src=anotherimage.jpg]]\n' in new_markup
779
    assert '\n[[img src=myimage.jpg]]\n[[img src=anotherimage.jpg]]\n' in new_markup
778
    assert '\n###this is the first' in new_markup
780
    assert '\n###this is the first' in new_markup
779
    assert '\n# Project Statistics' in new_markup
780
    assert '<http://www.google.com>' in new_markup
781
    assert '<http://www.google.com>' in new_markup
781
    assert '[SourceForge ](http://www.sf.net)' in new_markup
782
    assert '[SourceForge ](http://www.sf.net)' in new_markup
783
    assert '\n# Project Statistics' not in new_markup
782
    assert '[sf:frsStatistics]' in new_markup
784
    assert '[sf:frsStatistics]' not in new_markup