5959
6060quantum_control_members = [
6161 m for m in names (QuantumControl)
62- if m ≠ :QuantumControl
62+ if ( m ≠ :QuantumControl ) && (m ∉ QuantumControl . DEPRECATED)
6363]
6464
65- quantum_control_local_members = get_local_members (QuantumControl, all= false )
65+ quantum_control_local_members = filter (
66+ member -> member ∉ QuantumControl. DEPRECATED,
67+ get_local_members (QuantumControl, all= false )
68+ )
6669
6770quantum_control_reexported_members = [
68- m for m in quantum_control_members
69- if m ∉ quantum_control_local_members
71+ m for m in quantum_control_members if m ∉ quantum_control_local_members
7072]
7173
7274quantum_control_sub_modules = get_submodules (QuantumControl)
7375
7476
7577subpackages = [
7678 (:QuantumPropagators , " quantum_propagators.md" ),
77- (:QuantumControlBase , " quantum_control_base.md" ),
7879]
7980
8081
@@ -84,20 +85,27 @@ open(outfile, "w") do out
8485 write (out, " ```@meta\n " )
8586 write (out, " EditURL = \" ../../generate_api.jl\"\n " )
8687 write (out, " ```\n\n " )
87- write (out, " # [QuantumControl](@id QuantumControlAPI)\n\n " )
88- _quantum_control_local_members = filter (
89- member -> ! (member in QuantumControl. DEPRECATED),
90- quantum_control_local_members
91- )
92- if length (_quantum_control_local_members) > 0
93- error (" QuantumControl has local members. We don't want this" )
94- end
88+ write (out, " # [QuantumControl Public API](@id QuantumControlAPI)\n\n " )
9589 write (out, """
90+ This page summarizes the public API of the `QuantumControl` package. See
91+ also the [Index](@ref API-Index) of *all* symbols.
92+
93+ QuantumControl exports the following symbols:
9694
97- QuantumControl (re-)exports the following symbols:
95+ """ )
96+ for name ∈ quantum_control_local_members
97+ obj = getfield (QuantumControl, name)
98+ ref = canonical_name (obj)
99+ println (out, " * [`$name `](@ref $ref )" )
100+ end
98101
102+ write (out, """
99103
104+ and re-exports the following symbols either from its own
105+ [submodules](@ref public_submodules) or from
106+ [`QuantumPropagators`](@ref QuantumPropagatorsPackage):
100107 """ )
108+
101109 for name ∈ quantum_control_reexported_members
102110 obj = getfield (QuantumControl, name)
103111 ref = canonical_name (obj)
@@ -106,13 +114,24 @@ open(outfile, "w") do out
106114
107115 write (out, """
108116
109- It also defines the following unexported functions:
117+ It also defines the following public, but unexported functions:
110118
111119 * [`QuantumControl.set_default_ad_framework`](@ref)
112- * [`QuantumControl.print_versions`](@ref)
113120
114121 """ )
115122
123+ write (out, """
124+ ### [Submodules](@id public_submodules)
125+
126+ Each of the following submodules defines their own public API. Note that
127+ some of these submodules are re-exported from or extend submodules of
128+ [`QuantumPropagators`](@ref QuantumPropagatorsPackage).
129+
130+ """ )
131+ for submod in quantum_control_sub_modules
132+ write (out, " * [`QuantumControl.$(submod) `](@ref QuantumControl$(submod) API)\n " )
133+ end
134+
116135 for submod in quantum_control_sub_modules
117136 write (out, " \n\n ### [`QuantumControl.$submod `](@id QuantumControl$(submod) API)\n\n " )
118137 for name in names (getfield (QuantumControl, submod))
@@ -140,8 +159,6 @@ open(outfile, "w") do out
140159end
141160
142161
143- local_submodules = [:Functionals , :PulseParameterizations , :Workflows ]
144-
145162local_module_api_id (mod) = replace (" $mod " , " ." => " " ) * " LocalAPI"
146163
147164function write_module_api (out, mod, description= " " )
@@ -178,14 +195,14 @@ function write_module_api(out, mod, description="")
178195 write (out, " \n\n " )
179196 end
180197 if length (public_members) > 0
181- write (out, " \n Public Members :\n\n " )
198+ write (out, " \n Public Symbols :\n\n " )
182199 for name ∈ public_members
183200 println (out, " * [`$name `](@ref $mod .$name )" )
184201 end
185202 write (out, " \n " )
186203 end
187204 if length (reexported_members) > 0
188- write (out, " \n Re-exported Members :\n\n " )
205+ write (out, " \n Re-exported Symbols :\n\n " )
189206 for name ∈ reexported_members
190207 obj = getfield (mod, name)
191208 ref = canonical_name (obj)
@@ -194,22 +211,22 @@ function write_module_api(out, mod, description="")
194211 write (out, " \n " )
195212 end
196213 if length (documented_private_members) > 0
197- write (out, " \n Private Members :\n " )
214+ write (out, " \n Private Symbols :\n " )
198215 for name ∈ documented_private_members
199216 println (out, " * [`$name `](@ref $mod .$name )" )
200217 end
201218 write (out, " \n " )
202219 end
203220 if length (public_members) > 0
204- write (out, " \n\n #### Public members \n\n " )
221+ write (out, " \n\n #### Public Symbols \n\n " )
205222 println (out, " ```@docs" )
206223 for name ∈ public_members
207224 println (out, " $mod .$name " )
208225 end
209226 println (out, " ```" )
210227 end
211228 if length (documented_private_members) > 0
212- write (out, " \n\n #### Private members \n\n " )
229+ write (out, " \n\n #### Private Symbols \n\n " )
213230 println (out, " ```@docs" )
214231 for name ∈ documented_private_members
215232 println (out, " $mod .$name " )
@@ -220,52 +237,67 @@ function write_module_api(out, mod, description="")
220237end
221238
222239
223- outfile = joinpath (@__DIR__ , " src" , " api" , " quantum_control_reference .md" )
240+ outfile = joinpath (@__DIR__ , " src" , " api" , " reference .md" )
224241println (" Generating local reference for QuantumControl in $outfile " )
225242open (outfile, " w" ) do out
226243 write (out, " ```@meta\n " )
227244 write (out, " EditURL = \" ../../generate_api.jl\"\n " )
228245 write (out, " ```\n\n " )
229246 write (out, raw """
230- # Local Submodules
247+ # API Reference
231248
232- The following submodules of `QuantumControl` are defined *locally* (as
233- opposed to being re-exported from sub-packages).
249+ This page provides *all* docstrings locally defined in the `QuantumControl`
250+ package for both private and public symbols. See also the summary of the
251+ [public API](@ref QuantumControlAPI).
234252
235- ``\g def\t gt{\t ext{tgt}}``
236- ``\g def\t r{\o peratorname{tr}}``
237- ``\g def\R e{\o peratorname{Re}}``
238- ``\g def\I m{\o peratorname{Im}}``
239- """ )
240- for name in local_submodules
241- write (out, " * [`QuantumControl.$name `](#$(local_module_api_id (getfield (QuantumControl, name))) )\n " )
242- end
243- write (out, raw """
253+ `QuantumControl` exposes local [exported](#quantumcontrol-local-symbols)
254+ and [unexported](#quantumcontrol-local-unexported-symbols) local symbols as
255+ well as re-exporting symbols and sub-modules from the
256+ [QuantumPropagators](@ref QuantumPropagatorsPackage) subpackage and some
257+ of its submodules.
244258
245- `QuantumControl` also locally defines some unexported functions:
259+ The [`QuantumControl` submodules](@ref quantumcontrol-submodules) provide
260+ additional public functionality. Note that some of the most commonly
261+ used symbols from `QuantumControl`'s submodules may also be re-exported at
262+ the top-level (such as [`@optimize_or_load`](@ref) from the
263+ [`QuantumControl.Workflows`](@ref QuantumControlWorkflowsAPI) submodule).
246264
247- * [`QuantumControl` local unexported functions](#quantumcontrol-local-functions)
265+ """ )
266+ write (out, raw """
248267
268+ ## [Local Exported Symbols](@id #quantumcontrol-local-symbols)
249269
250270 """ )
251- for name in local_submodules
252- write_module_api (out, getfield (QuantumControl, name))
271+ println (out, " ```@docs" )
272+ for name ∈ quantum_control_local_members
273+ println (out, " QuantumControl.$name " )
253274 end
275+ println (out, " ```" )
254276 write (out, raw """
255277
256- ## [`QuantumControl` local unexported functions ](@id quantumcontrol-local-functions )
278+ ## [Local Unexported Symbols ](@id quantumcontrol-local-unexported-symbols )
257279
258280 ```@docs
259281 QuantumControl.set_default_ad_framework
260- QuantumControl.print_versions
261282 ```
283+ """ )
284+ write (out, raw """
285+ ``\g def\t gt{\t ext{tgt}}``
286+ ``\g def\t r{\o peratorname{tr}}``
287+ ``\g def\R e{\o peratorname{Re}}``
288+ ``\g def\I m{\o peratorname{Im}}``
262289
263- ```@example
264- import QuantumControl
265- QuantumControl.print_versions()
266- ```
290+ ## [List of Submodules](@id quantumcontrol-submodules)
291+
292+ `QuantumControl` has the following sub-modules:
267293
268294 """ )
295+ for name in quantum_control_sub_modules
296+ write (out, " * [`QuantumControl.$name `](#$(local_module_api_id (getfield (QuantumControl, name))) )\n " )
297+ end
298+ for name in quantum_control_sub_modules
299+ write_module_api (out, getfield (QuantumControl, name))
300+ end
269301end
270302
271303
@@ -276,7 +308,7 @@ open(outfile, "w") do out
276308 write (out, " EditURL = \" ../../generate_api.jl\"\n " )
277309 write (out, " ```\n\n " )
278310 write (out, raw """
279- # API Index
311+ # [ API Index](@id API-Index)
280312
281313 ```@index
282314 ```
@@ -320,13 +352,13 @@ for (pkgname::Symbol, outfilename) in subpackages
320352 """ )
321353 write (out, " \n\n ## [`$pkgname `](@id $(pkgname) API)\n\n " )
322354 if length (public_members) > 0
323- write (out, " \n Public Members :\n\n " )
355+ write (out, " \n Public Symbols :\n\n " )
324356 for name in public_members
325357 write (out, " * [`$name `](@ref $pkgname .$name )\n " )
326358 end
327359 end
328360 if length (documented_private_members) > 0
329- write (out, " \n Private Members :\n\n " )
361+ write (out, " \n Private Symbols :\n\n " )
330362 for name in documented_private_members
331363 write (out, " * [`$name `](@ref $pkgname .$name )\n " )
332364 end
0 commit comments