FromFile.jl icon indicating copy to clipboard operation
FromFile.jl copied to clipboard

Name returned by which(...) includes internal module

Open frankier opened this issue 3 years ago • 2 comments
trafficstars

See https://github.com/JuliaDocs/Documenter.jl/issues/1781 . I wonder whether there is some way to work around this in FromFile.jl or whether this is reasonable? There doesn't seem an obvious way, but I am cross-posting this issue here anyway.

frankier avatar Mar 22 '22 05:03 frankier

I remember discussing this with with @MilesCranmer and concluding that this was a limitation of Documenter.jl. As you say, it's very common for a public interface not to be the same as the internal structure of the code.

FWIW I've run into similar issues with Python documentation-generation tooling before. There my solution was to monkey-patch the autodoc to do what I want. (You could also look at offering a PR for Documenter.jl -- open source projects usually get features because of community contributors!)

patrick-kidger avatar Mar 22 '22 07:03 patrick-kidger

One hacky way to solve this in the short term is to perform text pre-processing on the entire source code, switching, e.g., @from "File.jl" import foo, bar with import File: foo, bar, and then inserting module File ... end inside File.jl. Do this for every file, add the include("File.jl") at the top-level, and then call Documenter.jl at the end - it should generate non-mangled names (I think).

MilesCranmer avatar Mar 22 '22 22:03 MilesCranmer