Skip to content

Commit

Permalink
Merge pull request #13073 from MichaelHatherly/mh/macro-summary-fix
Browse files Browse the repository at this point in the history
Fix macro summary display
  • Loading branch information
jakebolewski committed Sep 11, 2015
2 parents af7287b + 9db4375 commit e6c6601
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,18 @@ function doc(b::Binding)
v = getfield(b.mod,b.var)
d = doc(v)
if d === nothing
if isa(v,Function)
if startswith(string(b.var),'@')
# check to see if the binding var is a macro
d = catdoc(Markdown.parse("""
No documentation found.
`$(b.mod === Main ? b.var : join((b.mod, b.var),'.'))` is $(isgeneric(v) ? "a generic" : "an anonymous") `Function`.
"""), functionsummary(v))
elseif startswith(string(b.var),'@')
# check to see if the binding var is a macro
"""), macrosummary(b.var, v))
elseif isa(v,Function)
d = catdoc(Markdown.parse("""
No documentation found.
"""), macrosummary(b.var, v))
`$(b.mod === Main ? b.var : join((b.mod, b.var),'.'))` is $(isgeneric(v) ? "a generic" : "an anonymous") `Function`.
"""), functionsummary(v))
else
T = typeof(v)
d = catdoc(Markdown.parse("""
Expand Down
10 changes: 7 additions & 3 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,13 @@ end
@doc "This should document @m1... since its the result of expansion" @m2_11993
@test (@doc @m1_11993) !== nothing
let d = (@doc @m2_11993)
io = IOBuffer()
writemime(io, MIME"text/markdown"(), d)
@test startswith(takebuf_string(io),"No documentation found")
@test docstrings_equal(d, doc"""
No documentation found.
```julia
@m2_11993()
```
""")
end

@doc "Now @m2... should be documented" :@m2_11993
Expand Down

0 comments on commit e6c6601

Please sign in to comment.