Skip to content

Commit 06214f6

Browse files
authored
Merge 9592294 into 074d436
2 parents 074d436 + 9592294 commit 06214f6

File tree

7 files changed

+62
-49
lines changed

7 files changed

+62
-49
lines changed

docs/Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
77
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
88
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
99
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
10-
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
11-
GDAL = "add2ef01-049f-52c4-9ee2-e494f65e021a"
12-
GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9"
1310
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
1411
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
1512
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
@@ -21,4 +18,7 @@ SpatialBoundaries = "8d2ba62a-3d23-4a2b-b692-6b63e9267be2"
2118
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
2219

2320
[compat]
24-
DocumenterVitepress = "0.1"
21+
Documenter = "1.13"
22+
DocumenterCitations = "1.4"
23+
DocumenterVitepress = "0.2"
24+
Literate = "2.20"

docs/make.jl

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,23 @@ sdt_path = dirname(dirname(Base.current_project()))
33
push!(LOAD_PATH, sdt_path)
44
using SpeciesDistributionToolkit
55

6-
# Load the rest of the build environment
6+
# These packages are required to build the documentation website
77
using Documenter
8-
using DocumenterVitepress
98
using DocumenterCitations
10-
using GeoJSON
9+
using DocumenterVitepress
10+
11+
# These packages are used to generate the cards (for datasets) and pages (for the manual)
1112
using Literate
1213
using Markdown
1314
using InteractiveUtils
1415
using Dates
1516
using PrettyTables
16-
import Downloads
1717

18-
# Download the bibliography from paperpile public URL
19-
const bibfile = joinpath(@__DIR__, "src", "references.bib")
20-
const paperpile_url = "https://paperpile.com/eb/nimbzsGosN"
21-
if isfile(bibfile)
22-
rm(bibfile)
23-
end
24-
Downloads.download(paperpile_url, bibfile)
25-
26-
# Cleanup the bibliography file to make DocumenterCitations happy despite their
27-
# refusal to acknowledge modern field names. The people will partu like it's
28-
# 1971 and they will like it.
29-
lines = readlines(bibfile)
30-
open(bibfile, "w") do bfile
31-
for line in lines
32-
if contains(line, "journaltitle")
33-
println(bfile, replace(line, "journaltitle" => "journal"))
34-
elseif contains(line, "date")
35-
yrmatch = match(r"{(\d{4})", line)
36-
if !isnothing(yrmatch)
37-
println(bfile, "year = {$(yrmatch[1])},")
38-
end
39-
println(bfile, line)
40-
else
41-
println(bfile, line)
42-
end
43-
end
44-
end
45-
# Look how they massacred my boy
46-
47-
bib = CitationBibliography(
48-
bibfile;
49-
style = :authoryear,
50-
)
18+
# Steps required before the build
19+
include(joinpath("steps", "bibliography.jl")) # References for the doc
20+
include(joinpath("steps", "changelogs.jl")) # CHANGELOG files on the website
21+
include(joinpath("steps", "datasets.jl")) # Prepare the datasets vignettes
22+
include(joinpath("steps", "polygons.jl")) # Prepare the polygons vignettes
5123

5224
# Generate a report card for each known dataset
5325
include("dataset_report.jl")
@@ -56,9 +28,6 @@ include("polygon_report.jl")
5628
# Additional functions to process the text when handled by Literate
5729
include("processing.jl")
5830

59-
# Changelogs
60-
include("changelogs.jl")
61-
6231
# Render the tutorials and how-to using Literate
6332
for folder in ["howto", "tutorials"]
6433
fpath = joinpath(@__DIR__, "src", folder)

docs/src/howto/mask-polygons.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
using SpeciesDistributionToolkit
44
using CairoMakie
5-
import GeoJSON
65
CairoMakie.activate!(; type = "png", px_per_unit = 2) #hide
76

8-
# In this tutorial, we will clip a layer to a polygon (in GeoJSON format), then
9-
# use the same polygon to filter GBIF records.
7+
# In this tutorial, we will clip a layer to a polygon, then use the same polygon
8+
# to filter GBIF records.
109

1110
# ::: warning About coordinates
1211
#

docs/steps/bibliography.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import Downloads
2+
3+
# Download the bibliography from paperpile public URL
4+
const bibfile = joinpath(@__DIR__, "src", "references.bib")
5+
const paperpile_url = "https://paperpile.com/eb/nimbzsGosN"
6+
if isfile(bibfile)
7+
rm(bibfile)
8+
end
9+
10+
# This is the actual download of the bibliography. Note that we FORCE the
11+
# download at ever build, so that it is kept up to date (and it's also not
12+
# stored locally).
13+
Downloads.download(paperpile_url, bibfile)
14+
15+
# Cleanup the bibliography file to make DocumenterCitations happy despite their
16+
# refusal to acknowledge modern field names. The people will party like it's
17+
# 1971 and they will like it.
18+
lines = readlines(bibfile)
19+
open(bibfile, "w") do bfile
20+
for line in lines
21+
if contains(line, "journaltitle")
22+
println(bfile, replace(line, "journaltitle" => "journal"))
23+
elseif contains(line, "date")
24+
yrmatch = match(r"{(\d{4})", line)
25+
if !isnothing(yrmatch)
26+
println(bfile, "year = {$(yrmatch[1])},")
27+
end
28+
println(bfile, line)
29+
else
30+
println(bfile, line)
31+
end
32+
end
33+
end
34+
# Look how they massacred my boy
35+
36+
# This is what we return - the bibliography for the entire package documentation
37+
const bib = CitationBibliography(
38+
bibfile;
39+
style = :authoryear,
40+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# This file will create the changelogs for each packages. Specifically, it will
2+
# go through all the folders for component packages, then format the lines so
3+
# that any issue number is turned into a link to the repo. This happens
4+
# automatically during building, and requires no user input.
5+
16
chg_path = joinpath(dirname(dirname(@__FILE__)), "docs", "src", "reference", "changelog")
27

38
if !ispath(chg_path)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ for P in subtypes(PolygonProvider)
5252
"w",
5353
) do io
5454
print(io, "# $(P) \n\n")
55-
print(io, "\n\n")
55+
return print(io, "\n\n")
5656
# print(io, "$(SimpleSDMDatasets.blurb(P))")
5757
# print(io, "\n\n")
5858
# print(io, "For more information about this provider: $(SimpleSDMDatasets.url(P))")
@@ -66,7 +66,7 @@ for P in subtypes(PolygonProvider)
6666
"a",
6767
) do io
6868
print(io, report(P, D))
69-
print(io, "\n\n")
69+
return print(io, "\n\n")
7070
end
7171
end
7272
end

0 commit comments

Comments
 (0)