Skip to content

Commit 42dc5c6

Browse files
committed
Simplify code using "nopdf" option added in GAPDoc 1.6.3
1 parent bace4a7 commit 42dc5c6

File tree

4 files changed

+8
-90
lines changed

4 files changed

+8
-90
lines changed

PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ PackageDoc := rec(
118118

119119
Dependencies := rec(
120120
GAP := ">= 4.5",
121-
NeededOtherPackages := [ [ "GAPDoc", ">= 1.5" ] ],
121+
NeededOtherPackages := [ [ "GAPDoc", ">= 1.6.3" ] ],
122122
SuggestedOtherPackages := [ ],
123123
ExternalConditions := []
124124

gap/Magic.gi

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function( arg )
7373
pkgdirstr, docdirstr,
7474
title_page, tree, is_worksheet,
7575
position_document_class,
76-
makeDocFun, args;
76+
args;
7777

7878
if Length( arg ) >= 3 then
7979
Error( "too many arguments" );
@@ -552,13 +552,6 @@ function( arg )
552552
GAPDoc2LaTeXProcs.Tail := Concatenation(
553553
"\\immediate\\write\\pagenrlog{[\"Ind\", 0, 0], \\arabic{page},}\n",
554554
GAPDoc2LaTeXProcs.Tail );
555-
556-
# Choose how we call GAPDoc
557-
if Filename( DirectoriesSystemPrograms(), "pdflatex" ) <> fail then
558-
makeDocFun := MakeGAPDocDoc;
559-
else
560-
makeDocFun := AutoDoc_MakeGAPDocDoc_WithoutLatex;
561-
fi;
562555

563556
# Process Chunks.xml file, if present
564557
if IsString(_AUTODOC_GLOBAL_CHUNKS_FILE) then
@@ -568,6 +561,11 @@ function( arg )
568561
# Default parameters for MakeGAPDocDoc
569562
args := [ doc_dir, gapdoc.main, gapdoc.files, gapdoc.bookname, "MathJax" ];
570563

564+
# Don't try to generate PDFs if pdflatex is not available
565+
if Filename( DirectoriesSystemPrograms(), "pdflatex" ) = fail then
566+
Add(args, "nopdf" );
567+
fi;
568+
571569
# The global option "relativePath" can be set to ensure the manual
572570
# is built in such a way that all references to the GAP reference manual
573571
# are using relative file paths. This is mainly useful when building
@@ -586,7 +584,7 @@ function( arg )
586584
fi;
587585

588586
# Finally, invoke GAPDoc
589-
CallFuncList( makeDocFun, args );
587+
CallFuncList( MakeGAPDocDoc, args );
590588

591589
# NOTE: We cannot just write CopyHTMLStyleFiles(doc_dir) here, as
592590
# CopyHTMLStyleFiles its argument directly to Directory(), leading

gap/ToolFunctions.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ DeclareGlobalFunction( "AUTODOC_AbsolutePath" );
1111

1212
DeclareGlobalFunction( "AUTODOC_OutputTextFile" );
1313
DeclareGlobalFunction( "AutoDoc_WriteDocEntry" );
14-
DeclareGlobalFunction( "AutoDoc_MakeGAPDocDoc_WithoutLatex" );
1514
DeclareGlobalFunction( "AutoDoc_CreatePrintOnceFunction" );
1615

1716
DeclareGlobalFunction( "AUTODOC_Diff" );

gap/ToolFunctions.gi

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -144,85 +144,6 @@ InstallGlobalFunction( AutoDoc_WriteDocEntry,
144144
AppendTo( filestream, "</ManSection>\n\n" );
145145
end );
146146

147-
InstallGlobalFunction( AutoDoc_MakeGAPDocDoc_WithoutLatex,
148-
149-
function(arg)
150-
local htmlspecial, path, main, files, bookname, gaproot, str,
151-
r, t, l, latex, null, log, pos, h, i, j;
152-
htmlspecial := Filtered(arg, a-> a in ["MathML", "Tth", "MathJax"]);
153-
if Length(htmlspecial) > 0 then
154-
arg := Filtered(arg, a-> not a in ["MathML", "Tth", "MathJax"]);
155-
fi;
156-
path := arg[1];
157-
main := arg[2];
158-
files := arg[3];
159-
bookname := arg[4];
160-
if IsBound(arg[5]) then
161-
gaproot := arg[5];
162-
else
163-
gaproot := false;
164-
fi;
165-
# ensure that path is directory object
166-
if IsString(path) then
167-
path := Directory(path);
168-
fi;
169-
# ensure that .xml is stripped from name of main file
170-
if Length(main)>3 and main{[Length(main)-3..Length(main)]} = ".xml" then
171-
main := main{[1..Length(main)-4]};
172-
fi;
173-
# compose the XML document
174-
Info(InfoGAPDoc, 1, "#I Composing XML document . . .\n");
175-
str := ComposedDocument("GAPDoc", path,
176-
Concatenation(main, ".xml"), files, true);
177-
# parse the XML document
178-
Info(InfoGAPDoc, 1, "#I Parsing XML document . . .\n");
179-
r := ParseTreeXMLString(str[1], str[2]);
180-
# clean the result
181-
Info(InfoGAPDoc, 1, "#I Checking XML structure . . .\n");
182-
CheckAndCleanGapDocTree(r);
183-
# produce text version
184-
Info(InfoGAPDoc, 1,
185-
"#I Text version (also produces labels for hyperlinks):\n");
186-
t := GAPDoc2Text(r, path);
187-
GAPDoc2TextPrintTextFiles(t, path);
188-
# produce LaTeX version
189-
Info(InfoGAPDoc, 1, "#I Constructing LaTeX version and calling pdflatex:\n");
190-
r.bibpath := path;
191-
l := GAPDoc2LaTeX(r);
192-
Info(InfoGAPDoc, 1, "#I Writing LaTeX file, \c");
193-
Info(InfoGAPDoc, 2, Concatenation(main, ".tex"), "\n#I ");
194-
FileString(Filename(path, Concatenation(main, ".tex")), l);
195-
# print manual.six file
196-
PrintSixFile(Filename(path, "manual.six"), r, bookname);
197-
# produce html version
198-
Info(InfoGAPDoc, 1, "#I Finally the HTML version . . .\n");
199-
# if MathJax version is also produced we include links to them
200-
if "MathJax" in htmlspecial then
201-
r.LinkToMathJax := true;
202-
fi;
203-
h := GAPDoc2HTML(r, path, gaproot);
204-
GAPDoc2HTMLPrintHTMLFiles(h, path);
205-
Unbind(r.LinkToMathJax);
206-
if "Tth" in htmlspecial then
207-
Info(InfoGAPDoc, 1,
208-
"#I - also HTML version with 'tth' translated formulae . . .\n");
209-
h := GAPDoc2HTML(r, path, gaproot, "Tth");
210-
GAPDoc2HTMLPrintHTMLFiles(h, path);
211-
fi;
212-
if "MathML" in htmlspecial then
213-
Info(InfoGAPDoc, 1, "#I - also HTML + MathML version with 'ttm' . . .\n");
214-
h := GAPDoc2HTML(r, path, gaproot, "MathML");
215-
GAPDoc2HTMLPrintHTMLFiles(h, path);
216-
fi;
217-
if "MathJax" in htmlspecial then
218-
Info(InfoGAPDoc, 1, "#I - also HTML version for MathJax . . .\n");
219-
h := GAPDoc2HTML(r, path, gaproot, "MathJax");
220-
GAPDoc2HTMLPrintHTMLFiles(h, path);
221-
fi;
222-
223-
return r;
224-
end);
225-
226147
InstallGlobalFunction( AutoDoc_CreatePrintOnceFunction,
227148
function( message )
228149
local x;

0 commit comments

Comments
 (0)