def generate_wiki(): """Automatically generate wiki pages.""" git_pull() sys.path += ['/Users/jaakko/Scripts'] import dew dew.login() # Today's event data. ev = builder.Event(latestAvailable=True) if ev.release_type() == 'stable': dew.submitPage('Latest Doomsday release', '#REDIRECT [[Doomsday version %s]]' % ev.version()) dew.logout()
indexPage[mode] += '|}\n' for m in modes: indexPage[m] += '\n[[Category:Console]]\n[[Category:References]]\n' if isDryRun: print indexPage['command'] print indexPage['variable'] for amb in ambigs: print amb.title print amb.content sys.exit() dew.login() dew.submitPage('Console command reference', indexPage['command'], comment) dew.submitPage('Console variable reference', indexPage['variable'], comment) print 'Submitting deambiguation pages...' for amb in ambigs: print '-', amb.title dew.submitPage(amb.title, amb.content, comment) print 'Submitting pages...' for col in collections: pages = pagesForCollection[col] count = len(pages)
print('Generating %i documents for Doomsday %s...' % (len(pages), version)) content = [] for page in pages: ame_path = os.path.join(src_root, page[2]) ame_dir = os.path.dirname(ame_path) src = open(ame_path, 'rt').read() opts = page[1] + ['-i' + ame_dir] content.append((page[0], amethyst(src, ame_opts=opts))) if is_dry_run: print(content) sys.exit() dew.login() print('Writing %i pages to Manual:' % len(content)) for c in content: print('... %s' % c[0]) dew.submit_page(c[0], c[1], comment) #dew.submitPage('Console command reference', indexPage['command'], comment) #dew.submitPage('Console variable reference', indexPage['variable'], comment) # # print 'Submitting deambiguation pages...' # # for amb in ambigs: # print '-', amb.title # dew.submitPage(amb.title, amb.content, comment)