@@ -4,6 +4,48 @@ using Documenter
44
55DocMeta. setdocmeta! (OpenCV, :DocTestSetup , :(using OpenCV); recursive= true )
66
7+ # Generate the "Wrapped functions" page from gen/funclist.csv at build time, so the
8+ # list of wrapped OpenCV APIs in the docs stays in lockstep with the bindings.
9+ function generate_wrapped_functions_page ()
10+ csv = joinpath (@__DIR__ , " .." , " gen" , " funclist.csv" )
11+ out = joinpath (@__DIR__ , " src" , " wrapped_functions.md" )
12+ entries = String[]
13+ for line in eachline (csv)
14+ s = strip (line)
15+ (isempty (s) || startswith (s, " #" )) && continue
16+ startswith (s, " cv." ) && push! (entries, String (s[4 : end ]))
17+ end
18+ free = sort (unique (filter (e -> ! occursin (' .' , e), entries)))
19+ groups = Dict {String, Vector{String}} ()
20+ for e in filter (e -> occursin (' .' , e), entries)
21+ cls, rest = split (e, ' .' ; limit = 2 )
22+ push! (get! (groups, String (cls), String[]), String (rest))
23+ end
24+ for (k, v) in groups
25+ groups[k] = sort (unique (v))
26+ end
27+ nfuncs = length (free) + sum (length, values (groups); init = 0 )
28+ open (out, " w" ) do io
29+ println (io, " # Wrapped functions\n " )
30+ println (io, " !!! note" )
31+ println (io, " This page is generated from [`gen/funclist.csv`](https://github.com/JuliaImages/OpenCV.jl/blob/master/gen/funclist.csv) at build time β the authoritative list of every OpenCV function exposed by the bindings ($nfuncs functions).\n " )
32+ println (io, " Names follow the `cv::` β `OpenCV.` convention (see [Core concepts](@ref)): " *
33+ " free functions map directly (`cv.add` β `OpenCV.add`); class *static* methods " *
34+ " flatten with `_` (`cv.ORB.create` β `OpenCV.ORB_create`); and *instance* methods " *
35+ " dispatch on the object (`cv.FileStorage.open` β `OpenCV.open(fs, β¦)`). Everything is " *
36+ " reached through the `OpenCV.` prefix.\n " )
37+ println (io, " ## Free functions\n " )
38+ println (io, join ((" `OpenCV.$f `" for f in free), " Β· " ), " \n " )
39+ println (io, " ## Classes and submodules\n " )
40+ for cls in sort (collect (keys (groups)))
41+ println (io, " ### `$cls `\n " )
42+ println (io, join ((" `cv.$cls .$m `" for m in sort (groups[cls])), " Β· " ), " \n " )
43+ end
44+ end
45+ return out
46+ end
47+ generate_wrapped_functions_page ()
48+
749makedocs (;
850 modules= [OpenCV],
951 sitename= " OpenCV.jl" ,
@@ -13,6 +55,7 @@ makedocs(;
1355 " Core concepts" => " core_concepts.md" ,
1456 " Reading and Writing of Images" => " Getting started with Images.md" ,
1557 " API reference" => " api.md" ,
58+ " Wrapped functions" => " wrapped_functions.md" ,
1659 ]
1760)
1861
0 commit comments