code reuse: fill pages dict to convert
This commit is contained in:
parent
fb47aaa8a0
commit
5313705a0a
1 changed files with 10 additions and 11 deletions
21
moin2doku.py
21
moin2doku.py
|
@ -275,14 +275,12 @@ init_dirs(output_dir)
|
||||||
|
|
||||||
dw = DokuWiki()
|
dw = DokuWiki()
|
||||||
request = RequestCLI()
|
request = RequestCLI()
|
||||||
|
pages = {}
|
||||||
|
|
||||||
if convert_page != None:
|
if convert_page != None:
|
||||||
pagename = wikiname(convert_page)
|
pagename = wikiname(convert_page)
|
||||||
page = Page(request, pagename)
|
pages[pagename] = Page(request, pagename)
|
||||||
res = convertfile(page, overwrite = overwrite)
|
|
||||||
else:
|
else:
|
||||||
converted = 0
|
|
||||||
|
|
||||||
filter = None
|
filter = None
|
||||||
if page_filter:
|
if page_filter:
|
||||||
def name_filter(name):
|
def name_filter(name):
|
||||||
|
@ -303,13 +301,14 @@ else:
|
||||||
del pages[frontpage.page_name]
|
del pages[frontpage.page_name]
|
||||||
pages[dw.getId()] = frontpage
|
pages[dw.getId()] = frontpage
|
||||||
|
|
||||||
for pagename, page in pages.items():
|
converted = 0
|
||||||
print "%s" % page.getPagePath()
|
for pagename, page in pages.items():
|
||||||
res = convertfile(page, output = pagename, overwrite = overwrite)
|
print "%s" % page.getPagePath()
|
||||||
if res != None:
|
res = convertfile(page, output = pagename, overwrite = overwrite)
|
||||||
print "Converted: %s" % pagename
|
if res != None:
|
||||||
converted += 1
|
print "Converted: %s" % pagename
|
||||||
print "Processed %d files, converted %d" % (len(pages), converted)
|
converted += 1
|
||||||
|
print "Processed %d files, converted %d" % (len(pages), converted)
|
||||||
|
|
||||||
if redirect_conf:
|
if redirect_conf:
|
||||||
print "Writing %s: %d items" % (redirect_conf, len(redirect_map))
|
print "Writing %s: %d items" % (redirect_conf, len(redirect_map))
|
||||||
|
|
Loading…
Reference in a new issue