diff --git a/stepup/reprep/api.py b/stepup/reprep/api.py index d789c609..8fc2d20c 100644 --- a/stepup/reprep/api.py +++ b/stepup/reprep/api.py @@ -378,7 +378,7 @@ def compile_typst( !!! warning - This feature will only work well with Typst 0.14 or later. + This feature only works with typst 0.15 or newer. Support for Typst in StepUp RepRep is experimental. Expect breaking changes in future releases. @@ -388,12 +388,6 @@ def compile_typst( These images are not rendered, neither are they included in the dep file. This currently being addressed in the following issue: https://github.com/typst/typst/issues/6858 - - When the typst compiler detects an error in the input, it doesn't write the dep file. - While this is the desirable behavior for Make-like tools, it does not work well in StepUp. - This issue is fixed in the main branch of typst, but not yet in a released version: - https://github.com/typst/typst/pull/7209 - After the next release of Typst, StepUp RepRep will be updated to use of JSON dep files: - https://github.com/reproducible-reporting/stepup-reprep/pull/22 Parameters ---------- @@ -449,7 +443,7 @@ def compile_typst( dest = subs(dest) if not path_typ.endswith(".typ"): raise ValueError(f"The input of the typst command must end with .typ, got {path_typ}.") - path_out = make_path_out(path_typ, dest, ".pdf", [".svg", ".png"]) + path_out = make_path_out(path_typ, dest, ".pdf", [".svg", ".png", ".html"]) stem = path_typ[:-4] args = ["compile-typst"] @@ -462,7 +456,7 @@ def compile_typst( paths_out.append(path_out) if keep_deps or string_to_bool(getenv("REPREP_KEEP_TYPST_DEPS", "0")): args.append("--keep-deps") - paths_out.append(f"{stem}.dep") + paths_out.append(f"{stem}.deps.json") if inventory is None: inventory = string_to_bool(getenv("REPREP_TYPST_INVENTORY", "0")) if inventory is True: diff --git a/stepup/reprep/compile_typst.py b/stepup/reprep/compile_typst.py index eb3de933..ca11ff7e 100644 --- a/stepup/reprep/compile_typst.py +++ b/stepup/reprep/compile_typst.py @@ -22,18 +22,19 @@ This wrapper extracts relevant information from a Typst build to inform StepUp of input files used or needed. -This is tested with Typst 0.14. +This is tested with Typst 0.15. """ import argparse import contextlib +import json import shlex import sys from path import Path, TempDir from stepup.core.api import amend, getenv -from stepup.core.utils import filter_dependencies +from stepup.core.utils import filter_dependencies, string_to_bool from stepup.core.worker import WorkThread from .make_inventory import write_inventory @@ -47,24 +48,23 @@ def main(argv: list[str] | None = None, work_thread: WorkThread | None = None): if not args.path_typ.endswith(".typ"): raise ValueError("The Typst source must have extension .typ") - if not (args.path_out is None or args.path_out.suffix in (".pdf", ".png", ".svg")): - raise ValueError("The Typst output must be a PDF, PNG, or SVG file.") + if not (args.path_out is None or args.path_out.suffix in (".pdf", ".png", ".svg", ".html")): + raise ValueError("The Typst output must be a PDF, PNG, SVG, or HTML file.") - # Get Typst executable and prepare some arguments that + # Prepare the command to run Typst if args.typst is None: args.typst = getenv("REPREP_TYPST", "typst") - - # Prepare the command to run Typst typst_args = [args.typst, "compile", args.path_typ] if args.path_out is not None: typst_args.append(args.path_out) else: args.path_out = Path(args.path_typ[:-4] + ".pdf") if args.path_out.suffix == ".png": - resolution = args.resolution - if resolution is None: - resolution = int(getenv("REPREP_TYPST_RESOLUTION", "144")) - typst_args.append(f"--ppi={resolution}") + if args.resolution is None: + args.resolution = int(getenv("REPREP_TYPST_RESOLUTION", "144")) + typst_args.append(f"--ppi={args.resolution}") + elif args.path_out.suffix == ".html": + typst_args.append("--features=html") for keyval in args.sysinp: typst_args.append("--input") typst_args.append(keyval) @@ -75,43 +75,36 @@ def main(argv: list[str] | None = None, work_thread: WorkThread | None = None): with contextlib.ExitStack() as stack: if args.keep_deps: # Remove any existing make-deps output from a previous run. - path_dep = Path(args.path_typ[:-4] + ".dep") - path_dep.remove_p() + path_deps = args.path_typ.with_suffix(".deps.json") + path_deps.remove_p() else: # Use a temporary file for the make-deps output. - path_dep = stack.enter_context(TempDir()) / "typst.dep" - typst_args.extend(["--deps", path_dep, "--deps-format", "make"]) + path_deps = stack.enter_context(TempDir()) / "typst.deps.json" + typst_args.extend(["--deps", path_deps, "--deps-format", "json"]) # Run typst compile returncode, stdout, stderr = work_thread.runsh(shlex.join(typst_args)) print(stdout) - # Get existing input files from the dependency file and amend. - # Note that the deps file does not escape colons in paths, - # so the code below assumes one never uses colons in paths. - inp_paths = [] - if path_dep.is_file(): - out_paths = [] - with open(path_dep) as fh: - dep_out, dep_inp = fh.read().split(":", 1) - out_paths.extend(shlex.split(dep_out)) - inp_paths.extend(shlex.split(dep_inp)) + # Assume there is a single output file, which is the one specified. + # This is not correct when there are multiple outputs, e.g. as with SVG and PNG outputs. + # Get required input files from the dependency file. + if path_deps.is_file(): + with open(path_deps) as fh: + depinfo = json.load(fh) + inp_paths = depinfo["inputs"] + out_paths = depinfo.get("outputs") or [] else: - print(f"Dependency file not created: {path_dep}.", file=sys.stderr) - out_paths = [args.path_out] + print(f"Dependency file not created: {path_deps}.", file=sys.stderr) + out_paths = [] + inp_paths = [] - # Look for missing input files in the standard error stream and amend them. - if returncode != 0: - lead = "error: file not found (searched at " - inp_paths.extend( - line[len(lead) : -1] for line in stderr.splitlines() if line.startswith(lead) - ) sys.stderr.write(stderr) inp_paths = filter_dependencies(inp_paths) amend(inp=inp_paths) # Write inventory if args.inventory is not None: - inventory_paths = sorted(inp_paths) + out_paths + inventory_paths = sorted(inp_paths) + sorted(out_paths) write_inventory(args.inventory, inventory_paths, do_amend=False) # If the output path contains placeholders `{p}`, `{0p}`, or `{t}`, @@ -149,9 +142,11 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace: parser.add_argument( "--keep-deps", help="Keep the dependency file after the compilation. " - "The default is to use a temporary file, which is removed after it is processed.", - action="store_true", - default=False, + "The default is to use a temporary file, which is removed after it is processed. " + "Defaults to the boolean value of ${REPREP_TYPST_KEEP_DEPS}, " + "or False if the variable is not defined.", + action=argparse.BooleanOptionalAction, + default=string_to_bool(getenv("REPREP_TYPST_KEEP_DEPS", "0")), ) parser.add_argument( "--inventory", diff --git a/tests/examples/compile_typst_args/expected_graph.txt b/tests/examples/compile_typst_args/expected_graph.txt index da8ace11..f47d9816 100644 --- a/tests/examples/compile_typst_args/expected_graph.txt +++ b/tests/examples/compile_typst_args/expected_graph.txt @@ -38,6 +38,7 @@ file:lorem.typ step:compile-typst lorem.typ -- --pages 2 --no-pdf-tags state = SUCCEEDED env_var = REPREP_TYPST [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ diff --git a/tests/examples/compile_typst_dep_error/expected_stdout.txt b/tests/examples/compile_typst_dep_error/expected_stdout.txt deleted file mode 100644 index 6c945b6b..00000000 --- a/tests/examples/compile_typst_dep_error/expected_stdout.txt +++ /dev/null @@ -1,24 +0,0 @@ - 0/0 | STARTUP │ (Re)initialized boot script - 0/0 | DIRECTOR │ Launched worker 0 - 0/1 | PHASE │ run - 0/1 | START │ runpy ./plan.py - 1/3 | SUCCESS │ runpy ./plan.py - 1/3 | START │ compile-typst --keep-deps document.typ - 1/2 | FAIL │ compile-typst --keep-deps document.typ -────────────────────────────────── Step info ─────────────────────────────────── -Command stepup act -- compile-typst --keep-deps document.typ -Return code 1 -───────────────────────── Expected outputs not created ───────────────────────── -document.dep -document.pdf -──────────────────────────────── Standard error ──────────────────────────────── -(stripped) -──────────────────────────────────────────────────────────────────────────────── - 1/2 | START │ runsh echo 'fixed: new' > data.yaml - 2/2 | SUCCESS │ runsh echo 'fixed: new' > data.yaml - 2/2 | WARNING │ 1 step(s) failed. - 2/2 | WARNING │ Skipping file cleanup due to incomplete build - 2/2 | WARNING │ Check logs: .stepup/fail.log .stepup/warning.log - 2/2 | PHASE │ watch - 2/2 | DIRECTOR │ Stopping workers - 2/2 | DIRECTOR │ See you! diff --git a/tests/examples/compile_typst_dep/.gitignore b/tests/examples/compile_typst_deps/.gitignore similarity index 81% rename from tests/examples/compile_typst_dep/.gitignore rename to tests/examples/compile_typst_deps/.gitignore index 9c1cf42a..fc44e212 100644 --- a/tests/examples/compile_typst_dep/.gitignore +++ b/tests/examples/compile_typst_deps/.gitignore @@ -1,7 +1,7 @@ .stepup current* document.pdf -document.dep +document.deps.json image.jpg document1.pdf reproducibility_inventory.txt diff --git a/tests/examples/compile_typst_dep/README.txt b/tests/examples/compile_typst_deps/README.txt similarity index 100% rename from tests/examples/compile_typst_dep/README.txt rename to tests/examples/compile_typst_deps/README.txt diff --git a/tests/examples/compile_typst_dep/document.typ b/tests/examples/compile_typst_deps/document.typ similarity index 100% rename from tests/examples/compile_typst_dep/document.typ rename to tests/examples/compile_typst_deps/document.typ diff --git a/tests/examples/compile_typst_dep/expected_graph.txt b/tests/examples/compile_typst_deps/expected_graph.txt similarity index 92% rename from tests/examples/compile_typst_dep/expected_graph.txt rename to tests/examples/compile_typst_deps/expected_graph.txt index 6bca325d..34944c1b 100644 --- a/tests/examples/compile_typst_dep/expected_graph.txt +++ b/tests/examples/compile_typst_deps/expected_graph.txt @@ -6,7 +6,7 @@ root: file:./ state = STATIC created by root: - supplies file:document.dep + supplies file:document.deps.json supplies file:document.pdf supplies file:document.typ supplies file:image.jpg @@ -50,17 +50,18 @@ step:compile-typst --keep-deps document.typ state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ consumes file:document.typ consumes file:image.jpg [amended] - creates file:document.dep + creates file:document.deps.json creates file:document.pdf - supplies file:document.dep + supplies file:document.deps.json supplies file:document.pdf -file:document.dep +file:document.deps.json state = BUILT created by step:compile-typst --keep-deps document.typ consumes file:./ diff --git a/tests/examples/compile_typst_dep/expected_stdout.txt b/tests/examples/compile_typst_deps/expected_stdout.txt similarity index 100% rename from tests/examples/compile_typst_dep/expected_stdout.txt rename to tests/examples/compile_typst_deps/expected_stdout.txt diff --git a/tests/examples/compile_typst_dep/image.py b/tests/examples/compile_typst_deps/image.py similarity index 100% rename from tests/examples/compile_typst_dep/image.py rename to tests/examples/compile_typst_deps/image.py diff --git a/tests/examples/compile_typst_dep/main.sh b/tests/examples/compile_typst_deps/main.sh similarity index 95% rename from tests/examples/compile_typst_dep/main.sh rename to tests/examples/compile_typst_deps/main.sh index 6d4d228a..0bbfc55c 100755 --- a/tests/examples/compile_typst_dep/main.sh +++ b/tests/examples/compile_typst_deps/main.sh @@ -26,7 +26,7 @@ wait # Check files that are expected to be present and/or missing. [[ -f plan.py ]] || exit 1 [[ -f document.pdf ]] || exit 1 -[[ -f document.dep ]] || exit 1 +[[ -f document.deps.json ]] || exit 1 [[ -f image.jpg ]] || exit 1 [[ -f document1.pdf ]] || exit 1 [[ -f reproducibility_inventory.txt ]] || exit 1 diff --git a/tests/examples/compile_typst_dep/plan.py b/tests/examples/compile_typst_deps/plan.py similarity index 100% rename from tests/examples/compile_typst_dep/plan.py rename to tests/examples/compile_typst_deps/plan.py diff --git a/tests/examples/compile_typst_dep_error/.gitignore b/tests/examples/compile_typst_deps_error/.gitignore similarity index 67% rename from tests/examples/compile_typst_dep_error/.gitignore rename to tests/examples/compile_typst_deps_error/.gitignore index f83d8485..22fa90bc 100644 --- a/tests/examples/compile_typst_dep_error/.gitignore +++ b/tests/examples/compile_typst_deps_error/.gitignore @@ -1,4 +1,5 @@ .stepup current* document.pdf +document.deps.json data.yaml diff --git a/tests/examples/compile_typst_dep_error/README.txt b/tests/examples/compile_typst_deps_error/README.txt similarity index 100% rename from tests/examples/compile_typst_dep_error/README.txt rename to tests/examples/compile_typst_deps_error/README.txt diff --git a/tests/examples/compile_typst_dep_error/document.typ b/tests/examples/compile_typst_deps_error/document.typ similarity index 100% rename from tests/examples/compile_typst_dep_error/document.typ rename to tests/examples/compile_typst_deps_error/document.typ diff --git a/tests/examples/compile_typst_dep_error/expected_graph.txt b/tests/examples/compile_typst_deps_error/expected_graph.txt similarity index 85% rename from tests/examples/compile_typst_dep_error/expected_graph.txt rename to tests/examples/compile_typst_deps_error/expected_graph.txt index 725f0319..069e4d89 100644 --- a/tests/examples/compile_typst_dep_error/expected_graph.txt +++ b/tests/examples/compile_typst_deps_error/expected_graph.txt @@ -7,7 +7,7 @@ file:./ state = STATIC created by root: supplies file:data.yaml - supplies file:document.dep + supplies file:document.deps.json supplies file:document.pdf supplies file:document.typ supplies file:plan.py @@ -40,26 +40,28 @@ file:document.typ supplies step:compile-typst --keep-deps document.typ step:compile-typst --keep-deps document.typ - state = FAILED + state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ + consumes file:data.yaml [amended] consumes file:document.typ - creates file:document.dep + creates file:document.deps.json creates file:document.pdf - supplies file:document.dep + supplies file:document.deps.json supplies file:document.pdf -file:document.dep - state = AWAITED +file:document.deps.json + state = BUILT created by step:compile-typst --keep-deps document.typ consumes file:./ consumes step:compile-typst --keep-deps document.typ file:document.pdf - state = AWAITED + state = BUILT created by step:compile-typst --keep-deps document.typ consumes file:./ consumes step:compile-typst --keep-deps document.typ @@ -76,3 +78,4 @@ file:data.yaml created by step:runsh echo 'fixed: new' > data.yaml consumes file:./ consumes step:runsh echo 'fixed: new' > data.yaml + supplies step:compile-typst --keep-deps document.typ diff --git a/tests/examples/compile_typst_deps_error/expected_stdout.txt b/tests/examples/compile_typst_deps_error/expected_stdout.txt new file mode 100644 index 00000000..119d7519 --- /dev/null +++ b/tests/examples/compile_typst_deps_error/expected_stdout.txt @@ -0,0 +1,20 @@ + 0/0 | STARTUP │ (Re)initialized boot script + 0/0 | DIRECTOR │ Launched worker 0 + 0/1 | PHASE │ run + 0/1 | START │ runpy ./plan.py + 1/3 | SUCCESS │ runpy ./plan.py + 1/3 | START │ compile-typst --keep-deps document.typ + 1/3 | RESCHEDULE │ compile-typst --keep-deps document.typ +──────────────── Rescheduling due to unavailable amended inputs ──────────────── +Missing inputs and/or required directories: +data.yaml +──────────────────────────────────────────────────────────────────────────────── + 1/3 | START │ runsh echo 'fixed: new' > data.yaml + 2/3 | SUCCESS │ runsh echo 'fixed: new' > data.yaml + 2/3 | START │ compile-typst --keep-deps document.typ + 3/3 | SUCCESS │ compile-typst --keep-deps document.typ + 3/3 | DIRECTOR │ Trying to delete 0 outdated output(s) + 3/3 | WARNING │ Check logs: .stepup/warning.log + 3/3 | PHASE │ watch + 3/3 | DIRECTOR │ Stopping workers + 3/3 | DIRECTOR │ See you! diff --git a/tests/examples/compile_typst_dep_error/main.sh b/tests/examples/compile_typst_deps_error/main.sh similarity index 90% rename from tests/examples/compile_typst_dep_error/main.sh rename to tests/examples/compile_typst_deps_error/main.sh index 937160f4..606e892b 100755 --- a/tests/examples/compile_typst_dep_error/main.sh +++ b/tests/examples/compile_typst_deps_error/main.sh @@ -22,4 +22,6 @@ set +e; wait -fn $PID; RETURNCODE=$?; set -e # Check files that are expected to be present and/or missing. [[ -f plan.py ]] || exit 1 [[ -f document.pdf ]] || exit 1 +[[ -f document.deps.json ]] || exit 1 +grep data.yaml document.deps.json [[ -f data.yaml ]] || exit 1 diff --git a/tests/examples/compile_typst_dep_error/plan.py b/tests/examples/compile_typst_deps_error/plan.py similarity index 100% rename from tests/examples/compile_typst_dep_error/plan.py rename to tests/examples/compile_typst_deps_error/plan.py diff --git a/tests/examples/compile_typst_error/.gitignore b/tests/examples/compile_typst_error/.gitignore index 8f5d22c4..e445f34c 100644 --- a/tests/examples/compile_typst_error/.gitignore +++ b/tests/examples/compile_typst_error/.gitignore @@ -1,3 +1,4 @@ .stepup current* error.pdf +error.deps.json diff --git a/tests/examples/compile_typst_error/expected_graph.txt b/tests/examples/compile_typst_error/expected_graph.txt index a9bcda14..5816ecc0 100644 --- a/tests/examples/compile_typst_error/expected_graph.txt +++ b/tests/examples/compile_typst_error/expected_graph.txt @@ -6,10 +6,11 @@ root: file:./ state = STATIC created by root: + supplies file:error.deps.json supplies file:error.pdf supplies file:error.typ supplies file:plan.py - supplies step:compile-typst error.typ + supplies step:compile-typst --keep-deps error.typ supplies step:runpy ./plan.py file:plan.py @@ -20,34 +21,42 @@ file:plan.py step:runpy ./plan.py state = SUCCEEDED - env_var = REPREP_KEEP_TYPST_DEPS [amended] - = REPREP_TYPST_INVENTORY [amended] + env_var = REPREP_TYPST_INVENTORY [amended] = STEPUP_PATH_FILTER [amended] created by root: consumes file:./ consumes file:plan.py creates file:error.typ - creates step:compile-typst error.typ + creates step:compile-typst --keep-deps error.typ file:error.typ state = STATIC created by step:runpy ./plan.py consumes file:./ - supplies step:compile-typst error.typ + supplies step:compile-typst --keep-deps error.typ -step:compile-typst error.typ +step:compile-typst --keep-deps error.typ state = FAILED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ consumes file:error.typ + creates file:error.deps.json creates file:error.pdf + supplies file:error.deps.json supplies file:error.pdf +file:error.deps.json + state = OUTDATED + created by step:compile-typst --keep-deps error.typ + consumes file:./ + consumes step:compile-typst --keep-deps error.typ + file:error.pdf state = AWAITED - created by step:compile-typst error.typ + created by step:compile-typst --keep-deps error.typ consumes file:./ - consumes step:compile-typst error.typ + consumes step:compile-typst --keep-deps error.typ diff --git a/tests/examples/compile_typst_error/expected_stdout.txt b/tests/examples/compile_typst_error/expected_stdout.txt index c8054e03..0820731f 100644 --- a/tests/examples/compile_typst_error/expected_stdout.txt +++ b/tests/examples/compile_typst_error/expected_stdout.txt @@ -3,10 +3,10 @@ 0/1 | PHASE │ run 0/1 | START │ runpy ./plan.py 1/2 | SUCCESS │ runpy ./plan.py - 1/2 | START │ compile-typst error.typ - 1/1 | FAIL │ compile-typst error.typ + 1/2 | START │ compile-typst --keep-deps error.typ + 1/1 | FAIL │ compile-typst --keep-deps error.typ ────────────────────────────────── Step info ─────────────────────────────────── -Command stepup act compile-typst error.typ +Command stepup act -- compile-typst --keep-deps error.typ Return code 1 ───────────────────────── Expected outputs not created ───────────────────────── error.pdf diff --git a/tests/examples/compile_typst_error/plan.py b/tests/examples/compile_typst_error/plan.py index 77d00b35..aab2664a 100755 --- a/tests/examples/compile_typst_error/plan.py +++ b/tests/examples/compile_typst_error/plan.py @@ -3,4 +3,4 @@ from stepup.reprep.api import compile_typst static("error.typ") -compile_typst("error.typ") +compile_typst("error.typ", keep_deps=True) diff --git a/tests/examples/compile_typst_external/expected_graph.txt b/tests/examples/compile_typst_external/expected_graph.txt index 7312acaf..46fd1a96 100644 --- a/tests/examples/compile_typst_external/expected_graph.txt +++ b/tests/examples/compile_typst_external/expected_graph.txt @@ -66,6 +66,7 @@ step:compile-typst --inventory=../doc/main-inventory.txt ../doc/main.typ state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:../doc/ diff --git a/tests/examples/compile_typst_html/.gitignore b/tests/examples/compile_typst_html/.gitignore new file mode 100644 index 00000000..8f20a0dd --- /dev/null +++ b/tests/examples/compile_typst_html/.gitignore @@ -0,0 +1,4 @@ +.stepup +current* +lorem.html +lorem.deps.json diff --git a/tests/examples/compile_typst_html/README.txt b/tests/examples/compile_typst_html/README.txt new file mode 100644 index 00000000..49f4d2be --- /dev/null +++ b/tests/examples/compile_typst_html/README.txt @@ -0,0 +1 @@ +A simple example of compiling a typst document to HTML. diff --git a/tests/examples/compile_typst_html/expected_graph.txt b/tests/examples/compile_typst_html/expected_graph.txt new file mode 100644 index 00000000..f010750d --- /dev/null +++ b/tests/examples/compile_typst_html/expected_graph.txt @@ -0,0 +1,62 @@ +root: + creates file:./ + creates file:plan.py + creates step:runpy ./plan.py + +file:./ + state = STATIC + created by root: + supplies file:lorem.deps.json + supplies file:lorem.html + supplies file:lorem.typ + supplies file:plan.py + supplies step:compile-typst --keep-deps lorem.typ --out=lorem.html + supplies step:runpy ./plan.py + +file:plan.py + state = STATIC + created by root: + consumes file:./ + supplies step:runpy ./plan.py + +step:runpy ./plan.py + state = SUCCEEDED + env_var = REPREP_TYPST_INVENTORY [amended] + = STEPUP_PATH_FILTER [amended] + created by root: + consumes file:./ + consumes file:plan.py + creates file:lorem.typ + creates step:compile-typst --keep-deps lorem.typ --out=lorem.html + +file:lorem.typ + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst --keep-deps lorem.typ --out=lorem.html + +step:compile-typst --keep-deps lorem.typ --out=lorem.html + state = SUCCEEDED + env_var = REPREP_TYPST [amended] + = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] + = STEPUP_PATH_FILTER [amended] + created by step:runpy ./plan.py + consumes file:./ + consumes file:lorem.typ + creates file:lorem.deps.json + creates file:lorem.html + supplies file:lorem.deps.json + supplies file:lorem.html + +file:lorem.deps.json + state = BUILT + created by step:compile-typst --keep-deps lorem.typ --out=lorem.html + consumes file:./ + consumes step:compile-typst --keep-deps lorem.typ --out=lorem.html + +file:lorem.html + state = BUILT + created by step:compile-typst --keep-deps lorem.typ --out=lorem.html + consumes file:./ + consumes step:compile-typst --keep-deps lorem.typ --out=lorem.html diff --git a/tests/examples/compile_typst_html/expected_stdout.txt b/tests/examples/compile_typst_html/expected_stdout.txt new file mode 100644 index 00000000..75a1ce4f --- /dev/null +++ b/tests/examples/compile_typst_html/expected_stdout.txt @@ -0,0 +1,14 @@ + 0/0 | STARTUP │ (Re)initialized boot script + 0/0 | DIRECTOR │ Launched worker 0 + 0/1 | PHASE │ run + 0/1 | START │ runpy ./plan.py + 1/2 | SUCCESS │ runpy ./plan.py + 1/2 | START │ compile-typst --keep-deps lorem.typ --out=lorem.html + 2/2 | SUCCESS │ compile-typst --keep-deps lorem.typ --out=lorem.html +──────────────────────────────── Standard error ──────────────────────────────── +(stripped) +──────────────────────────────────────────────────────────────────────────────── + 2/2 | DIRECTOR │ Trying to delete 0 outdated output(s) + 2/2 | PHASE │ watch + 2/2 | DIRECTOR │ Stopping workers + 2/2 | DIRECTOR │ See you! diff --git a/tests/examples/compile_typst_html/lorem.typ b/tests/examples/compile_typst_html/lorem.typ new file mode 100644 index 00000000..9d87db90 --- /dev/null +++ b/tests/examples/compile_typst_html/lorem.typ @@ -0,0 +1 @@ +#lorem(1000) diff --git a/tests/examples/compile_typst_html/main.sh b/tests/examples/compile_typst_html/main.sh new file mode 100755 index 00000000..ba2f569b --- /dev/null +++ b/tests/examples/compile_typst_html/main.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env -S bash -x +# Exit on first error and cleanup. +set -e +trap 'kill $(pgrep -g $$ | grep -v $$) > /dev/null 2> /dev/null || :' EXIT +rm -rvf $(cat .gitignore) + +# Run the example +export SOURCE_DATE_EPOCH="315532800" +stepup boot -w -n 1 & # > current_stdout.txt & + +# Get the graph after completion of the pending steps. +stepup wait +stepup graph current_graph +stepup join + +# Wait for background processes, if any. +wait + +# Check files that are expected to be present and/or missing. +[[ -f plan.py ]] || exit 1 +[[ -f lorem.typ ]] || exit 1 +[[ -f lorem.html ]] || exit 1 +grep lorem.typ lorem.deps.json diff --git a/tests/examples/compile_typst_html/plan.py b/tests/examples/compile_typst_html/plan.py new file mode 100755 index 00000000..dd939df4 --- /dev/null +++ b/tests/examples/compile_typst_html/plan.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 +from stepup.core.api import static +from stepup.reprep.api import compile_typst + +static("lorem.typ") +compile_typst("lorem.typ", "lorem.html", keep_deps=True) diff --git a/tests/examples/compile_typst_png/expected_graph.txt b/tests/examples/compile_typst_png/expected_graph.txt index a0a871a3..4cfedfc8 100644 --- a/tests/examples/compile_typst_png/expected_graph.txt +++ b/tests/examples/compile_typst_png/expected_graph.txt @@ -39,6 +39,7 @@ step:compile-typst --resolution=30 belgium.typ --out=flag.png state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ diff --git a/tests/examples/compile_typst_png_multi/.gitignore b/tests/examples/compile_typst_png_multi/.gitignore index 8c7d50cb..7bd7914a 100644 --- a/tests/examples/compile_typst_png_multi/.gitignore +++ b/tests/examples/compile_typst_png_multi/.gitignore @@ -1,3 +1,4 @@ .stepup current* *.png +lorem.deps.json diff --git a/tests/examples/compile_typst_png_multi/lorem.dep b/tests/examples/compile_typst_png_multi/lorem.dep deleted file mode 100644 index 0312b0b6..00000000 --- a/tests/examples/compile_typst_png_multi/lorem.dep +++ /dev/null @@ -1 +0,0 @@ -out-{0p}-{t}.png: lorem.typ diff --git a/tests/examples/compile_typst_png_multi/main.sh b/tests/examples/compile_typst_png_multi/main.sh index 3e7a6082..d3995f5d 100755 --- a/tests/examples/compile_typst_png_multi/main.sh +++ b/tests/examples/compile_typst_png_multi/main.sh @@ -21,5 +21,5 @@ wait [[ -f lorem.typ ]] || exit 1 [[ -f out-1-2.png ]] || exit 1 [[ -f out-2-2.png ]] || exit 1 -grep out-1-2.png lorem.dep -grep out-2-2.png lorem.dep +grep out-1-2.png lorem.deps.json +grep out-2-2.png lorem.deps.json diff --git a/tests/examples/compile_typst_relpath/.gitignore b/tests/examples/compile_typst_relpath/.gitignore index c57cc124..5cd4fa1c 100644 --- a/tests/examples/compile_typst_relpath/.gitignore +++ b/tests/examples/compile_typst_relpath/.gitignore @@ -1,5 +1,5 @@ .stepup current* -source/document.dep +source/document.deps.json source/document-inventory.txt out.pdf diff --git a/tests/examples/compile_typst_relpath/expected_graph.txt b/tests/examples/compile_typst_relpath/expected_graph.txt index 8edee6c3..48cf8f23 100644 --- a/tests/examples/compile_typst_relpath/expected_graph.txt +++ b/tests/examples/compile_typst_relpath/expected_graph.txt @@ -37,7 +37,7 @@ file:source/ consumes file:./ supplies file:source/aux/ supplies file:source/document-inventory.txt - supplies file:source/document.dep + supplies file:source/document.deps.json supplies file:source/document.typ supplies file:source/tada.svg supplies step:compile-typst --keep-deps --inventory=source/document-inventory.txt source/document.typ --out=out.pdf @@ -70,6 +70,7 @@ step:compile-typst --keep-deps --inventory=source/document-inventory.txt source/ state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ @@ -79,10 +80,10 @@ step:compile-typst --keep-deps --inventory=source/document-inventory.txt source/ consumes file:source/tada.svg [amended] creates file:out.pdf creates file:source/document-inventory.txt - creates file:source/document.dep + creates file:source/document.deps.json supplies file:out.pdf supplies file:source/document-inventory.txt - supplies file:source/document.dep + supplies file:source/document.deps.json file:out.pdf state = BUILT @@ -96,7 +97,7 @@ file:source/document-inventory.txt consumes file:source/ consumes step:compile-typst --keep-deps --inventory=source/document-inventory.txt source/document.typ --out=out.pdf -file:source/document.dep +file:source/document.deps.json state = BUILT created by step:compile-typst --keep-deps --inventory=source/document-inventory.txt source/document.typ --out=out.pdf consumes file:source/ diff --git a/tests/examples/compile_typst_relpath/main.sh b/tests/examples/compile_typst_relpath/main.sh index dca19cdf..077016d9 100755 --- a/tests/examples/compile_typst_relpath/main.sh +++ b/tests/examples/compile_typst_relpath/main.sh @@ -19,7 +19,7 @@ wait # Check files that are expected to be present and/or missing. [[ -f plan.py ]] || exit 1 [[ -f out.pdf ]] || exit 1 -[[ -f source/document.dep ]] || exit 1 +[[ -f source/document.deps.json ]] || exit 1 [[ -f source/document-inventory.txt ]] || exit 1 grep '../out.pdf' source/document-inventory.txt [[ $(wc -l source/document-inventory.txt | cut -d' ' -f1) = 4 ]] || exit 1 diff --git a/tests/examples/compile_typst_relpath/out.pdf b/tests/examples/compile_typst_relpath/out.pdf deleted file mode 100644 index 153fe18c..00000000 Binary files a/tests/examples/compile_typst_relpath/out.pdf and /dev/null differ diff --git a/tests/examples/compile_typst_simple/expected_graph.txt b/tests/examples/compile_typst_simple/expected_graph.txt index 9b62c9fb..97b8fb07 100644 --- a/tests/examples/compile_typst_simple/expected_graph.txt +++ b/tests/examples/compile_typst_simple/expected_graph.txt @@ -39,6 +39,7 @@ step:compile-typst --inventory=document-inventory.txt document.typ --out=out.pdf state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ diff --git a/tests/examples/compile_typst_svg/expected_graph.txt b/tests/examples/compile_typst_svg/expected_graph.txt index 1451f9dd..88d1e32e 100644 --- a/tests/examples/compile_typst_svg/expected_graph.txt +++ b/tests/examples/compile_typst_svg/expected_graph.txt @@ -39,6 +39,7 @@ step:compile-typst weather.typ --out=out.svg state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ diff --git a/tests/examples/compile_typst_svg_deps/.gitignore b/tests/examples/compile_typst_svg_deps/.gitignore index 3eac52c5..8e2920bd 100644 --- a/tests/examples/compile_typst_svg_deps/.gitignore +++ b/tests/examples/compile_typst_svg_deps/.gitignore @@ -1,5 +1,5 @@ .stepup current* *.pdf -*.dep +*.deps.json other.png diff --git a/tests/examples/compile_typst_svg_deps/expected_graph.txt b/tests/examples/compile_typst_svg_deps/expected_graph.txt index 0d58f587..6aa0e936 100644 --- a/tests/examples/compile_typst_svg_deps/expected_graph.txt +++ b/tests/examples/compile_typst_svg_deps/expected_graph.txt @@ -6,7 +6,7 @@ root: file:./ state = STATIC created by root: - supplies file:demo.dep + supplies file:demo.deps.json supplies file:demo.pdf supplies file:demo.typ supplies file:embedded.svg @@ -66,6 +66,7 @@ step:compile-typst --keep-deps demo.typ state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ @@ -73,12 +74,12 @@ step:compile-typst --keep-deps demo.typ consumes file:embedded.svg [amended] consumes file:linked.svg [amended] consumes file:random.png [amended] - creates file:demo.dep + creates file:demo.deps.json creates file:demo.pdf - supplies file:demo.dep + supplies file:demo.deps.json supplies file:demo.pdf -file:demo.dep +file:demo.deps.json state = BUILT created by step:compile-typst --keep-deps demo.typ consumes file:./ diff --git a/tests/examples/compile_typst_svg_deps/main.sh b/tests/examples/compile_typst_svg_deps/main.sh index 2e3cc0d8..86dbf583 100755 --- a/tests/examples/compile_typst_svg_deps/main.sh +++ b/tests/examples/compile_typst_svg_deps/main.sh @@ -26,7 +26,7 @@ wait [[ -f linked.svg ]] || exit 1 [[ -f embedded.svg ]] || exit 1 [[ -f demo.pdf ]] || exit 1 -[[ -f demo.dep ]] || exit 1 -grep linked.svg demo.dep -grep embedded.svg demo.dep -grep random.png demo.dep +[[ -f demo.deps.json ]] || exit 1 +grep linked.svg demo.deps.json +grep embedded.svg demo.deps.json +grep random.png demo.deps.json diff --git a/tests/examples/compile_typst_svg_multi/.gitignore b/tests/examples/compile_typst_svg_multi/.gitignore index a53cab43..131d29d8 100644 --- a/tests/examples/compile_typst_svg_multi/.gitignore +++ b/tests/examples/compile_typst_svg_multi/.gitignore @@ -1,4 +1,4 @@ .stepup current* *.svg -lorem.dep +lorem.deps.json diff --git a/tests/examples/compile_typst_svg_multi/main.sh b/tests/examples/compile_typst_svg_multi/main.sh index 1c72b41b..4964141d 100755 --- a/tests/examples/compile_typst_svg_multi/main.sh +++ b/tests/examples/compile_typst_svg_multi/main.sh @@ -21,5 +21,5 @@ wait [[ -f lorem.typ ]] || exit 1 [[ -f out-1-2.svg ]] || exit 1 [[ -f out-2-2.svg ]] || exit 1 -grep out-1-2.svg lorem.dep -grep out-2-2.svg lorem.dep +grep out-1-2.svg lorem.deps.json +grep out-2-2.svg lorem.deps.json diff --git a/tests/examples/compile_typst_sysinp/expected_graph.txt b/tests/examples/compile_typst_sysinp/expected_graph.txt index a2cf7a52..ed85c52b 100644 --- a/tests/examples/compile_typst_sysinp/expected_graph.txt +++ b/tests/examples/compile_typst_sysinp/expected_graph.txt @@ -47,6 +47,7 @@ step:compile-typst template.typ --out=alice.pdf --sysinp name=Alic age=29 state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ @@ -64,6 +65,7 @@ step:compile-typst template.typ --out=bob.pdf --sysinp name=Bob age=31 state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ @@ -81,6 +83,7 @@ step:compile-typst template.typ --out=charlie.pdf --sysinp name=Charlie age=27 state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ diff --git a/tests/examples/compile_typst_sysinp_json/expected_graph.txt b/tests/examples/compile_typst_sysinp_json/expected_graph.txt index 3e5a5cfc..4da4495a 100644 --- a/tests/examples/compile_typst_sysinp_json/expected_graph.txt +++ b/tests/examples/compile_typst_sysinp_json/expected_graph.txt @@ -47,6 +47,7 @@ step:compile-typst template.typ --out=persons.pdf --sysinp json=persons.json state = SUCCEEDED env_var = REPREP_TYPST [amended] = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] = STEPUP_PATH_FILTER [amended] created by step:runpy ./plan.py consumes file:./ diff --git a/tests/examples/compile_typst_tile/.gitignore b/tests/examples/compile_typst_tile/.gitignore new file mode 100644 index 00000000..e8639e3a --- /dev/null +++ b/tests/examples/compile_typst_tile/.gitignore @@ -0,0 +1,5 @@ +.stepup +current_* +figure.pdf +figure1.pdf +reproducibility_inventory.txt diff --git a/tests/examples/compile_typst_tile/README.txt b/tests/examples/compile_typst_tile/README.txt new file mode 100644 index 00000000..32014ec7 --- /dev/null +++ b/tests/examples/compile_typst_tile/README.txt @@ -0,0 +1,2 @@ +An example reproducing RepRep's old tile_pdf feature with Typst, +here using many different figure formats. diff --git a/tests/examples/compile_typst_tile/expected_graph.txt b/tests/examples/compile_typst_tile/expected_graph.txt new file mode 100644 index 00000000..735ad8b3 --- /dev/null +++ b/tests/examples/compile_typst_tile/expected_graph.txt @@ -0,0 +1,108 @@ +root: + creates file:./ + creates file:plan.py + creates step:runpy ./plan.py + +file:./ + state = STATIC + created by root: + supplies file:figure.pdf + supplies file:figure.typ + supplies file:hexagon.png + supplies file:horizontal.pdf + supplies file:pentagon.jpg + supplies file:plan.py + supplies file:square.webp + supplies file:triangle.gif + supplies file:vertical.svg + supplies step:compile-typst figure.typ + supplies step:runpy ./plan.py + +file:plan.py + state = STATIC + created by root: + consumes file:./ + supplies step:runpy ./plan.py + +step:runpy ./plan.py + state = SUCCEEDED + env_var = REPREP_KEEP_TYPST_DEPS [amended] + = REPREP_TYPST_INVENTORY [amended] + = STEPUP_PATH_FILTER [amended] + created by root: + consumes file:./ + consumes file:plan.py + creates file:figure.typ + creates file:hexagon.png + creates file:horizontal.pdf + creates file:pentagon.jpg + creates file:square.webp + creates file:triangle.gif + creates file:vertical.svg + creates step:compile-typst figure.typ + +file:figure.typ + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst figure.typ + +file:hexagon.png + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst figure.typ + +file:horizontal.pdf + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst figure.typ + +file:pentagon.jpg + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst figure.typ + +file:square.webp + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst figure.typ + +file:triangle.gif + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst figure.typ + +file:vertical.svg + state = STATIC + created by step:runpy ./plan.py + consumes file:./ + supplies step:compile-typst figure.typ + +step:compile-typst figure.typ + state = SUCCEEDED + env_var = REPREP_TYPST [amended] + = REPREP_TYPST_ARGS [amended] + = REPREP_TYPST_KEEP_DEPS [amended] + = STEPUP_PATH_FILTER [amended] + created by step:runpy ./plan.py + consumes file:./ + consumes file:figure.typ + consumes file:hexagon.png [amended] + consumes file:horizontal.pdf [amended] + consumes file:pentagon.jpg [amended] + consumes file:square.webp [amended] + consumes file:triangle.gif [amended] + consumes file:vertical.svg [amended] + creates file:figure.pdf + supplies file:figure.pdf + +file:figure.pdf + state = BUILT + created by step:compile-typst figure.typ + consumes file:./ + consumes step:compile-typst figure.typ diff --git a/tests/examples/compile_typst_tile/expected_stdout.txt b/tests/examples/compile_typst_tile/expected_stdout.txt new file mode 100644 index 00000000..ba7aea8b --- /dev/null +++ b/tests/examples/compile_typst_tile/expected_stdout.txt @@ -0,0 +1,17 @@ + 0/0 | STARTUP │ (Re)initialized boot script + 0/0 | DIRECTOR │ Launched worker 0 + 0/1 | PHASE │ run + 0/1 | START │ runpy ./plan.py + 1/2 | SUCCESS │ runpy ./plan.py + 1/2 | START │ compile-typst figure.typ + 2/2 | SUCCESS │ compile-typst figure.typ + 2/2 | DIRECTOR │ Trying to delete 0 outdated output(s) + 2/2 | PHASE │ watch + 2/2 | DELETED │ figure.pdf + 1/2 | PHASE │ run + 1/2 | START │ compile-typst figure.typ + 2/2 | SUCCESS │ compile-typst figure.typ + 2/2 | DIRECTOR │ Trying to delete 0 outdated output(s) + 2/2 | PHASE │ watch + 2/2 | DIRECTOR │ Stopping workers + 2/2 | DIRECTOR │ See you! diff --git a/tests/examples/compile_typst_tile/figure.typ b/tests/examples/compile_typst_tile/figure.typ new file mode 100644 index 00000000..2a0927c6 --- /dev/null +++ b/tests/examples/compile_typst_tile/figure.typ @@ -0,0 +1,47 @@ +#set page(width: auto, height: auto, margin: 1mm) +/* Notes: + - The bitmap figures have little metadata, so their sizes are set manually. +*/ +#set text(font: "DejaVu Sans Mono", size: 8pt) +#grid( + columns: 3, + column-gutter: 2mm, + row-gutter: 1mm, + align: center + horizon, + grid( + columns: 1, + box(height: 4mm)[(a) triangle.gif], + image("triangle.gif", width: 50mm) + ), + grid( + columns: 1, + box(height: 4mm)[(b) square.webp], + image("square.webp", width: 50mm) + ), + grid.cell( + rowspan: 2, + grid( + columns: 1, + box(height: 4mm)[(e) vertical.svg], + image("vertical.svg") + ) + ), + grid( + columns: 1, + box(height: 4mm)[(c) pentagon.jpg], + image("pentagon.jpg", width: 50mm) + ), + grid( + columns: 1, + box(height: 4mm)[(d) hexagon.png], + image("hexagon.png", width: 50mm) + ), + grid.cell( + colspan: 3, + grid( + columns: 1, + box(height: 4mm)[(f) horizontal.pdf], + image("horizontal.pdf") + ) + ) +) diff --git a/tests/examples/compile_typst_tile/hexagon.png b/tests/examples/compile_typst_tile/hexagon.png new file mode 100644 index 00000000..078cf1a3 Binary files /dev/null and b/tests/examples/compile_typst_tile/hexagon.png differ diff --git a/tests/examples/compile_typst_tile/horizontal.pdf b/tests/examples/compile_typst_tile/horizontal.pdf new file mode 100644 index 00000000..e4efc837 Binary files /dev/null and b/tests/examples/compile_typst_tile/horizontal.pdf differ diff --git a/tests/examples/compile_typst_tile/main.sh b/tests/examples/compile_typst_tile/main.sh new file mode 100755 index 00000000..e6a5af9a --- /dev/null +++ b/tests/examples/compile_typst_tile/main.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env -S bash -x +# Exit on first error and cleanup. +set -e +trap 'kill $(pgrep -g $$ | grep -v $$) > /dev/null 2> /dev/null || :' EXIT +rm -rvf $(cat .gitignore) + +# Run the example +export SOURCE_DATE_EPOCH="315532800" +export PUBLIC="public/" +stepup boot -w -n 1 & # > current_stdout.txt & + +# Get the graph after completion of the pending steps. +stepup wait +stepup graph current_graph + +# Reproducibility test +mv figure.pdf figure1.pdf +stepup watch-delete figure.pdf +stepup run +stepup join +stepup make-inventory -o reproducibility_inventory.txt figure.pdf figure1.pdf + +# Wait for background processes, if any. +wait + +# Check files that are expected to be present and/or missing. +[[ -f plan.py ]] || exit 1 +[[ -f figure.pdf ]] || exit 1 +[[ -f figure1.pdf ]] || exit 1 +[[ -f reproducibility_inventory.txt ]] || exit 1 diff --git a/tests/examples/compile_typst_tile/pentagon.jpg b/tests/examples/compile_typst_tile/pentagon.jpg new file mode 100644 index 00000000..f7234403 Binary files /dev/null and b/tests/examples/compile_typst_tile/pentagon.jpg differ diff --git a/tests/examples/compile_typst_tile/plan.py b/tests/examples/compile_typst_tile/plan.py new file mode 100755 index 00000000..ec6acb2e --- /dev/null +++ b/tests/examples/compile_typst_tile/plan.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +from stepup.core.api import static +from stepup.reprep.api import compile_typst + +static( + "figure.typ", + "hexagon.png", + "horizontal.pdf", + "pentagon.jpg", + "square.webp", + "triangle.gif", + "vertical.svg", +) +compile_typst("figure.typ") diff --git a/tests/examples/compile_typst_tile/square.webp b/tests/examples/compile_typst_tile/square.webp new file mode 100644 index 00000000..f9ecfef8 Binary files /dev/null and b/tests/examples/compile_typst_tile/square.webp differ diff --git a/tests/examples/compile_typst_tile/triangle.gif b/tests/examples/compile_typst_tile/triangle.gif new file mode 100644 index 00000000..7b876cd8 Binary files /dev/null and b/tests/examples/compile_typst_tile/triangle.gif differ diff --git a/tests/examples/compile_typst_tile/vertical.svg b/tests/examples/compile_typst_tile/vertical.svg new file mode 100644 index 00000000..5622be54 --- /dev/null +++ b/tests/examples/compile_typst_tile/vertical.svg @@ -0,0 +1 @@ + diff --git a/tests/test_examples.py b/tests/test_examples.py index 6b10c0e1..99d72957 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -178,10 +178,11 @@ async def test_libreoffice_example(path_tmp: Path, name: str): "name", [ "compile_typst_args", - "compile_typst_dep", - pytest.param("compile_typst_dep_error", marks=pytest.mark.xfail), + "compile_typst_deps", + "compile_typst_deps_error", "compile_typst_error", "compile_typst_external", + "compile_typst_html", "compile_typst_png", "compile_typst_png_multi", "compile_typst_relpath", @@ -191,6 +192,7 @@ async def test_libreoffice_example(path_tmp: Path, name: str): "compile_typst_svg_multi", "compile_typst_sysinp", "compile_typst_sysinp_json", + "compile_typst_tile", ], ) @pytest.mark.asyncio