Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable edit and show source buttons in docs #3381

Merged
merged 4 commits into from
Feb 19, 2024
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
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an objection, just wondering: why not just symlink all the files?

Copy link
Member Author

@lgoettgens lgoettgens Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it first with only symlinks, but that leaded to a red wall on https://github.com/oscar-system/Oscar.jl/actions/workflows/pages/pages-build-deployment on the weekend, so it basically blocked all updates to the docs from being published.
How I try to explain it: In the building stage (converting md to HTML), Documenter is fine with files not in the project folder it is called on. However, in later stages (where e.g. *.js are still there), it does not like symlinks outside of the project folder anymore. And thinking again about it, that would be kind of hard to check-in into git anyway 😂

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
Loading