/
make.jl
65 lines (59 loc) · 2.02 KB
/
make.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Inspired from https://github.com/jump-dev/JuMP.jl/blob/master/docs/make.jl
using SumOfSquares
using Documenter, Literate
const _TUTORIAL_DIR = joinpath(@__DIR__, "src", "tutorials")
const _OUTPUT_DIR = joinpath(@__DIR__, "src", "generated")
const _TUTORIAL_SUBDIR = [
"Getting started",
"Polynomial Optimization",
"Systems and Control",
"Other Applications",
"Noncommutative and Hermitian",
"Sparsity",
"Symmetry",
"Extension",
]
function literate_directory(dir)
output_dir = joinpath(_OUTPUT_DIR, dir)
for filename in readdir(joinpath(_TUTORIAL_DIR, dir))
if filename[1] == '_'
continue
end
path = joinpath(_TUTORIAL_DIR, dir, filename)
Literate.markdown(path, output_dir; documenter = true)
Literate.notebook(path, output_dir; documenter = true)
Literate.script(path, output_dir; documenter = true)
end
end
literate_directory.(_TUTORIAL_SUBDIR)
makedocs(
sitename = "SumOfSquares",
# See https://github.com/JuliaDocs/Documenter.jl/issues/868
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
# See https://github.com/jump-dev/JuMP.jl/issues/1576
strict = true,
pages = [
"Index" => "index.md",
"Sum-of-Squares Programming" => "sumofsquares.md",
"Variables" => "variables.md",
"Constraints" => "constraints.md",
"Tutorials" => map(
subdir ->
subdir => map(
file -> joinpath("generated", subdir, file),
filter(
file -> endswith(file, ".md"),
sort(readdir(joinpath(_OUTPUT_DIR, subdir))),
),
),
_TUTORIAL_SUBDIR,
),
],
# The following ensures that we only include the docstrings from
# this module for functions define in Base that we overwrite.
modules = [SumOfSquares, PolyJuMP]
)
deploydocs(
repo = "github.com/jump-dev/SumOfSquares.jl.git",
push_preview = true,
)