Skip to content

Commit

Permalink
Merge 809ae82 into 8c4e0e4
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma authored Apr 4, 2024
2 parents 8c4e0e4 + 809ae82 commit 6f5174b
Show file tree
Hide file tree
Showing 51 changed files with 693 additions and 403 deletions.
163 changes: 91 additions & 72 deletions docs/Build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,88 +4,93 @@
#
module Build

using Documenter, DocumenterMarkdown, DocumenterCitations

pages = [
"index.md",
"Number fields" => [ "number_fields/intro.md",
"number_fields/fields.md",
"number_fields/elements.md",
"number_fields/complex_embeddings.md",
"number_fields/internal.md"],
"Function fields" => [ "function_fields/intro.md",
"function_fields/basics.md",
"function_fields/elements.md",
"function_fields/internal.md",
"function_fields/degree_localization.md"],
"Orders" => [ "orders/introduction.md",
"orders/orders.md",
"orders/elements.md",
"orders/ideals.md",
"orders/frac_ideals.md"
],
"Quadratic and hermitian forms" => [ "quad_forms/introduction.md",
"quad_forms/basics.md",
"quad_forms/lattices.md",
"quad_forms/genusherm.md",
"quad_forms/integer_lattices.md",
"quad_forms/Zgenera.md",
"quad_forms/discriminant_group.md"
],
"Elliptic curves" => [ "elliptic_curves/intro.md",
"elliptic_curves/basics.md",
"elliptic_curves/finite_fields.md",
"elliptic_curves/number_fields.md",],
"Abelian groups" => "abelian/introduction.md",
"Class field theory" => "class_fields/intro.md",
"Misc" => ["FacElem.md",
"sparse/intro.md",
"pmat/introduction.md",
"misc/conjugacy.md",
],
"Extra features" => ["features/macros.md",
"features/mset.md",
],
"Examples" => "examples.md",
"References" => "references.md",
"Developer" => [ "dev/test.md",
]
]
using Pkg, Nemo, Documenter, DocumenterVitepress, DocumenterCitations

pages = [
"index.md",
"Number fields" => [ "number_fields/intro.md",
"number_fields/fields.md",
"number_fields/elements.md",
"number_fields/complex_embeddings.md",
"number_fields/internal.md"],
"Function fields" => [ "function_fields/intro.md",
"function_fields/basics.md",
"function_fields/elements.md",
"function_fields/internal.md",
"function_fields/degree_localization.md"],
"Orders" => [ "orders/introduction.md",
"orders/orders.md",
"orders/elements.md",
"orders/ideals.md",
"orders/frac_ideals.md"
],
"Quadratic and hermitian forms" => [ "quad_forms/introduction.md",
"quad_forms/basics.md",
"quad_forms/lattices.md",
"quad_forms/genusherm.md",
"quad_forms/integer_lattices.md",
"quad_forms/Zgenera.md",
"quad_forms/discriminant_group.md"
],
"Elliptic curves" => [ "elliptic_curves/intro.md",
"elliptic_curves/basics.md",
"elliptic_curves/finite_fields.md",
"elliptic_curves/number_fields.md",],
"Abelian groups" => "abelian/introduction.md",
"Class field theory" => "class_fields/intro.md",
"Misc" => ["FacElem.md",
"sparse/intro.md",
"pmat/introduction.md",
"misc/conjugacy.md",
],
"Extra features" => ["features/macros.md",
"features/mset.md",
],
"Examples" => "examples.md",
"References" => "references.md",
"Developer" => [ "dev/test.md",
]
]

# Overwrite printing to make the header not full of redundant nonsense
# Turns
# Hecke.Order - Method
# into
# Order - Method

# To remove the '-'
# Documenter.Utilities.print_signature(io::IO, signature) = print(io, signature)
#Documenter.print_signature(io::IO, signature) = print(io, signature)

# To remove the "Method", "Type", "Module" use the following
# Documenter.Utilities.doccat(b::Base.Docs.Binding, ::Type) = ""
# doccat(::Type) = ""
# doccat(::Module) = ""
#Documenter.doccat(b::Base.Docs.Binding, ::Type) = ""
#Documenter.doccat(::Type) = ""
#Documenter.doccat(::Module) = ""

# Remove the module prefix
Base.print(io::IO, b::Base.Docs.Binding) = print(io, b.var)

# the .id in the anchor is derived from the signature, which sometimes contain "<:"
# it seems mkdocs does not handle "<:" that well inside an <a href="...">.
function Base.getproperty(obj::Documenter.Anchors.Anchor, sym::Symbol)
if sym === :id
return replace(getfield(obj, sym), "<:" => "")
else
return getfield(obj, sym)
end
end
# function Base.getproperty(obj::Documenter.Anchors.Anchor, sym::Symbol)
# if sym === :id
# return replace(getfield(obj, sym), "<:" => "")
# else
# return getfield(obj, sym)
# end
# end

status = sprint(io -> Pkg.status("Nemo"; io = io))
version = match(r"(v[0-9].[0-9]+.[0-9]+)", status)[1]
gh_moi = Documenter.Remotes.GitHub("nemocas", "Nemo.jl")
remotes = Dict(pkgdir(Nemo) => (gh_moi, version))

function make(Hecke::Module; strict = false,
local_build::Bool = false,
doctest = true,
format::Symbol = :mkdocs)
format::Symbol = :vitepress)

# Load the bibliography
bib = CitationBibliography(joinpath(Hecke.pkgdir, "docs", "src", "Hecke.bib"), sorting = :nyt)
bib = CitationBibliography(joinpath(Hecke.pkgdir, "docs", "src", "Hecke.bib"))

@info "Using bibliography: $(bib)"

Expand All @@ -95,21 +100,35 @@ function make(Hecke::Module; strict = false,

if format == :html
makedocs(
bib,
modules = [Hecke, Hecke.Nemo],
authors="Claus Fieker and Tommy Hofmann",
repo="https://github.com/thofma/Hecke.jl",
sitename="Hecke",
checkdocs = :none,
format = Documenter.HTML(prettyurls = !local_build, collapselevel = 1),
warnonly = true,
plugins=[bib],
doctest = doctest,
strict = strict,
modules = [Hecke, Hecke.Nemo],
sitename = "Hecke documentation",
pages = pages
remotes = remotes,
)
elseif format == :mkdocs
makedocs(
bib,
doctest= doctest,
strict = strict,
modules = [Hecke, Hecke.Nemo],
format = Markdown(),
elseif format == :vitepress
makedocs(
modules = [Hecke, Hecke.Nemo],
authors="Claus Fieker and Tommy Hofmann",
repo="https://github.com/thofma/Hecke.jl",
sitename="Hecke",
checkdocs = :none,
remotes = remotes,
format=DocumenterVitepress.MarkdownVitepress(
repo = "github.com/thofma/Hecke.jl",
devurl = "dev",
devbranch = "master",
#deploy_url = "https://thofma.com/Hecke.jl",
build_vitepress = !local_build,
),
warnonly = true,
plugins=[bib],
doctest= false#doctest,
)
end
end
Expand Down
9 changes: 3 additions & 6 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
DocumenterMarkdown = "997ab1e6-3595-5248-9280-8efb232c3433"

[compat]
Documenter = "~0.27"
DocumenterCitations = "0.2.5"
DocumenterMarkdown = "0.2.2"
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
Hecke = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
1 change: 0 additions & 1 deletion docs/javascripts/config.js

This file was deleted.

77 changes: 2 additions & 75 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,84 +4,11 @@ using Pkg

include(normpath(joinpath(Hecke.pkgdir, "docs", "Build.jl")))

Build.make(Hecke; strict = Documenter.except(:missing_docs), local_build=false, doctest=true, format = :mkdocs)

## Overwrite printing to make the header not full of redundant nonsense
## Turns
## Hecke.Order - Method
## into
## Order - Method
#
## To remove the '-'
## Documenter.Utilities.print_signature(io::IO, signature) = print(io, signature)
#
## To remove the "Method", "Type", "Module" use the following
## Documenter.Utilities.doccat(b::Base.Docs.Binding, ::Type) = ""
## doccat(::Type) = ""
## doccat(::Module) = ""
#
## Remove the module prefix
#Base.print(io::IO, b::Base.Docs.Binding) = print(io, b.var)

# We use 'mike', a mkdocs extension to display a selector.
# We create the versions.json for the selector Usually Documenter.jl creates a
# versions.js containing the information.
function Documenter.Writers.HTMLWriter.generate_version_file(versionfile::AbstractString, entries, symlinks = [])
versionfile = joinpath(dirname(versionfile), "versions.json")
open(versionfile, "w") do buf
symlinks = Dict(symlinks)
isempty(entries) && return
println(buf, "[")
for (j, folder) in enumerate(entries)
print(buf, "{\"version\": \"$(folder)\", \"title\": \"$(folder)\", \"aliases\": ")
print(buf, "[")
for (i, al) in enumerate([e for e in symlinks if e.first == folder])
print(buf, "\"", al.second, "\"")
if i < length([e for e in symlinks if e.first == folder])
print(buf, ", ")
end
end
print(buf, "]}")
if j < length(entries)
print(buf, ",")
end
print(buf, "\n")
end
print(buf, "]")
end
end

deps = Pkg.dependencies()
ver = Pkg.dependencies()[Base.UUID("3e1990a7-5d81-5526-99ce-9ba3ff248f21")]
s = string(ver.version)
if haskey(ENV, "RELEASE_VERSION")
if ENV["RELEASE_VERSION"] == "master"
s = "dev"
cmd = `mike deploy $s`
elseif endswith(ENV["RELEASE_VERSION"], "merge")
cmd = `mkdocs build`
else
s = ENV["RELEASE_VERSION"]
cmd = `mike deploy $s`
end
else
cmd = `mkdocs build`
end

@info "version: $s"
@info "cmd: $cmd"
Build.make(Hecke; strict = Documenter.except(:missing_docs), local_build=false, doctest=true, format = :vitepress)

deploydocs(
repo = "github.com/thofma/Hecke.jl.git",
deps = Deps.pip("pymdown-extensions",
"pygments",
"mkdocs",
"python-markdown-math",
"mkdocs-material",
"mkdocs-cinder",
"mike"),
target = "site",
make = () -> run(cmd),
target = "build",
push_preview = true,
forcepush = true
)
9 changes: 0 additions & 9 deletions docs/mathjaxhelper.js

This file was deleted.

Loading

0 comments on commit 6f5174b

Please sign in to comment.