How to include a file with dynamically generated name? #11681
Answered
by
cscheid
chentianran
asked this question in
Q&A
-
DescriptionIs there a way to include file whose name is dynamically generated? For example, I naively assumed the following would work: ---
title: "Year end report"
format: pdf
engine: jupyter
---
```{python}
filename = "2024-report.qmd"
```
{{< inclulde `{python} filename` >}}
The end. But it does not. the Before you suggest something like this... #| echo: false
with open(filename, 'r') as file:
content = file.read()
print(content) in a Python code block, I should note that this would not work as the content is rendered as static raw text. |
Beta Was this translation helpful? Give feedback.
Answered by
cscheid
Dec 13, 2024
Replies: 2 comments 1 reply
This comment has been hidden.
This comment has been hidden.
-
Include shortcodes are resolved before engines execute the code, so no, that's not a syntax that will work in Quarto. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
chentianran
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Include shortcodes are resolved before engines execute the code, so no, that's not a syntax that will work in Quarto.