Closed ferrolho closed 3 years ago
Could you structure it like
"""
require_func(::Foo.foo)
blabla
"""
function require_func end
@require Foo
function require_func(f::Foo.foo)
...
end
end
Hi, @KristofferC! Thank you for your reply. :slightly_smiling_face: Yes, I can structure it like that. And it works!
Just a tiny detail: I had to move export require_func
outside the @require
macro for the documentation builder to pick it up.
Basically, what the title says. But it may be easier to provide my specific use-case, so that's what I will explain below.
My package depends on two other packages: Ipopt.jl and Knitro.jl. The first one does not present any issues, i.e., it is a regular dependency. In contrast, Knitro.jl is a package which requires users to have a licence and to download specific files to their system. For that reason, I am using the functionality provided by Requires.jl to only load methods relying on Knitro.jl if the package has been loaded. So far so good. The problem is that, when Travis tries to build the docs, it does not load Knitro.jl, and consequently the docstrings for the methods guarded by the
@require
macro are not built...tl;dr Is there a way to write the docstring for methods guarded by the
@require
macro such that the docs get built properly? Even if the package needed for the guarded methods is not loaded? Thanks!