Skip to content

Commit

Permalink
Update module docstrings (fix JuliaLang#29432) (JuliaLang#37626)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Sep 18, 2020
1 parent 73413fc commit 3826279
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ end
Adds a new docstring `str` to the docsystem of `__module__` for `binding` and signature `sig`.
"""
function doc!(__module__::Module, b::Binding, str::DocStr, @nospecialize sig = Union{})
# Module docstrings are in the module itself
if defined(b)
obj = resolve(b)
if isa(obj, Module)
__module__ = obj
end
end
initmeta(__module__)
m = get!(meta(__module__), b, MultiDoc())
if haskey(m.docs, sig)
Expand Down
2 changes: 1 addition & 1 deletion doc/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ end

makedocs(
build = joinpath(buildroot, "doc", "_build", (render_pdf ? "pdf" : "html"), "en"),
modules = [Base, Core, [Base.root_module(Base, stdlib.stdlib) for stdlib in STDLIB_DOCS]...],
modules = [Main, Base, Core, [Base.root_module(Base, stdlib.stdlib) for stdlib in STDLIB_DOCS]...],
clean = true,
doctest = ("doctest=fix" in ARGS) ? (:fix) : ("doctest=only" in ARGS) ? (:only) : ("doctest=true" in ARGS) ? true : false,
linkcheck = "linkcheck=true" in ARGS,
Expand Down
7 changes: 7 additions & 0 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1224,3 +1224,10 @@ end
end
@test M27832.xs == ":(\$(Expr(:\$, :fn)))"
Core.atdoc!(_last_atdoc)

# issue #29432
"First docstring" module Module29432 end
Test.collect_test_logs() do # suppress printing of any warning
eval(quote "Second docstring" Module29432 end) # requires toplevel
end
@test docstrings_equal(@doc(Module29432), doc"Second docstring")

0 comments on commit 3826279

Please sign in to comment.