Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

* `DocMeta` has been updated to respect world-age semantics for bindings, introduced in Julia 1.12. ([#2621], [#2622], [#2624])

## Version [v1.8.0] - 2024-11-07

### Changed
Expand Down Expand Up @@ -1916,6 +1922,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2571]: https://github.com/JuliaDocs/Documenter.jl/issues/2571
[#2592]: https://github.com/JuliaDocs/Documenter.jl/issues/2592
[#2593]: https://github.com/JuliaDocs/Documenter.jl/issues/2593
[#2621]: https://github.com/JuliaDocs/Documenter.jl/issues/2621
[#2622]: https://github.com/JuliaDocs/Documenter.jl/issues/2622
[#2624]: https://github.com/JuliaDocs/Documenter.jl/issues/2624
[JuliaLang/julia#36953]: https://github.com/JuliaLang/julia/issues/36953
[JuliaLang/julia#38054]: https://github.com/JuliaLang/julia/issues/38054
[JuliaLang/julia#39841]: https://github.com/JuliaLang/julia/issues/39841
Expand Down
9 changes: 5 additions & 4 deletions src/DocMeta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module — a special variable is created in each module that has documentation m
"""
module DocMeta
import ..Documenter
import Base: invokelatest

"The unique `Symbol` that is used to store the metadata dictionary in each module."
const META = gensym(:docmeta)
Expand All @@ -31,14 +32,14 @@ const VALIDMETA = Dict{Symbol, Type}(:DocTestSetup => Union{Expr, Symbol})
"""
"""
function initdocmeta!(m::Module)
if !isdefined(m, META)
if !invokelatest(isdefined, m, META)
@debug "Creating documentation metadata dictionary (META=$META) in $m"
Core.eval(m, :(const $META = $(METATYPE())))
push!(METAMODULES, m)
else
@warn "Existing documentation metadata dictionary (META=$META) in $m. Ignoring."
end
return getfield(m, META)
return invokelatest(getfield, m, META)
end

"""
Expand All @@ -48,7 +49,7 @@ Returns the documentation metadata dictionary for the module `m`. The dictionary
considered immutable and assigning values to it is not well-defined. To set documentation
metadata values, [`DocMeta.setdocmeta!`](@ref) should be used instead.
"""
getdocmeta(m::Module) = isdefined(m, META) ? getfield(m, META) : METATYPE()
getdocmeta(m::Module) = invokelatest(isdefined, m, META) ? invokelatest(getfield, m, META) : METATYPE()

"""
getdocmeta(m::Module, key::Symbol, default=nothing)
Expand All @@ -74,7 +75,7 @@ function setdocmeta!(m::Module, key::Symbol, value; warn = true, recursive = fal
setdocmeta!(mod, key, value; warn = warn, recursive = false)
end
else
isdefined(m, META) || initdocmeta!(m)
invokelatest(isdefined, m, META) || initdocmeta!(m)
meta = getdocmeta(m)
if warn && haskey(meta, key)
@warn "$(key) already set for module $m. Overwriting."
Expand Down
Loading