diff options
author | Jan Holesovsky <kendy@suse.cz> | 2010-12-06 21:33:09 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-12-06 21:33:09 +0100 |
commit | 31de6bec62a0eb30062cf14b010c44c70486621a (patch) | |
tree | a6ae9c7c312389f8e311116b0c87893de8ad0e29 /helpcontent2/help-to-wiki.py | |
parent | f6f254c8f79d727fe3235a746ddd00a4b62e6595 (diff) |
wikihelp: wikiconv2 into a module. Don't generate redirects by default.
Diffstat (limited to 'helpcontent2/help-to-wiki.py')
-rwxr-xr-x | helpcontent2/help-to-wiki.py | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/helpcontent2/help-to-wiki.py b/helpcontent2/help-to-wiki.py index 9af54e59f3..05a5a074e5 100755 --- a/helpcontent2/help-to-wiki.py +++ b/helpcontent2/help-to-wiki.py @@ -1,10 +1,23 @@ #!/usr/bin/env python -import sys, os +import sys, os, getopt + +sys.path.append(sys.path[0]+"/to-wiki") +import wikiconv2 # FIXME do proper modules from getalltitles & wikiconv2 # [so far this is in fact just a shell thing] +def usage(): + print ''' +help-to-wiki.py - converts .xhp files into a wiki + +-h, --help - this help +-r, --redirects - generate also redirect pages + +Most probably, you want to generate the redirects only once when you initially +populate the wiki, and then only update the ones that broke.\n''' + def create_wiki_dirs(): dirs = [ "Common", @@ -37,16 +50,27 @@ def create_wiki_dirs(): except: pass -# do the work +# Argument handling +try: + opts, args = getopt.getopt(sys.argv[1:], 'hr', ['help', 'redirects']) +except getopt.GetoptError: + usage() + sys.exit(1) + +generate_redirects = False +for opt, arg in opts: + if opt in ('-h', '--help'): + usage() + sys.exit() + elif opt in ('-r', '--redirects'): + generate_redirects = True + +# Do the work create_wiki_dirs() print "Generating the titles..." os.system( "python to-wiki/getalltitles.py source/text > alltitles.csv" ) -print "Generating the wiki itself..." -localization = "" -if len(sys.argv) > 1: - localization = sys.argv[1] -os.system( "python to-wiki/wikiconv2.py "+localization ) +wikiconv2.convert(generate_redirects, args) # vim:set shiftwidth=4 softtabstop=4 expandtab: |