Skip to content

Commit 3e01374

Browse files
mtorpeyjames-d-mitchell
authored andcommitted
Add custom css to documentation
1 parent 8b530f5 commit 3e01374

File tree

4 files changed

+39
-23
lines changed

4 files changed

+39
-23
lines changed

doc/digraphs.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* digraphs.css: Digraphs-specific styles appended to manual.css by DigraphsMakeDoc */
2+
3+
figure {
4+
text-align: center;
5+
}
6+
7+
figcaption {
8+
margin: 1em 0;
9+
}

doc/prop.xml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,14 +1318,11 @@ true
13181318
<Alt Only="HTML">
13191319
<![CDATA[
13201320
<figure>
1321-
<center>
1322-
<img height="200" src="m3.png"/>
1323-
&nbsp;&nbsp;&nbsp;&nbsp;
1324-
<img height="200" src="n5.png"/>
1325-
<figcaption><p>The lattices <e>M3</e> and <e>N5</e>.</p></figcaption>
1326-
</center>
1321+
<img height="200" src="m3.png"/>
1322+
&nbsp;&nbsp;&nbsp;&nbsp;
1323+
<img height="200" src="n5.png"/>
1324+
<figcaption>The lattices <e>M3</e> and <e>N5</e>.</figcaption>
13271325
</figure>
1328-
<br/>
13291326
]]>
13301327
</Alt>
13311328
&MUTABLE_RECOMPUTED_PROP;
@@ -1365,13 +1362,9 @@ false]]></Example>
13651362
<Alt Only="HTML">
13661363
<![CDATA[
13671364
<figure>
1368-
<center>
1369-
<img height="200" src="n5.png"/>
1370-
1371-
<figcaption><p>The lattice <e>N5</e>.</p></figcaption>
1372-
</center>
1365+
<img height="200" src="n5.png"/>
1366+
<figcaption>The lattice <e>N5</e>.</figcaption>
13731367
</figure>
1374-
<br/>
13751368
]]>
13761369
</Alt>
13771370

gap/doc.g

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ BindGlobal("DIGRAPHS_DocXMLFiles",
3131
"utils.xml",
3232
"weights.xml"]);
3333

34+
BindGlobal("DIGRAPHS_CustomCSSFile", "doc/digraphs.css");
35+
3436
BindGlobal("DIGRAPHS_MakeDoc",
3537
function(pkgdir)
36-
local PKG, temp, version, args;
38+
local PKG, temp, version, args, docdir, main_css, custom_css;
3739

3840
PKG := "Digraphs";
3941

@@ -58,6 +60,15 @@ function(pkgdir)
5860
LoadPackage("GAPDoc");
5961
SetGapDocLaTeXOptions("utf8");
6062
CallFuncList(MakeGAPDocDoc, args);
61-
CopyHTMLStyleFiles(Filename(pkgdir, "doc"));
63+
64+
# HTML styling
65+
docdir := Filename(pkgdir, "doc");
66+
CopyHTMLStyleFiles(docdir);
67+
main_css := Filename(Directory(docdir), "manual.css");
68+
custom_css := Filename(pkgdir, DIGRAPHS_CustomCSSFile);
69+
if IsReadableFile(custom_css) and IsWritableFile(main_css) then
70+
AppendTo(main_css, StringFile(custom_css));
71+
fi;
72+
6273
GAPDocManualLabFromSixFile(PKG, Filename(pkgdir, "doc/manual.six"));
6374
end);

makedoc.g

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ if not IsDirectoryPath("gap")
1212
"when reading makedoc.g\n");
1313
FORCE_QUIT_GAP(1);
1414
fi;
15-
if IsBoundGlobal("DIGRAPHS_DocXMLFiles") then
16-
MakeReadWriteGlobal("DIGRAPHS_DocXMLFiles");
17-
UnbindGlobal("DIGRAPHS_DocXMLFiles");
18-
fi;
19-
if IsBoundGlobal("DIGRAPHS_MakeDoc") then
20-
MakeReadWriteGlobal("DIGRAPHS_MakeDoc");
21-
UnbindGlobal("DIGRAPHS_MakeDoc");
22-
fi;
15+
16+
for global in ["DIGRAPHS_DocXMLFiles",
17+
"DIGRAPHS_MakeDoc",
18+
"DIGRAPHS_CustomCSSFile"] do
19+
if IsBoundGlobal(global) then
20+
MakeReadWriteGlobal(global);
21+
UnbindGlobal(global);
22+
fi;
23+
od;
24+
Unbind(global);
25+
2326
Read("gap/doc.g");
2427
DIGRAPHS_MakeDoc(DirectoryCurrent());
2528
FORCE_QUIT_GAP();

0 commit comments

Comments
 (0)