|
|
@ -191,6 +191,11 @@ def main():
|
|
|
|
dest="output_dir",
|
|
|
|
dest="output_dir",
|
|
|
|
default=None,
|
|
|
|
default=None,
|
|
|
|
help="Output directory for module files")
|
|
|
|
help="Output directory for module files")
|
|
|
|
|
|
|
|
p.add_argument("-I", "--includes-file",
|
|
|
|
|
|
|
|
action="store",
|
|
|
|
|
|
|
|
dest="includes_file",
|
|
|
|
|
|
|
|
default=None,
|
|
|
|
|
|
|
|
help="Create a file containing list of processed modules")
|
|
|
|
p.add_argument("-G", "--generate",
|
|
|
|
p.add_argument("-G", "--generate",
|
|
|
|
action="store_true",
|
|
|
|
action="store_true",
|
|
|
|
dest="do_boilerplate",
|
|
|
|
dest="do_boilerplate",
|
|
|
@ -230,14 +235,20 @@ def main():
|
|
|
|
env.filters['jpfunc'] = latex_ify
|
|
|
|
env.filters['jpfunc'] = latex_ify
|
|
|
|
template = env.get_template('latex.j2')
|
|
|
|
template = env.get_template('latex.j2')
|
|
|
|
outputname = "%s.tex"
|
|
|
|
outputname = "%s.tex"
|
|
|
|
|
|
|
|
includecmt = "% generated code\n"
|
|
|
|
|
|
|
|
includefmt = "\\input %s\n"
|
|
|
|
if args.type == 'html':
|
|
|
|
if args.type == 'html':
|
|
|
|
env.filters['jpfunc'] = html_ify
|
|
|
|
env.filters['jpfunc'] = html_ify
|
|
|
|
template = env.get_template('html.j2')
|
|
|
|
template = env.get_template('html.j2')
|
|
|
|
outputname = "%s.html"
|
|
|
|
outputname = "%s.html"
|
|
|
|
|
|
|
|
includecmt = ""
|
|
|
|
|
|
|
|
includefmt = ""
|
|
|
|
if args.type == 'man':
|
|
|
|
if args.type == 'man':
|
|
|
|
env.filters['jpfunc'] = man_ify
|
|
|
|
env.filters['jpfunc'] = man_ify
|
|
|
|
template = env.get_template('man.j2')
|
|
|
|
template = env.get_template('man.j2')
|
|
|
|
outputname = "ansible.%s.man"
|
|
|
|
outputname = "ansible.%s.man"
|
|
|
|
|
|
|
|
includecmt = ""
|
|
|
|
|
|
|
|
includefmt = ""
|
|
|
|
if args.type == 'rst':
|
|
|
|
if args.type == 'rst':
|
|
|
|
env.filters['jpfunc'] = rst_ify
|
|
|
|
env.filters['jpfunc'] = rst_ify
|
|
|
|
env.filters['html_ify'] = html_ify
|
|
|
|
env.filters['html_ify'] = html_ify
|
|
|
@ -245,9 +256,17 @@ def main():
|
|
|
|
env.filters['xline'] = rst_xline
|
|
|
|
env.filters['xline'] = rst_xline
|
|
|
|
template = env.get_template('rst.j2')
|
|
|
|
template = env.get_template('rst.j2')
|
|
|
|
outputname = "%s.rst"
|
|
|
|
outputname = "%s.rst"
|
|
|
|
|
|
|
|
includecmt = ".. Generated by module_formatter\n"
|
|
|
|
|
|
|
|
includefmt = ".. include:: %s.rst\n"
|
|
|
|
if args.type == 'json':
|
|
|
|
if args.type == 'json':
|
|
|
|
env.filters['jpfunc'] = json_ify
|
|
|
|
env.filters['jpfunc'] = json_ify
|
|
|
|
outputname = "%s.json"
|
|
|
|
outputname = "%s.json"
|
|
|
|
|
|
|
|
includecmt = ""
|
|
|
|
|
|
|
|
includefmt = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args.includes_file is not None and includefmt != "":
|
|
|
|
|
|
|
|
incfile = open(args.includes_file, "w")
|
|
|
|
|
|
|
|
incfile.write(includecmt)
|
|
|
|
|
|
|
|
|
|
|
|
for module in os.listdir(args.module_dir):
|
|
|
|
for module in os.listdir(args.module_dir):
|
|
|
|
if len(args.module_list):
|
|
|
|
if len(args.module_list):
|
|
|
@ -270,6 +289,9 @@ def main():
|
|
|
|
doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d')
|
|
|
|
doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d')
|
|
|
|
doc['ansible_version'] = args.ansible_version
|
|
|
|
doc['ansible_version'] = args.ansible_version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args.includes_file is not None and includefmt != "":
|
|
|
|
|
|
|
|
incfile.write(includefmt % module)
|
|
|
|
|
|
|
|
|
|
|
|
if args.verbose:
|
|
|
|
if args.verbose:
|
|
|
|
print json.dumps(doc, indent=4)
|
|
|
|
print json.dumps(doc, indent=4)
|
|
|
|
|
|
|
|
|
|
|
|