Skip to content

Commit 5c26fd0

Browse files
authored
fix doc build (#295)
* using GOCore * Fix errors found in docs * Set the current module in the Literate source This way, docstrings are resolved respective to where the page is. * add TGGeometry to docs project * Update docs/src/api.md
1 parent 5486149 commit 5c26fd0

File tree

6 files changed

+44
-5
lines changed

6 files changed

+44
-5
lines changed

GeometryOpsCore/src/types/manifold.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ In GeometryOps (and geodesy more generally), there are three manifolds we care a
1616
- [`AutoManifold`](@ref): a special manifold that automatically selects the best manifold for the operation when it's executed. Resolves to [`Planar`](@ref), [`Spherical`](@ref), or [`Geodesic`](@ref) depending on the input geometry.
1717
1818
Generally, we aim to have `Linear` and `Spherical` be operable everywhere, whereas `Geodesic` will only apply in specific circumstances.
19-
Currently, those circumstances are [`area`](@ref), [`arclength`](@ref), and [`segmentize`](@ref), but this could be extended with time and https://github.com/JuliaGeo/SphericalGeodesics.jl.
19+
Currently, those circumstances are [`area`](@ref), `arclength`, and [`segmentize`](@ref), but this could be extended with time and https://github.com/JuliaGeo/SphericalGeodesics.jl.
2020
=#
2121

2222
export Manifold, AutoManifold, Planar, Spherical, Geodesic

GeometryOpsCore/src/types/operation.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ Here intersection_alg can be Foster, which we already have in GeometryOps, or GE
3737
but if we ever implement e.g. RelateNG in GeometryOps, we can add that in.
3838
=#
3939

40+
"""
41+
abstract type Operation{Alg <: Algorithm} end
42+
43+
Operations are callable structs, that contain the entire specification for what the algorithm will do.
44+
45+
Sometimes they may be underspecified and only materialized fully when you see the geometry, so you can extract
46+
the best manifold for those geometries.
47+
"""
4048
abstract type Operation{Alg <: Algorithm} end
4149

4250
#=

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
4242
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4343
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
4444
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
45+
TGGeometry = "d7e755d2-3c95-4bcf-9b3c-79ab1a78647b"
4546

4647
[sources]
4748
GeometryOps = {path = "../"}

docs/make.jl

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
using GeometryOps
1+
using GeometryOps, GeometryOpsCore
22
using Documenter, DocumenterVitepress
33
using Literate
44
using Makie, CairoMakie
55
CairoMakie.activate!(px_per_unit = 2, type = "svg", inline = true) # TODO: make this svg
66

7+
# import packages that activate extensions
8+
import FlexiJoins, LibGEOS, Proj, TGGeometry
9+
710
DocMeta.setdocmeta!(GeometryOps, :DocTestSetup, :(using GeometryOps; using GeometryOps.GeometryBasics); recursive=true)
811

912
using GeoInterfaceMakie
@@ -41,9 +44,29 @@ function _add_meta_edit_link_generator(path)
4144
end
4245
end
4346

47+
function _add_meta_current_module(current_module::String)
48+
return function (input)
49+
return """
50+
```@meta
51+
CurrentModule = $(current_module)
52+
```
53+
""" * input
54+
end
55+
end
56+
4457
# First letter of `str` is made uppercase and returned
4558
ucfirst(str::String) = string(uppercase(str[1]), str[2:end])
4659

60+
function current_module_from_paths(source_path, relative_path)
61+
if contains(source_path, "GeometryOpsCore")
62+
return "GeometryOpsCore"
63+
elseif endswith(source_path, "src")
64+
return "GeometryOps"
65+
elseif endswith(source_path, "ext")
66+
return "Base.get_extension(GeometryOps, :$(splitpath(relative_path)[1]))"
67+
end
68+
end
69+
4770
function process_literate_recursive!(pages::Vector{Any}, path::String)
4871
global source_path
4972
global output_path
@@ -55,10 +78,11 @@ function process_literate_recursive!(pages::Vector{Any}, path::String)
5578
if endswith(path, ".jl")
5679
relative_path = relpath(path, source_path)
5780
output_dir = joinpath(output_path, splitdir(relative_path)[1])
81+
5882
Literate.markdown(
5983
path, output_dir;
6084
flavor = Literate.CommonMarkFlavor(),
61-
postprocess = _add_meta_edit_link_generator(joinpath(relpath(source_path, output_dir), relative_path))
85+
postprocess = _add_meta_edit_link_generator(joinpath(relpath(source_path, output_dir), relative_path)) _add_meta_current_module(current_module_from_paths(source_path, relative_path))
6286
)
6387
push!(pages, joinpath("source", splitext(relative_path)[1] * ".md"))
6488
end
@@ -67,6 +91,7 @@ end
6791

6892
withenv("JULIA_DEBUG" => "Literate") do # allow Literate debug output to escape to the terminal!
6993
global literate_pages
94+
empty!(literate_pages)
7095
vec = []
7196
process_literate_recursive!(vec, source_path)
7297
literate_pages = vec[1][2] # this is a hack to get the pages in the correct order, without an initial "src" folder.
@@ -90,7 +115,7 @@ download("https://hackmd.io/kpIqAR8YRJOZQDJjUKVAUQ/download", joinpath(@__DIR__,
90115

91116
# Finally, make the docs!
92117
makedocs(;
93-
modules=[GeometryOps, GeometryOps.GeometryOpsCore],
118+
modules=[GeometryOps, GeometryOpsCore],
94119
authors="Anshul Singhvi <[email protected]> and contributors",
95120
repo="https://github.com/JuliaGeo/GeometryOps.jl/blob/{commit}{path}#{line}",
96121
sitename="GeometryOps.jl",
@@ -118,6 +143,7 @@ makedocs(;
118143
"Source code" => literate_pages,
119144
],
120145
warnonly = true,
146+
draft = true,
121147
)
122148

123149
deploydocs(;

docs/src/api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ barycentric_interpolate
5656
```
5757

5858
## Other methods
59+
5960
```@autodocs
6061
Modules = [GeometryOps]
6162
```
6263

6364
## Core types
65+
6466
```@autodocs
6567
Modules = [GeometryOpsCore]
6668
```

src/types.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ to use the appropriate PROJ function via `Proj.jl` for the operation.
158158
## Extended help
159159
160160
This is the default algorithm for [`reproject`](@ref), and will also be the default algorithm for
161-
operations on geodesics like [`area`](@ref) and [`arclength`](@ref).
161+
operations on geodesics like [`area`](@ref) and `arclength`.
162162
"""
163163
struct PROJ{M <: Manifold} <: Algorithm{M}
164164
manifold::M
@@ -183,3 +183,5 @@ function enforce(alg::PROJ, kw::Symbol, f)
183183
error("$(f) requires a `$(kw)` keyword argument to the `GEOS` algorithm, which was not provided.")
184184
end
185185
end
186+
187+

0 commit comments

Comments
 (0)