diff --git a/.gitignore b/.gitignore index 9035255..e1bb1f7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ result addresses.csv addresses.*.csv /content +/output cache/ *.pyc diff --git a/format.py b/format.py index b6a149b..b15c359 100755 --- a/format.py +++ b/format.py @@ -213,11 +213,16 @@ parser.add_argument( ) parser.add_argument( + "-N", "--no-nixowos", action="store_true", help="Don't print nixowos (e.g. if it would go over stamp)", ) +parser.add_argument( + "-g", "--svg", action="store_true", help="Output SVG files instead of PDF" +) + parser.add_argument("-w", "--watch", action="store_true", help="Watch input files") @@ -381,6 +386,13 @@ if args.dont_compile: font_paths = os.getenv("TYPST_FONT_PATHS") assert font_paths is not None +if args.svg: + if os.path.exists(root_dir() / "output"): + for f in (root_dir() / "output").glob("*.svg"): + os.remove(f) + else: + os.mkdir(root_dir() / "output") + typst_args = [ "typst", "watch" if args.watch else "compile", @@ -391,7 +403,7 @@ typst_args = [ "--font-path", font_paths, args.template, - "output.pdf", + root_dir() / "output" / "{n}.svg" if args.svg else "output.pdf", ] # print(*typst_args)