You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what I'm supposed to be doing but the instructions as given on the README.md don't work for me.
~/github/bob-carpenter/stan-getting-started (main)$ quarto add quarto-ext/include-code-files
Quarto extensions may execute code when documents are rendered. If you do not
trust the authors of the extension, we recommend that you do not install or
use the extension.
? Do you trust the authors of this extension (Y/n) › Yes
[✓] Downloading
[✓] Unzipping
Found 1 extension.
The following changes will be made:
Include Code Files [Install] 1.0.0 (filter)
? Would you like to continue (Y/n) › Yes
[✓] Extension installation complete.
Learn more about this extension at https://www.github.com/quarto-ext/include-code-files
And then I put this in my Yaml:
filters:
- include-code-filters
and then I run and it fails with this message when doing the final rendering:
Error running filter /Applications/quarto/share/filters/main.lua:
Error running filter /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-filters:
Could not find executable /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-filters
stack traceback:
/Applications/quarto/share/filters/main.lua:4026: in function </Applications/quarto/share/filters/main.lua:4005>
[C]: in ?
[C]: in method 'walk'
/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
/Applications/quarto/share/filters/main.lua:449: in local 'callback'
/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
stack traceback:
/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
/Applications/quarto/share/filters/main.lua:449: in local 'callback'
/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
make: *** [stan-getting-started.pdf] Error 1
After I run the install, I can't find the include-code-filters anywhere on my OS.
Thanks, @dragonstyle. That was definitely user error on my part.
The install produced an include-code-files.lua but it's not getting picked up. Then I moved a .lua file into quarto directory, but that didn't work either:
Error running filter /Applications/quarto/share/filters/main.lua:
Error running filter /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-files:
Could not find executable /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-files
stack traceback:
/Applications/quarto/share/filters/main.lua:4026: in function </Applications/quarto/share/filters/main.lua:4005>
[C]: in ?
[C]: in method 'walk'
/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
/Applications/quarto/share/filters/main.lua:449: in local 'callback'
/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
stack traceback:
/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
/Applications/quarto/share/filters/main.lua:449: in local 'callback'
/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
make: *** [stan-getting-started.pdf] Error 1
Is there some way I can install this extension and distribute with my document? Otherwise, this is going to be too hard for me and people I'd like to run this document to use. Which is too bad, because this is exactly the extension I want. I wrote one myself in Java for a previous set of documentation I was writing 15 years ago, but don't want to go down that rabbit hole again.
make a directory to work in and cd to that directory
quarto add quarto-ext/include-code-files to add the extension
1a) (after installation, note the presence of an _extension directory which contains the newly added extension
Make a test.qmd like:
---title: "My Document"filters:
- include-code-files---```{.python include="script.py"}
```
Make a script.py like:
# Program to add two matrices using nested loopX= [[12,7,3],
[4 ,5,6],
[7 ,8,9]]
Y= [[5,8,1],
[6,7,3],
[4,5,9]]
result= [[0,0,0],
[0,0,0],
[0,0,0]]
# iterate through rowsforiinrange(len(X)):
# iterate through columnsforjinrange(len(X[0])):
result[i][j] =X[i][j] +Y[i][j]
forrinresult:
print(r)
I just created a PR that adds a note to README.md explaining that the _extensions directory needs to go in the same directory as your quarto files. At least that's what solved the problem for me. If there's a more general solution, please include that instead of my PR.
P.S. Thanks for the extension---it's just what I need!
Activity
dragonstyle commentedon Jun 12, 2023
Looks like perhaps a simple typo?
per
https://github.com/quarto-ext/include-code-files
bob-carpenter commentedon Jun 12, 2023
Thanks, @dragonstyle. That was definitely user error on my part.
The install produced an
include-code-files.luabut it's not getting picked up. Then I moved a .lua file intoquartodirectory, but that didn't work either:Is there some way I can install this extension and distribute with my document? Otherwise, this is going to be too hard for me and people I'd like to run this document to use. Which is too bad, because this is exactly the extension I want. I wrote one myself in Java for a previous set of documentation I was writing 15 years ago, but don't want to go down that rabbit hole again.
rfhb commentedon Jun 12, 2023
Worked for me running within the repo's
quartofolderquarto add quarto-ext/include-code-files(creates_extensionsfolder infrastructure)dragonstyle commentedon Jun 12, 2023
Archive.zip
There is a sample I created. I used:
quarto add quarto-ext/include-code-filesto add the extension1a) (after installation, note the presence of an
_extensiondirectory which contains the newly added extensionquarto render test.qmdbob-carpenter commentedon Jun 12, 2023
Thanks for all the help.
I just created a PR that adds a note to README.md explaining that the
_extensionsdirectory needs to go in the same directory as your quarto files. At least that's what solved the problem for me. If there's a more general solution, please include that instead of my PR.P.S. Thanks for the extension---it's just what I need!