@@ -17,17 +17,62 @@ if "--help" ∈ ARGS
1717 exit (0 )
1818end
1919
20- using Pkg
21- Pkg. activate (@__DIR__ )
22- Pkg. develop (PackageSpec (; path = (@__DIR__ ) * " /../" ))
23- Pkg. resolve ()
24- Pkg. instantiate ()
20+ # if docs is not the current active environment, switch to it
21+ # (from https://github.com/JuliaIO/HDF5.jl/pull/1020/)
22+ if Base. active_project () != joinpath (@__DIR__ , " Project.toml" )
23+ using Pkg
24+ Pkg. activate (@__DIR__ )
25+ Pkg. instantiate ()
26+ end
2527
28+ #
29+ # Load packages
2630using Documenter, DocumenterCitations, DocumenterInterLinks
2731using AlgorithmsInterface
2832
2933run_on_CI = (get (ENV , " CI" , nothing ) == " true" )
3034
35+ #
36+ # Copy and reformat changelog
37+
38+ # (d) add contributing.md and changelog.md to the docs – and link to releases and issues
39+
40+ function add_links (line:: String , url:: String = " https://github.com/JuliaManifolds/Manopt.jl" )
41+ # replace issues (#XXXX) -> ([#XXXX](url/issue/XXXX))
42+ while (m = match (r" \(\# ([0-9]+)\) " , line)) != = nothing
43+ id = m. captures[1 ]
44+ line = replace (line, m. match => " ([#$id ]($url /issues/$id ))" )
45+ end
46+ # replace ## [X.Y.Z] -> with a link to the release [X.Y.Z](url/releases/tag/vX.Y.Z)
47+ while (m = match (r" \#\# \[ ([0-9]+.[0-9]+.[0-9]+)\] (.*)" , line)) != = nothing
48+ tag = m. captures[1 ]
49+ date = m. captures[2 ]
50+ line = replace (line, m. match => " ## [$tag ]($url /releases/tag/v$tag ) ($date )" )
51+ end
52+ return line
53+ end
54+
55+ generated_path = joinpath (@__DIR__ , " src" )
56+ base_url = " https://github.com/JuliaManifolds/Manopt.jl/blob/master/"
57+ isdir (generated_path) || mkdir (generated_path)
58+ for (md_file, doc_file) in [(" Changelog.md" , " changelog.md" )]
59+ open (joinpath (generated_path, doc_file), " w" ) do io
60+ # Point to source license file
61+ println (
62+ io,
63+ """
64+ ```@meta
65+ EditURL = "$(base_url)$(md_file) "
66+ ```
67+ """ ,
68+ )
69+ # Write the contents out below the meta block
70+ for line in eachline (joinpath (dirname (@__DIR__ ), md_file))
71+ println (io, add_links (line))
72+ end
73+ end
74+ end
75+
3176bib = CitationBibliography (joinpath (@__DIR__ , " src" , " references.bib" ); style = :alpha )
3277links = InterLinks ()
3378makedocs (;
@@ -47,8 +92,12 @@ makedocs(;
4792 " Interface" => " interface.md" ,
4893 " Stopping criteria" => " stopping_criterion.md" ,
4994 " Logging" => " logging.md" ,
50- " Notation" => " notation.md" ,
51- " References" => " references.md" ,
95+ " Miscellanea" => [
96+ " Internals" => " internals.md" ,
97+ " Notation" => " notation.md" ,
98+ " Changelog" => " changelog.md" ,
99+ " References" => " references.md" ,
100+ ],
52101 ],
53102 expandfirst = [" interface.md" , " stopping_criterion.md" ],
54103 plugins = [bib, links],
0 commit comments