diff --git a/gap/Magic.gd b/gap/Magic.gd index e3366b26..b6b9e834 100644 --- a/gap/Magic.gd +++ b/gap/Magic.gd @@ -402,5 +402,5 @@ DeclareGlobalFunction( "AutoDoc" ); #! @Section Examples #! -#! Some basic examples for using AutoDoc were already shown in +#! Some basic examples for using were already shown in #! Chapter . diff --git a/gap/Magic.gi b/gap/Magic.gi index 0bec8500..013bf93c 100644 --- a/gap/Magic.gi +++ b/gap/Magic.gi @@ -73,7 +73,8 @@ function( arg ) pkgdirstr, docdirstr, title_page, tree, is_worksheet, position_document_class, - args; + args, + outputstring, outputstream; if Length( arg ) >= 3 then Error( "too many arguments" ); @@ -589,8 +590,18 @@ function( arg ) Add( args, "nopdf" ); fi; - # Finally, invoke GAPDoc + # Finally, invoke GAPDoc (and collect info messages) + outputstring := ""; + outputstream := OutputTextString( outputstring, true ); + SetPrintFormattingStatus( outputstream, false ); + SetInfoOutput( InfoGAPDoc, outputstream ); + SetInfoOutput( InfoWarning, outputstream ); CallFuncList( MakeGAPDocDoc, args ); + CloseStream( outputstream ); + UnbindInfoOutput( InfoGAPDoc ); + UnbindInfoOutput( InfoWarning ); + Print( outputstring ); + outputstring := ReplacedString( outputstring, "\c", "" ); # NOTE: We cannot just write CopyHTMLStyleFiles(doc_dir) here, as # CopyHTMLStyleFiles its argument directly to Directory(), leading @@ -665,5 +676,13 @@ function( arg ) AUTODOC_ExtractMyManualExamples( pkgname, pkgdir, doc_dir, gapdoc.main, gapdoc.files, extract_examples ); fi; + if IsBound( outputstring ) then + # If wanted then set an exit code for GAP. + if Number( SplitString( outputstring, "\n" ), + x -> StartsWith( x, "#W " ) and not + StartsWith( x, "#W There are overfull boxes" ) ) > 0 then + GapExitCode( false ); + fi; + fi; return true; end ); diff --git a/makedoc.g b/makedoc.g index 91d7454d..e1742cf9 100644 --- a/makedoc.g +++ b/makedoc.g @@ -7,7 +7,7 @@ LoadPackage("AutoDoc"); -AutoDoc( rec( +AutoDoc( rec( autodoc := true, gapdoc := rec( LaTeXOptions := rec( EarlyExtraPreamble := """ diff --git a/tst/manual.expected/_Chapter_AutoDoc.xml b/tst/manual.expected/_Chapter_AutoDoc.xml index 52d46698..d0a83c35 100644 --- a/tst/manual.expected/_Chapter_AutoDoc.xml +++ b/tst/manual.expected/_Chapter_AutoDoc.xml @@ -364,7 +364,7 @@ Examples

- Some basic examples for using AutoDoc were already shown in + Some basic examples for using were already shown in Chapter .