Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
validate_args(args)
except RuntimeError as e:
print(e)
sys.exit(1)
if args["type"] == "html":
renderer = Renderer(mistune.Renderer)
outputfile = "index.html"
try:
template = read_template(find_data_file(args["template"], '.handlebars', TEMPLATES_SUBDIR))
except IOError:
print("Cannot open template file " + args["template"])
sys.exit(1)
else:
renderer = Renderer(pcbdraw.mdrenderer.MdRenderer)
outputfile = "index.md"
content = parse_content(renderer, content)
content = generate_images(content, args["board"], args["libs"],
args["params"], args["img_name"], args["output"])
if args["type"] == "html":
output = generate_html(template, content)
else:
output = generate_markdown(content)
with open(os.path.join(args["output"], outputfile), "wb") as f:
f.write(output)