-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] include within eval blocks, best to use abspath
#186
Comments
Hello! I'm back from a fair bit of travelling, apologies for the delay. Two things from this:
So on a prototype branch, I showed the error and it's maybe a bit surprising at first: Simple code:
```julia:scripts/test186
fn = "tempf.jl"
write(fn, "a = 1+1")
println("Is this a file? $(isfile(fn))")
include(fn)
rm(fn)
```
done.
\output{scripts/test186} --> <p>Simple code: <pre><code class="language-julia">fn = "tempf.jl"
write(fn, "a = 1+1")
println("Is this a file? $(isfile(fn))")
include(fn)
rm(fn)</code></pre> done. <pre><code>Is this a file? true
There was an error running the code: LoadError("/Users/tlienart/.julia/dev/JuDoc/test/__tmp/basic/assets/scripts/test186.jl", 5, ErrorException("could not open file /Users/tlienart/.julia/dev/JuDoc/test/__tmp/basic/assets/scripts/tempf.jl")).</code></pre></p> So it's a path issue. It's not immediately clear what/why is the issue here (I don't think it's related to JuDoc but rather to the fact that we're using nested include, since the script is included by JuDoc (using Anyway this works in the mean time: (note the Simple code:
```julia:scripts/test186
fn = "tempf.jl"
write(fn, "a = 1+1")
println("Is this a file? $(isfile(fn))")
include(abspath(fn))
println("Now: $a")
rm(fn)
```
done.
\output{scripts/test186} ---> <p>Simple code: <pre><code class="language-julia">fn = "tempf.jl"
write(fn, "a = 1+1")
println("Is this a file? $(isfile(fn))")
include(abspath(fn))
println("Now: $a")
rm(fn)</code></pre> done. <pre><code>Is this a file? true
Now: 2
</code></pre></p> |
Add error message in eval block (see #186)
Me too :)
So far I was just using
Thank you! The error message is also a good idea. Maybe the docs should mention somewhere to use |
Yes, I must say it's a bit of a weird use-case to be using |
abspath
Is there another way to include source file? I'd like not to "pollute" my site with that long code (ofc I could use Literate or Weave 😄) |
So what you want to do is something like
? If so you can just do that using https://tlienart.github.io/JuDoc.jl/dev/man/syntax/#Separate-evaluation-1 ? (or otherwise could you suggest an example of what you'd like to do?) |
Yes, something like the earlier linked repo where I tested how to plot. Slowly I finish what I wanted to achieve, if you're interested here's a link.
I'm satisfied as I have a working version, but will think through if my approach is the best/fastest/easiest/etc. And again, thank you for the awesome package! |
thanks for the feedback and the suggestions, it's super helpful :) and when your website is online I'd be glad to add it to the list in the README if you'd like |
I can not
include()
.jl files and don't understand why. Only an error is generated, andserve(verb=true, nomess=true)
neither tells me anything.MWE:
testf.jl:
The following is in index.html:
And the output is:
Is this a file? true There was an error running the code.
Content of
rundiary/output/load.out
:Content of
rundiary/load.jl
:The text was updated successfully, but these errors were encountered: