Skip to content

Commit

Permalink
set an exit code in make_doc (#5835)
Browse files Browse the repository at this point in the history
For that,
- redirect the `Info` output generated by GAPDoc functions to a string,
- extract the messages that describe warnings; according to
  frankluebeck/GAPDoc/commit/826c091491438c1f6ba1f330d17914f45b4bd3af,
  these are the lines starting with `"#W "`,
- omit the LaTeX warnings about overfull boxes (I think we do not want
  to force ourselves to create manuals without these warning),
- report failure if the set of remaining warnings is nonempty.
  • Loading branch information
ThomasBreuer authored Nov 27, 2024
1 parent ff53a46 commit 37a8938
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions doc/make_doc.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
set -o pipefail

GAP=@abs_top_builddir@/gap
GAPARGS="-b -m 1g -x 80 -q --quitonbreak"
GAPARGS="-b -m 1g -x 80 -q --quitonbreak -r"
if [ "$1" == "nopdf" ]; then
NOPDF=", \"nopdf\""
else
Expand All @@ -20,6 +20,13 @@ books:=["ref", "tut", "hpc", "dev"];;
latexOpts := rec(Maintitlesize := "\\\\fontsize{36}{38}\\\\selectfont");;
UpdateXMLForUserPreferences();
for run in [1,2] do
# collect output messages separately in both runs
outputstring:= "";;
outputstream:= OutputTextString(outputstring, true);;
SetPrintFormattingStatus(outputstream, false);
SetInfoOutput(InfoGAPDoc, outputstream);
SetInfoOutput(InfoWarning, outputstream);
for book in books do
path := Concatenation(base, "/doc/", book);
dir := Directory(path);
Expand All @@ -29,10 +36,10 @@ for run in [1,2] do
continue;
fi;
Print("----------------------------\n");
Print("Building GAP manual '",book,"' at ",path,"\n");
Print("Run ",run," of 2\n");
Print("----------------------------\n");
AppendTo(outputstream, "----------------------------\n");
AppendTo(outputstream, "Building GAP manual '",book,"' at ",path,"\n");
AppendTo(outputstream, "Run ",run," of 2\n");
AppendTo(outputstream, "----------------------------\n");
# for the reference manual, extra list of source files to scan
if book = "ref" then
Expand Down Expand Up @@ -65,5 +72,21 @@ for run in [1,2] do
SetGapDocLaTeXOptions("color", latexOpts);
MakeGAPDocDoc( path, "main.xml", files, book, "../..", "MathJax" $NOPDF);;
od;
CloseStream(outputstream);
UnbindInfoOutput(InfoGAPDoc);
UnbindInfoOutput(InfoWarning);
Print(outputstring);
od;
# evaluate the outputs for the second run
outputstring:= ReplacedString(outputstring, "\c", "");;
errors:= Filtered(SplitString(outputstring, "\n"),
x -> StartsWith(x, "#W ") and x <> "#W There are overfull boxes:");;
if Length(errors) = 0 then
QuitGap(true);
else
Print(errors, "\n");
QuitGap(false);
fi;
EOF

0 comments on commit 37a8938

Please sign in to comment.