Open bob-carpenter opened 1 year ago
Looks like perhaps a simple typo?
filters:
- include-code-files
per
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.
Worked for me running within the repo's quarto
folder quarto add quarto-ext/include-code-files
(creates _extensions
folder infrastructure)
There is a sample I created. I used:
0) make a directory to work in and cd to that directory
1) 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
2) Make a test.qmd like:
---
title: "My Document"
filters:
- include-code-files
---
```{.python include="script.py"}
3) Make a script.py like:
````python
# Program to add two matrices using nested loop
X = [[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 rows
for i in range(len(X)):
# iterate through columns
for j in range(len(X[0])):
result[i][j] = X[i][j] + Y[i][j]
for r in result:
print(r)
4) quarto render test.qmd
Thanks for all the help.
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!
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.
And then I put this in my Yaml:
and then I run and it fails with this message when doing the final rendering:
After I run the install, I can't find the
include-code-filters
anywhere on my OS.