How to use the tuna.main.render function in tuna

To help you get started, we’ve selected a few tuna examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / tuna / tuna / View on Github external
def main(argv=None):
    parser = _get_parser()
    args = parser.parse_args(argv)

    if args.outdir:
        data = read(args.infile)
        outdir = Path(args.outdir)
        if not outdir.is_dir():
        with open(outdir / "index.html", "wt") as out:
            out.write(render(data, args.infile))
        this_dir = Path(__file__).resolve().parent
        static_dir = outdir / "static"
        if static_dir.is_dir():
        shutil.copytree(this_dir / "web" / "static", static_dir)
        if args.browser:
                target=lambda: webbrowser.open_new_tab(outdir / "index.html")
        start_server(args.infile, args.browser, args.port)