Skip to content
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

include() not working in an at-block on 0.7/1.0 #793

Closed
korsbo opened this issue Aug 13, 2018 · 5 comments
Closed

include() not working in an at-block on 0.7/1.0 #793

korsbo opened this issue Aug 13, 2018 · 5 comments

Comments

@korsbo
Copy link

korsbo commented Aug 13, 2018

Hi,

I'm having trouble updating my package since my documentation is not generated properly anymore.

I make use of your @eval syntax to auto-generate some documentation. This worked fine on 0.6, but not on 0.7 or 1.0.

julia docs/make.jl 
Documenter: setting up build directory.
Documenter: expanding markdown templates.
 !! Warning in src/tutorials/parameterizedfunctions.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/tutorials/parameterizedfunctions.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/tutorials/parameterizedfunctions.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! Warning in src/tutorials/DiffEqBiological.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/tutorials/DiffEqBiological.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/tutorials/DiffEqBiological.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! Warning in src/tutorials/DiffEqBiological.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/tutorials/DiffEqBiological.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/tutorials/DiffEqBiological.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! Duplicate docs found for 'latexalign'. [src/functions/latexalign.md]
 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:include)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:keyword_arguments)

 !! Warning in src/arguments.md:

Failed to evaluate `@eval` block.

ERROR: UndefVarError(:latexify)

 !! No docs found for 'latexify'. [src/functions/latexify.md]
Documenter: building cross-references.
 !! No doc found for reference '[`latexraw`](@ref)'. [src/functions/latexarray.md]
Documenter: running document checks.
 > checking for missing docstrings.
 !! 4 docstrings potentially missing:

    Latexify.latexraw
    Latexify.mdtable :: Tuple{}
    Latexify.get_md_function :: Tuple
    Latexify.get_latex_function :: Tuple

 !! Skipped doctesting.
 > checking footnote links.
Documenter: populating indices.
Documenter: rendering document.
 !! Invalid local link: unresolved path
    'tutorials/latexalign' in tutorials/parameterizedfunctions.md
Documenter: skipping docs deployment.
  You can set DOCUMENTER_DEBUG to "true" in Travis to see more information.

I have also tried the @example syntax and it inserts the code, but not the expected output from the code.

Thanks!

@korsbo
Copy link
Author

korsbo commented Aug 13, 2018

I realized that I should provide a real MWE. When creating one that just defined a string, it seemed to work.

```@eval
"This was auto-generated"
```# need a comment here for markdown to be happy

An example of the ones which are not working is:

```@eval
include("src/table_generator.jl")
args = [arg for arg in keyword_arguments if :arrow in arg.env]
latexify(args, env=:mdtable, types=false)
```#

@korsbo
Copy link
Author

korsbo commented Aug 13, 2018

The more I dig, the more I think that this is my fault. I'll reopen the issue if that does not turn out to be the case.

@korsbo korsbo closed this as completed Aug 13, 2018
@korsbo
Copy link
Author

korsbo commented Aug 13, 2018

The issue seems to come from my call to include. I'm not entirely sure, but it seems like include has changed a bit from 0.6 to 0.7 and that it now evaluates into the wrong scope.

Replacing include(filename) with Base.include(@__MODULE__, filename) did the trick for me.

@mortenpi
Copy link
Member

Not sure what's up here, but this is definitely a regression. The includes should just work, but on 1.0 something as simple as

```@eval
include("foo.jl")
```

fails with

Failed to evaluate `@eval` block.                            
                                                                 
ERROR: UndefVarError(:include)

@mortenpi mortenpi reopened this Aug 13, 2018
@mortenpi mortenpi changed the title Code evaluation (@eval or @example) fails on Julia 0.7. include() not working in an at-block on 0.7/1.0 Aug 13, 2018
@fredrikekre
Copy link
Member

I think modules created from Module(::Symbol) does not have include defined. We should just define that method, like we define an eval method for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants