Skip to content

Commit 1acb506

Browse files
authored
Update makedoc.g
1 parent 6791446 commit 1acb506

File tree

1 file changed

+26
-43
lines changed

1 file changed

+26
-43
lines changed

makedoc.g

+26-43
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
pkgName := "SmallClassNr";
2-
3-
tst := DirectoriesPackageLibrary( pkgName, "tst" )[1];
4-
info := PackageInfo( pkgName )[1];
1+
Read( "PackageInfo.g" );
2+
info := GAPInfo.PackageInfoCurrent;
3+
pkgName := info.PackageName;
54

65
if (
76
LoadPackage( pkgName, false ) = fail or
@@ -20,57 +19,41 @@ if IsBound( info.Extensions ) then
2019
fi;
2120

2221
AutoDoc( rec(
23-
autodoc := rec(
24-
files := [ "doc/manual.gd" ]
25-
),
26-
scaffold := rec(
27-
bib := "manual.bib"
28-
),
22+
autodoc := rec( scan_dirs := [ "doc" ] ),
2923
gapdoc := rec(
30-
main := "manual.xml",
31-
LaTeXOptions := rec(
32-
LateExtraPreamble := "\\usepackage{amsmath}"
33-
)
24+
LaTeXOptions := rec( LateExtraPreamble := "\\usepackage{amsmath}" )
3425
),
35-
extract_examples := rec(
36-
units := "Chapter"
37-
)
26+
extract_examples := rec( units := "File" )
3827
));
3928

40-
if not ValidatePackageInfo( "PackageInfo.g" ) then
29+
if not ForAll(
30+
[ "doc/manual.six", "doc/manual.pdf", "doc/chap0.html" ],
31+
IsReadableFile
32+
) then
4133
Info( InfoGAPDoc, 1, "#I One or more files could not be created.\n" );
4234
ForceQuitGap( 1 );
4335
else
4436
Info( InfoGAPDoc, 1, "#I Manual files sucessfully created.\n" );
4537
fi;
4638

47-
correct := true;
48-
Info( InfoGAPDoc, 1, "#I Testing examples found in manual.\n" );
49-
50-
lpkgName := LowercaseString( pkgName );
51-
lpkgName := ReplacedString( lpkgName, " ", "_" );
52-
53-
for file in AsSortedList( DirectoryContents( tst ) ) do
54-
if (
55-
StartsWith( file, lpkgName ) and
56-
EndsWith( file, ".tst" ) and
57-
Length( file ) - Length( lpkgName ) >= 6 and
58-
ForAll( file{[1 + Length( lpkgName ) .. Length( file ) - 4]}, IsDigitChar )
59-
) then
60-
Info( InfoGAPDoc, 1, Concatenation( "#I Now testing file ", file, "\n" ) );
61-
correct := correct and Test(
62-
Filename( tst, file ),
63-
rec( compareFunction := "uptowhitespace" )
64-
);
65-
RemoveFile( Filename( tst, file ) );
39+
tstFile := Concatenation(
40+
"tst/",
41+
ReplacedString( LowercaseString( pkgName ), " ", "_" ),
42+
"01.tst"
43+
);
44+
45+
if IsReadableFile( tstFile ) then
46+
Info( InfoGAPDoc, 1, "#I Testing examples found in manual.\n" );
47+
correct := Test( tstFile, rec( compareFunction := "uptowhitespace" ) );
48+
RemoveFile( tstFile );
49+
if correct then
50+
Info( InfoGAPDoc, 1, "#I All examples are correct.\n" );
51+
else
52+
Info( InfoGAPDoc, 1, "#I One or more examples are incorrect.\n" );
53+
ForceQuitGap( 1 );
6654
fi;
67-
od;
68-
69-
if not correct then
70-
Info( InfoGAPDoc, 1, "#I One or more examples are incorrect.\n" );
71-
ForceQuitGap( 1 );
7255
else
73-
Info( InfoGAPDoc, 1, "#I All tests passed - manual should be correct.\n" );
56+
Info( InfoGAPDoc, 1, "#I No examples found in manual.\n" );
7457
fi;
7558

7659
Info( InfoGAPDoc, 1, "#I Documentation successfully created.\n" );

0 commit comments

Comments
 (0)