-
Notifications
You must be signed in to change notification settings - Fork 18
Generate docs for exported methods (of submodules)? #36
Comments
(The line between Docile- and Lexicon-specific issues is a bit vague, so I'm not bothered by where they get filed.) I've come across this issue as well, a few "solutions" I've tried:
The second option works for most cases apart from constants and macros: module M
using Docile
@document
module A
using Docile
@document
x=0
"y is 1"
y=1
end
module B
using Docile
@document
"a is :a"
a = :a
"b is :b"
b = :b
end
import .A.x, .B.a
export x #but not a
"x is 0"
:x
end This ends up documenting the integer "x is 0"
:x to document the "x is 0"
(x,) to document the So Problems with this approach:
|
(I'm really interested in documenting methods and types, not really integers as in my example above.) How hard would it be to do something like this: module M
using Docile
@document
module A
using Docile
@document
"f returns 0"
f(x)=0
"g returns 1"
g(x) = 1
end
import .A.f
export f
@get_doc(A.f) # <-----
(f, Any)
end where Relating to the last point and also to #37, what do you think about checking for an Like #...
@doc meta("returns 1 "; internal = true) ->
g(x) = 1
#... |
That could possibly work. Something like: module M
using Docile
@document
module A
using Docile
@document
"f returns 0"
f(x)=0
"g returns 1"
g(x) = 1
end
import .A.f
export f
@get_doc(A.f, (f, Any))
end where
You should be able to filter out module T
using Docile
@doc meta("return 1"; internal = true) ->
g(x) = 1
end
using Docile, Docile.Interface, Lexicon
filtered_metadata = filter(metadata(T)) do ent
!metadata(ent)[:internal]
end
save("out.md", MIME"text/md"(), filtered_metadata) (Writing that out I feel there's some room to improve the interface a little.) |
i did not go through all of this but you may also want to have a look at the ne w |
First, thanks for Docile and Lexicon! I'm not sure if this issue belongs here or with Docile, or somewhere in the middle.
Suppose I have
What I would like is to generate documentation for
M
usingsave
that includes docs for exported objects from submodule(s)†. I don't want to have to expose the user to all internal documentation ofA
andB
in order to document the exported objects ofM
. Any thoughts on best practices here?† or something like that at least. Maybe docs for exported objects of submods is not exactly right.
The text was updated successfully, but these errors were encountered: