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
Do not enforce type Symbol for argument mod #208
Conversation
Thanks! Probably it would be good to check whether it is set to sandbox as that is the only valid "non-module" option. It is possible to use other modules that Main. The only possibly useful situation I can think of is to use the same sandbox module for several documents. Could you make the change? |
With the latest commit the following behaviour is enforced:
|
src/config.jl
Outdated
if m == "sandbox" | ||
mod = :sandbox | ||
else | ||
@warn "The only valid header option for 'mod' is 'sandbox'. Ignoring value '$m'." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to set mod = Module(Symbol(m))
here. I don't think there is any reason not to be able to specify module name in header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, I misunderstood your previous comment. I assumed it should be restricted to ":sandbox" only.
In that case I think it's more reasonable to handle all mod
options of type Symbol
in the run
method, such that weave("test.jmd", mod = :sandbox3)
for a file test.jmd
without header arguments and weave("test_headers.jmd")
for a file test_headers.jmd
with header arguments mod: sandbox3
behave the same.
Hej!
I noticed that as soon as
options
are specified in the YAML header of a file, it is not possible anymore to weave in a module such asMain
. The problem is that during parsing and merging of the header argumentsmod
is converted to a Symbol in https://github.com/mpastell/Weave.jl/blob/master/src/config.jl#L112, but https://github.com/mpastell/Weave.jl/blob/master/src/run.jl#L57 requiresmod
to be aModule
.As an example, for a simple file
test.jmd
such asthe command
fails with the error message
This PR fixes that issue (and replaces
getvalue
with the equivalentget
) - however, I'm wondering whether amod
option in the header should be handled differently. It seems "sandbox" is the only valid option since everything else will fail due to the same issue? Maybe one should explicitly check if it is set to "Main"?