2017-01-19 17:27:41 +01:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
from src.dokuwiki_to_hugo import DokuWikiToHugo
|
|
|
|
|
|
|
|
|
2018-08-04 17:09:20 +02:00
|
|
|
def str2bool(v):
|
|
|
|
if v.lower() in ('yes', 'true', 't', 'y', '1'):
|
|
|
|
return True
|
|
|
|
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
raise argparse.ArgumentTypeError('Boolean value expected.')
|
|
|
|
|
|
|
|
def main(directory, options):
|
2018-08-04 17:40:36 +02:00
|
|
|
DokuWikiToHugo(options.root, frontmatter_tags=options.frontmatter_tags).doku_to_hugo(directory)
|
2017-01-30 16:09:23 +01:00
|
|
|
|
2017-01-19 17:27:41 +01:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
parser = argparse.ArgumentParser()
|
2017-01-30 16:09:23 +01:00
|
|
|
parser.add_argument("-d", "--dir", help="the directory of your DokuWiki pages collection", required=True)
|
|
|
|
parser.add_argument("-r", "--root", help="the root directory name in your hugo content where to link to",
|
|
|
|
required=False)
|
2018-08-04 17:40:36 +02:00
|
|
|
parser.add_argument("--frontmatter_tags", default=True, type=str2bool,
|
|
|
|
help="whether to generate tags in front matter in the converted markdown.")
|
2017-01-19 17:27:41 +01:00
|
|
|
opts = parser.parse_args()
|
2018-08-04 17:09:20 +02:00
|
|
|
main(opts.dir, opts)
|