-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoc-build.oxh
119 lines (112 loc) · 5.53 KB
/
doc-build.oxh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include "oxstd.h"
enum{FEND=-1,fmname=0,fmtitle,fptr,MinLev,fnotempty,FMparts}
enum{OUTLINE,PUBLISH,KEY,PUBOPTIONS}
enum{BOOK,SLIDE,SECTION,OUTTYPES}
enum{BOOKTITLE,BOOKSUB,BOOKAUTHOR,AFFILIATION,VERSION,BOOKTAG,NBOOKPARAMS}
enum{TOC,FIG,DEF,ALG,TAB,GLOSS,CODE,INSTMAT,Fsections}
enum{kblim = 14,EXERLEV=1}
mreplace(tmplt,list);
countkbs(ss);
struct document {
static const decl partags = {"title","subtitle","author","affiliation","version","tag"};
static const decl
UD = "UDRAW", nl = "\n",
lvtag = '*', tocendtag = '#', skiptag = '%', tocsectag='!',
srctag = '@',
dfbeg = "<dfn ", dfend = "</dfn>", dfcontl = "<span>",
dfcontr = "</span>", lbr = "[", rbr = "]",
lp = "(", rp = ")", SKIP = "%",
OxScan = "%z", comstart = "<!--", comend = "-->",
exend = "X-->", codeend = "C-->", extag = "E",
keytag = "K", TitleHolder = "Q",
atag = "%author%", ttag = "%title%", tttag = "%tag%",
csstag = "%css%",
figtags = {"F","D","R","A","T","C"},
figtypes = {"Exhibit ","Definition ","Theorem ","Algorithm ","Table ","Code "},
figprefix= {"FIG","DEF","THM","ALG","TAB",""},
tocopen = "", //<DD><details class=\"toc\"><summary>Sections</summary>
tocclose = "", //</DD></details>
exopen = "<h3>Exercises</h3><UL class=\"steps\">", //<details>
exclose = "</UL>", //</details>
keyopen = "<details class=\"key\"><summary>Instructor Tip</summary>",
keyclose = "</details>",
fmlast = 4,
prefs = {"b","z","s"},
ltypes = {"i","I","A","1","a"},
csstypes = {"book","slide","section"},
scales = {"180" ,"100", "100"},
inext=".htm", tocext=".toc", outext=".html";
static decl
begun,
mathjax,
buildtype,
curx,
curp,
sect,
bkvals,
puboption,
figmarks,
exbeg,
dbend,
figtag,
exstart,
keystart,
slideclass="text", //default class for each section ("text" or "slide")
bdir = "book/", //default build folder
sdir = "source/", //default source folder
TOCFILE = "book.toc", //default table of contents file
tocf, //file pointer for toc
head0= "<!DOCTYPE html><html>\n<head><meta name=\"author\" content=\"%author%\"><link href=\'http://fonts.googleapis.com/css?family=PT+Mono|Open+Sans:400italic,700italic,400,700,800,300&subset=latin,latin-ext,greek-ext,greek\' rel=\'stylesheet\' type=\'text/css\'></link>\n<link rel=\"icon\" href=\"img/book.png\" type=\"image/png\"><link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css\"><link href=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css\" rel=\"stylesheet\"><script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js\"></script>\n",
csstemp = "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/%css%.css\">\n",
headtitle="<title>%title%</title></head><body>\n",
slidetitle="<title>%title%</title></head><body>\n",
license = "<a href=\"https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=ccsearch&atype=html\">CC BY-NC-SA 2.0</a>",
biglicense = "<a href=\"https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=ccsearch&atype=html\">CC BY-NC-SA 2.0<img height=\"30px\" src=\"https://search.creativecommons.org/static/img/cc_icon.svg\"/><img height=\"30px\" src=\"https://search.creativecommons.org/static/img/cc-by_icon.svg\"/><img height=\"30px\" src=\"https://search.creativecommons.org/static/img/cc-nc_icon.svg\"/><img height=\"30px\" src=\"https://search.creativecommons.org/static/img/cc-sa_icon.svg\"/></a>",
footer = "<footer><a rel=prev href=\"%prev%.html\"><i class=\"bi bi-arrow-left\"></i> %ppage% </a> %tttag%. © %author% %year%. %affiliation%. %license% <a href=\"%next%.html\"><i class=\"bi bi-arrow-right\"></i> %npage% </a></footer>",
endhtml = "</body></html>",
lev,contents,exsec, fign, fignicks,
fm ={{"toc","Contents",0,OUTLINE,TRUE},
{"figlist","Figures",0,PUBLISH,FALSE},
{"deflist","Definitions",0,PUBLISH,FALSE},
{"thlist","Theorems",0,PUBLISH,FALSE},
{"alglist","Algorithms",0,PUBLISH,FALSE},
{"tablist","Tables",0,PUBLISH,FALSE},
{"glossary","Glossary",0,PUBLISH,FALSE},
{"codelist","Code Files",0,PUBLISH,FALSE},
{"imanual","Instructor Material",0,KEY,FALSE}},
sclass="abcdefghijklmnop";
static lbeg(f,nlev,tclass="");
static lend(f,nlev=0);
static build(sdir="",bdir="",tocfile="",puboption=PUBLISH);
static printheader(h,title,next="");
static findmark(line);
static readtoc();
}
struct section : document{
decl index,parent,level,pref,title,dir,source,output,anch,ord,
child,uplev,myexer,notempty,ndefn,minprintlev,mxkb,myclass,mysdir;
make(inh=0);
section(index=0);
slides();
virtual entry(f);
virtual glossentry(line);
codesegment(line);
parse(line);
printslideheader(h);
static printfooter(h,title,prev,next);
printslidefooter(h);
}
struct titlepage : section {
decl title,subtitle;
titlepage();
make(inh=0);
}
struct exercises : section {
exercises(sect);
append(ord,fn);
make(inh=0);
accum(line);
entry(f);
eblock(href);
decl exdoc;
}