Skip to content

Commit 1a5f64a

Browse files
author
Vito Zanotelli
committed
doc: improve documentation
1 parent 318edf0 commit 1a5f64a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

utils/quarto/wrapper.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def add_parameter(name: str, value, param_list: list[str]) -> None:
4646
report = snakemake.output.get("report", None)
4747

4848

49-
# Build params
49+
# Build params to be passed to Quarto params (-P flag)
5050
params = []
5151
for name, value in snakemake.input.items():
5252
if name not in {"renv", "script"}:
@@ -67,14 +67,23 @@ def add_parameter(name: str, value, param_list: list[str]) -> None:
6767

6868
with tempfile.TemporaryDirectory() as temp_output:
6969
if report is None:
70+
# In case no report output is specified,
71+
# the output is created in a temporary folder
7072
out_report = Path(temp_output) / script.name
7173
out_report_rendered = out_report
7274
report_path = f"{out_report}.tmp"
7375
else:
76+
# In case an output is specified,
77+
# the output is created in the target folder.
7478
report_path = Path(report).resolve()
79+
# The report to-be-rendered is namespaced
80+
# to prevent clashes.
7581
out_report = (
76-
report_path.parent / f"{report_path.stem}_temp_{report_path.suffix[1:]}.qmd"
82+
report_path.parent / f"{report_path.stem}_{report_path.suffix[1:]}.qmd"
7783
)
84+
# The rendered report is named as the final report with the correct suffix
85+
# Note that in addition ot the target report file, also a folder `*_files/`
86+
# is created, which contains the images and other files linked in the html report.
7887
out_report_rendered = out_report.with_suffix(report_path.suffix)
7988
if report_path.suffix == ".pdf":
8089
warnings.warn(

0 commit comments

Comments
 (0)