From c88bc8acc99f4b2ddf3cb0fb9a638118f3d31fa0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 17 Mar 2024 16:52:05 +0100 Subject: [PATCH] Switch makedoc.g to use AutoDoc Use this to avoid duplicating the package version and release date in doc/guava.xml, removing one potential source for mistakes when doing releases. The main advantage is that it removes the hard coded path to a GAP executable, and also works correctly with ReleaseTools. --- .gitignore | 2 ++ PackageInfo.g | 18 ++++++++++- doc/guava.xml | 10 ++++--- makedoc.g | 82 ++++++++++----------------------------------------- 4 files changed, 41 insertions(+), 71 deletions(-) diff --git a/.gitignore b/.gitignore index 55ea2ab..8192aac 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ Makefile /doc/*.six /doc/*.tex /doc/*.toc +/doc/_*.xml +/doc/title.xml /doc/manual.pdf /doc/guava_bib.xml.bib diff --git a/PackageInfo.g b/PackageInfo.g index 90ae2c1..69e50da 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -260,7 +260,23 @@ TestFile := "tst/guava.tst", "nonlinear code","minimum distance", "minimum weight", "error-correcting block codes", "decoding", "generator matrix", "check matrix","covering radius", -"weight distribution","automorphism group of code" ] +"weight distribution","automorphism group of code" ], + +AutoDoc := rec( + entities := rec( + VERSION := ~.Version, + RELEASEDATE := function(date) + local day, month, year, allMonths; + day := Int(date{[1,2]}); + month := Int(date{[4,5]}); + year := Int(date{[7..10]}); + allMonths := [ "January", "February", "March", "April", "May", "June", "July", + "August", "September", "October", "November", "December"]; + return Concatenation(String(day)," ", allMonths[month], " ", String(year)); + end(~.Date), + RELEASEYEAR := ~.Date{[7..10]}, + ), +), )); diff --git a/doc/guava.xml b/doc/guava.xml index 0d9b02e..f1c1709 100644 --- a/doc/guava.xml +++ b/doc/guava.xml @@ -1,6 +1,8 @@ - + +]> @@ -16,7 +18,7 @@   - Version 3.18 + Version &VERSION; Jasper Cramwinckel @@ -64,7 +66,7 @@ Joe Fields (Maintainer) fieldsj1@southernct.edu http://giam.southernct.edu/ -January, 2023 +&RELEASEDATE; GUAVA: ©right; The GUAVA Group: 1992-2003 Jasper Cramwinckel, Erik Roijackers,Reinald Baart, Eric Minkes, @@ -173,7 +175,7 @@ Wayne Irons, Clifton (Clipper) Lennon, Jason McGowan, Shuhong Gao, Greg Gamble and Jeffrey S. Leon.

For documentation on Leon's programs, -see the src/leon/doc subdirectory of GUAVA. +see the src/leon/doc subdirectory of GUAVA. diff --git a/makedoc.g b/makedoc.g index 8f9df7f..446f920 100644 --- a/makedoc.g +++ b/makedoc.g @@ -1,67 +1,17 @@ -########################################################################### -## -#W buildman.g GUAVA Package Alexander Konovalov -## -########################################################################### - - -ExtractMyManualExamples:=function( pkgname, main, files ) -local path, tst, i, s, name, output, ch, a; -path:="doc"; -Print("Extracting manual examples for ", pkgname, " package ...\n" ); -tst:=ExtractExamples( path, main, files, "Chapter" ); -Print(Length(tst), " chapters detected\n"); -for i in [ 1 .. Length(tst) ] do - Print( "Chapter ", i, " : \c" ); - if Length( tst[i] ) > 0 then - s := String(i); - if Length(s)=1 then - # works for <100 chapters - s:=Concatenation("0",s); - fi; - name := Filename( Directory( "tst" ), - Concatenation( LowercaseString(pkgname), s, ".tst" ) ); - output := OutputTextFile( name, false ); # to empty the file first - SetPrintFormattingStatus( output, false ); # to avoid line breaks - ch := tst[i]; - AppendTo(output, "# ", pkgname, ", chapter ",i,"\n"); - for a in ch do - AppendTo(output, "\n# ",a[2], a[1]); - od; - Print("extracted ", Length(ch), " examples \n"); - else - Print("no examples \n" ); - fi; -od; -end; - -########################################################################### - -GUAVAMANUALFILES:=[ -"../PackageInfo.g", -]; - -########################################################################### -## -## GUAVABuildManual() -## -GUAVABuildManual:=function() -local mypath, path, main, files, f, bookname; -path:="doc"; -main:="guava.xml"; -bookname:="guava"; -MakeGAPDocDoc( path, main, GUAVAMANUALFILES, bookname, "/usr/lib/gap-4.12.2", "MathJax" ); -CopyHTMLStyleFiles( path ); -GAPDocManualLab( "guava" );; -ExtractMyManualExamples( "guava", main, GUAVAMANUALFILES); -end; - - -########################################################################### - -GUAVABuildManual(); - -########################################################################### -## -#E +## this creates the documentation, needs: GAPDoc and AutoDoc packages, pdflatex ## +## Call this with GAP from within the package directory. + +if fail = LoadPackage("AutoDoc", ">= 2019.04.10") then + Error("AutoDoc 2019.04.10 or newer is required"); +fi; + +AutoDoc(rec( + scaffold := rec( + bib := "guava_bib.xml", + MainPage := false, + TitlePage := false, + ), + extract_examples := true, + gapdoc := rec( main := "guava.xml" ), +));