Skip to content

Commit 9f81472

Browse files
fingolfinoai-codex
andauthored
docs: Clarify scan_dirs behavior (#345)
Clarify in both the tutorial and reference manual that autodoc.scan_dirs controls scanning for AutoDoc source comments and .autodoc files, while gapdoc.scan_dirs only controls scanning for GAPDoc comments. This also corrects the tutorial examples to use the autodoc record for the documented behavior. Fixes #263 AI assistance was provided by Codex for reviewing the existing documentation, drafting the wording changes, and updating the generated manual fixtures. Co-authored-by: Codex <[email protected]>
1 parent 2c6a3f7 commit 9f81472

File tree

4 files changed

+42
-18
lines changed

4 files changed

+42
-18
lines changed

doc/Tutorials.autodoc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,27 @@ LoadPackage( "AutoDoc" );
275275
AutoDoc( rec( gapdoc := rec( main := "main" ) ) );
276276
```
277277

278-
As explained above, by default &AutoDoc; scans all <F>.g</F>, <F>.gd</F> and <F>.gi</F> files
279-
it can find inside of your package root directory, and in the subdirectories <F>gap</F>,
280-
<F>lib</F>, <F>examples</F> and <F>examples/doc</F> as well.
281-
If you keep source files with documentation in other directories,
282-
you can adjust the list of directories AutoDoc scans via the <C>scan_dirs</C> option.
283-
The following example illustrates this by instructing &AutoDoc; to only search in the subdirectory <F>package_sources</F>
284-
of the package's root directory.
278+
&AutoDoc; can scan directories for documentation input automatically.
279+
In fact there are two separate scanning steps.
280+
The option <C>autodoc.scan_dirs</C> controls where it looks for source comments beginning with
281+
<C>#!</C> and for standalone <F>.autodoc</F> files.
282+
By default, it scans the package root directory and the subdirectories <F>gap</F>,
283+
<F>lib</F>, <F>examples</F> and <F>examples/doc</F>.
284+
If you keep that kind of input in other directories, adjust <C>autodoc.scan_dirs</C>.
285+
The following example instructs &AutoDoc; to only search in the subdirectory
286+
<F>package_sources</F> of the package's root directory for those files.
285287
```@listing
286288
LoadPackage( "AutoDoc" );
287-
AutoDoc( rec( gapdoc := rec( scan_dirs := [ "package_sources" ] ) ) );
289+
AutoDoc( rec( autodoc := rec( scan_dirs := [ "package_sources" ] ) ) );
288290
```
291+
The separate option <C>gapdoc.scan_dirs</C> serves a different purpose:
292+
it controls where &GAPDoc; comments are searched for.
293+
289294
You can also specify an explicit list of files containing documentation,
290295
which will be searched in addition to any files located within the scan directories:
291296
```@listing
292297
LoadPackage( "AutoDoc" );
293-
AutoDoc( rec( gapdoc := rec( files := [ "path/to/some/hidden/file.gd" ] ) ) );
298+
AutoDoc( rec( autodoc := rec( files := [ "path/to/some/hidden/file.gd" ] ) ) );
294299
```
295300
Giving such a file does not prevent the standard <C>scan_dirs</C> from being scanned for
296301
other files.

gap/Magic.gd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@
250250
#! A list of subdirectories of the package directory (given as relative paths)
251251
#! which &AutoDoc; then scans for .gi, .gd, .g, and .autodoc files; all of these files
252252
#! are then scanned for &AutoDoc; documentation comments.
253+
#! This controls where &AutoDoc; looks for source comments beginning with <C>#!</C>
254+
#! and for standalone <F>.autodoc</F> files.
255+
#! It does not affect where &GAPDoc; looks for GAPDoc comments; that is controlled
256+
#! separately by <A>gapdoc.scan_dirs</A>.
253257
#! <Br/>
254258
#! <E>Default value: <C>[ ".", "gap", "lib", "examples", "examples/doc" ]</C>.</E>
255259
#! </Item>
@@ -314,6 +318,9 @@
314318
#! A list of subdirectories of the package directory (given as relative paths)
315319
#! which &AutoDoc; then scans for .gi, .gd and .g files; all of these files
316320
#! are then scanned for &GAPDoc; documentation comments.
321+
#! This controls only where &GAPDoc; comments are searched for.
322+
#! It does not affect where &AutoDoc; looks for source comments beginning with <C>#!</C>
323+
#! or for <F>.autodoc</F> files; use <A>autodoc.scan_dirs</A> for that.
317324
#! <Br/>
318325
#! <E>Default value: <C>[ ".", "gap", "lib", "examples", "examples/doc" ]</C>.</E>
319326
#! </Item>

tst/manual.expected/_Chapter_Reference.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@
267267
A list of subdirectories of the package directory (given as relative paths)
268268
which &AutoDoc; then scans for .gi, .gd, .g, and .autodoc files; all of these files
269269
are then scanned for &AutoDoc; documentation comments.
270+
This controls where &AutoDoc; looks for source comments beginning with <C>#!</C>
271+
and for standalone <F>.autodoc</F> files.
272+
It does not affect where &GAPDoc; looks for GAPDoc comments; that is controlled
273+
separately by <A>gapdoc.scan_dirs</A>.
270274
<Br/>
271275
<E>Default value: <C>[ ".", "gap", "lib", "examples", "examples/doc" ]</C>.</E>
272276
</Item>
@@ -314,6 +318,9 @@
314318
A list of subdirectories of the package directory (given as relative paths)
315319
which &AutoDoc; then scans for .gi, .gd and .g files; all of these files
316320
are then scanned for &GAPDoc; documentation comments.
321+
This controls only where &GAPDoc; comments are searched for.
322+
It does not affect where &AutoDoc; looks for source comments beginning with <C>#!</C>
323+
or for <F>.autodoc</F> files; use <A>autodoc.scan_dirs</A> for that.
317324
<Br/>
318325
<E>Default value: <C>[ ".", "gap", "lib", "examples", "examples/doc" ]</C>.</E>
319326
</Item>

tst/manual.expected/_Chapter_Tutorials.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,22 +298,27 @@ LoadPackage( "AutoDoc" );
298298
AutoDoc( rec( gapdoc := rec( main := "main" ) ) );
299299
]]></Listing>
300300
<P/>
301-
As explained above, by default &AutoDoc; scans all <F>.g</F>, <F>.gd</F> and <F>.gi</F> files
302-
it can find inside of your package root directory, and in the subdirectories <F>gap</F>,
303-
<F>lib</F>, <F>examples</F> and <F>examples/doc</F> as well.
304-
If you keep source files with documentation in other directories,
305-
you can adjust the list of directories AutoDoc scans via the <C>scan_dirs</C> option.
306-
The following example illustrates this by instructing &AutoDoc; to only search in the subdirectory <F>package_sources</F>
307-
of the package's root directory.
301+
&AutoDoc; can scan directories for documentation input automatically.
302+
In fact there are two separate scanning steps.
303+
The option <C>autodoc.scan_dirs</C> controls where it looks for source comments beginning with
304+
<C>#!</C> and for standalone <F>.autodoc</F> files.
305+
By default, it scans the package root directory and the subdirectories <F>gap</F>,
306+
<F>lib</F>, <F>examples</F> and <F>examples/doc</F>.
307+
If you keep that kind of input in other directories, adjust <C>autodoc.scan_dirs</C>.
308+
The following example instructs &AutoDoc; to only search in the subdirectory
309+
<F>package_sources</F> of the package's root directory for those files.
308310
<Listing><![CDATA[
309311
LoadPackage( "AutoDoc" );
310-
AutoDoc( rec( gapdoc := rec( scan_dirs := [ "package_sources" ] ) ) );
312+
AutoDoc( rec( autodoc := rec( scan_dirs := [ "package_sources" ] ) ) );
311313
]]></Listing>
314+
The separate option <C>gapdoc.scan_dirs</C> serves a different purpose:
315+
it controls where &GAPDoc; comments are searched for.
316+
<P/>
312317
You can also specify an explicit list of files containing documentation,
313318
which will be searched in addition to any files located within the scan directories:
314319
<Listing><![CDATA[
315320
LoadPackage( "AutoDoc" );
316-
AutoDoc( rec( gapdoc := rec( files := [ "path/to/some/hidden/file.gd" ] ) ) );
321+
AutoDoc( rec( autodoc := rec( files := [ "path/to/some/hidden/file.gd" ] ) ) );
317322
]]></Listing>
318323
Giving such a file does not prevent the standard <C>scan_dirs</C> from being scanned for
319324
other files.

0 commit comments

Comments
 (0)