Skip to content

Commit

Permalink
Enable edit and show source buttons in docs (#3381)
Browse files Browse the repository at this point in the history
* Typos
* Make the "show source" buttons in the docs work again
* Enable the "Edit page on GitHub" buttons

(cherry picked from commit 56b8182)
  • Loading branch information
lgoettgens authored and benlorenz committed Feb 21, 2024
1 parent 684aadf commit eccd795
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
31 changes: 27 additions & 4 deletions docs/make_work.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is included by docs/make.jl and by a helper function
# in src/Oscar.jl
# in src/utils/docs.jl
#
module BuildDoc

Expand Down Expand Up @@ -139,7 +139,7 @@ function doit(
joinpath(Oscar.oscardir, "docs", "oscar_references.bib"); style=oscar_style
)

# Copy documentation from Hecke, Nemo, AnstratAlgebra
# Copy documentation from Hecke, Nemo, AbstractAlgebra
other_packages = [
(Oscar.Hecke, Oscar.heckedir),
(Oscar.Nemo, Oscar.nemodir),
Expand All @@ -166,12 +166,30 @@ function doit(
end
src = normpath(root, file)
dst = normpath(dstbase, relpath(root, srcbase), file)
cp(src, dst; force=true)
if endswith(file, ".md")
symlink(src, dst)
else
cp(src, dst; force=true)
end
chmod(dst, 0o644)
end
end
end

function get_rev(uuid::Base.UUID)
deps = Documenter.Pkg.dependencies()
@assert haskey(deps, uuid)
if !isnothing(deps[uuid].git_revision)
return deps[uuid].git_revision
else
return "v$(deps[uuid].version)"
end
end
aarev = get_rev(Base.PkgId(Oscar.AbstractAlgebra).uuid)
nemorev = get_rev(Base.PkgId(Oscar.Nemo).uuid)
heckerev = get_rev(Base.PkgId(Oscar.Hecke).uuid)
singularrev = get_rev(Base.PkgId(Oscar.Singular).uuid)

cd(joinpath(Oscar.oscardir, "docs")) do
DocMeta.setdocmeta!(Oscar, :DocTestSetup, Oscar.doctestsetup(); recursive=true)
DocMeta.setdocmeta!(Oscar.Hecke, :DocTestSetup, :(using Hecke); recursive=true)
Expand All @@ -197,7 +215,12 @@ function doit(
warnonly=warnonly,
checkdocs=:none,
pages=doc,
remotes=nothing, # TODO: make work with Hecke, Nemo, AbstractAlgebra, see https://github.com/oscar-system/Oscar.jl/issues/588
remotes=Dict(
Oscar.aadir => (Remotes.GitHub("Nemocas", "AbstractAlgebra.jl"), aarev),
Oscar.nemodir => (Remotes.GitHub("Nemocas", "Nemo.jl"), nemorev),
Oscar.heckedir => (Remotes.GitHub("thofma", "Hecke.jl"), heckerev),
Oscar.singulardir => (Remotes.GitHub("oscar-system", "Singular.jl"), singularrev),
),
plugins=[bib],
)
end
Expand Down
1 change: 1 addition & 0 deletions src/utils/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const jll_deps = String["Antic_jll", "Arb_jll", "Calcium_jll", "FLINT_jll", "GAP
const aadir = Base.pkgdir(AbstractAlgebra)
const nemodir = Base.pkgdir(Nemo)
const heckedir = Base.pkgdir(Hecke)
const singulardir = Base.pkgdir(Singular)

include("versioninfo.jl")
include("docs.jl")
Expand Down

0 comments on commit eccd795

Please sign in to comment.