Пример #1
0
def migrate_wiki(trac_wiki, gitlab, output_dir):
    for title, wiki in six.iteritems(trac_wiki):
        page = wiki['page']
        attachments = wiki['attachments']
        author = wiki['attributes']['author']
        version = wiki['attributes']['version']
        last_modified = wiki['attributes']['lastModified']
        if title == 'WikiStart':
            title = 'home'
        converted_page = trac2down.convert(
            page, os.path.dirname('/wikis/%s' % title))
        orphaned = []
        for filename, data in six.iteritems(attachments):
            name = filename.split('/')[-1]
            gitlab.save_wiki_attachment(name, data)
            converted_page = \
                converted_page.replace(r'migrated/%s)' % filename,
                                       r'migrated/%s)' % name)
            if '%s)' % name not in converted_page:
                orphaned.append(name)
            LOG.debug('migrated attachment %s @ %s', title, filename)
        # Add orphaned attachments to page
        if orphaned:
            converted_page += '\n\n'
            converted_page += '##### During migration the following orphaned attachments have been found:\n'
            for f in orphaned:
                converted_page += '- [%s](/uploads/migrated/%s)\n' % (f, f)
        # Writeout!
        trac2down.save_file(converted_page, title, version, last_modified,
                            author, output_dir)
        LOG.debug('migrated wiki page %s', title)
Пример #2
0
def _wikiconvert(text,
                 basepath,
                 multiline=True,
                 note_map={},
                 attachments_path=None,
                 svn2git_revisions={}):
    return trac2down.convert(text,
                             basepath,
                             multiline,
                             note_map=note_map,
                             attachments_path=attachments_path,
                             svn2git_revisions=svn2git_revisions)
Пример #3
0
def _wikiconvert(text, basepath, multiline=True, gitlab_ref="_todo_"):
    return trac2down.convert(_wikifix(text), basepath, multiline, gitlab_ref)
Пример #4
0
def _wikiconvert(text, basepath, multiline=True):
    return trac2down.convert(_wikifix(text), basepath, multiline)