Skip to content

Commit

Permalink
don't include release- folder in version selector
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Apr 24, 2018
1 parent 11deb1b commit bfc268b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -479,23 +479,18 @@ end

function generate_version_file(dir::AbstractString)
named_folders = []
release_folders = []
tag_folders = []
for each in readdir(dir)
each in ("stable", "latest") ? push!(named_folders, each) :
occursin(r"release\-\d+\.\d+", each) ? push!(release_folders, each) :
occursin(Base.VERSION_REGEX, each) ? push!(tag_folders, each) : nothing
end
# put stable before latest
sort!(named_folders, rev = true)
# sort tags by version number
sort!(tag_folders, lt = (x, y) -> VersionNumber(x) < VersionNumber(y), rev = true)
# sort release- folders by version number
vnum(x) = VersionNumber(match(r"release\-(\d+\.\d+)", x)[1])
sort!(release_folders, lt = (x, y) -> vnum(x) < vnum(y), rev = true)
open(joinpath(dir, "versions.js"), "w") do buf
println(buf, "var DOC_VERSIONS = [")
for group in (named_folders, tag_folders, release_folders)
for group in (named_folders, tag_folders)
for folder in group
println(buf, " \"", folder, "\",")
end
Expand Down
2 changes: 1 addition & 1 deletion test/htmlwriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Documenter.Writers.HTMLWriter: jsescape, generate_version_file
@test jsescape("policy to
 delete.") == "policy to\\u2028 delete."

mktempdir() do tmpdir
versions = ["stable", "latest", "v0.2.6", "v0.1.1", "v0.1.0", "release-0.2", "release-0.1"]
versions = ["stable", "latest", "v0.2.6", "v0.1.1", "v0.1.0"]
cd(tmpdir) do
mkdir("foobar")
for version in versions
Expand Down

0 comments on commit bfc268b

Please sign in to comment.