From 5313705a0a485be392dc9819d6a21ffe26efc750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 22 Sep 2012 21:58:01 +0200 Subject: [PATCH] code reuse: fill pages dict to convert --- moin2doku.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/moin2doku.py b/moin2doku.py index 9c7428b..d4e6c39 100755 --- a/moin2doku.py +++ b/moin2doku.py @@ -275,14 +275,12 @@ init_dirs(output_dir) dw = DokuWiki() request = RequestCLI() +pages = {} if convert_page != None: pagename = wikiname(convert_page) - page = Page(request, pagename) - res = convertfile(page, overwrite = overwrite) + pages[pagename] = Page(request, pagename) else: - converted = 0 - filter = None if page_filter: def name_filter(name): @@ -303,13 +301,14 @@ else: del pages[frontpage.page_name] pages[dw.getId()] = frontpage - for pagename, page in pages.items(): - print "%s" % page.getPagePath() - res = convertfile(page, output = pagename, overwrite = overwrite) - if res != None: - print "Converted: %s" % pagename - converted += 1 - print "Processed %d files, converted %d" % (len(pages), converted) +converted = 0 +for pagename, page in pages.items(): + print "%s" % page.getPagePath() + res = convertfile(page, output = pagename, overwrite = overwrite) + if res != None: + print "Converted: %s" % pagename + converted += 1 +print "Processed %d files, converted %d" % (len(pages), converted) if redirect_conf: print "Writing %s: %d items" % (redirect_conf, len(redirect_map))