Skip to content

Commit 804926d

Browse files
committed
major cleanup
1 parent 5f446f2 commit 804926d

File tree

1,714 files changed

+13762
-49251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,714 files changed

+13762
-49251
lines changed

Makefile

+25-18
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,58 @@
22
DOCS = docs
33

44
# temp folders for different editions
5-
LATEX_PDF = latex
6-
LATEX_EPUB = latex # should be a different folder
5+
LATEX_PDF = latex
6+
LATEX_EPUB = latex
77
GENERATED_HTML_JS = sicpjs_html
88
GENERATED_HTML_SPLIT = sicp_split_html
99

1010
# RESOURCES
1111
FONTS = fonts
1212
CSS = css
13-
IMAGES = images
13+
IMAGES = static
1414

15-
all: web pdf epub
15+
all: web pdf epub split
1616

1717
web:
18-
npm start web
18+
npm start web; npm start web
1919

2020
split:
21-
npm start web split
21+
npm start web split; npm start web split
2222

2323
# If you exceed the TeX memory capacity on MikTeX:
2424
# http://blog.analogmachine.org/2013/08/12/how-to-increase-miktex-2-9-memory/
2525
pdf:
26-
npm start pdf && cd $(LATEX_PDF) && latexmk -pdf -pdflatex="pdflatex --synctex=1" -f sicpjs
26+
npm start pdf; npm start pdf; \
27+
cd $(LATEX_PDF); latexmk -pdf -pdflatex="pdflatex --synctex=1" -f sicpjs
2728

2829
epub:
29-
npm start epub && cd $(LATEX_EPUB) && pandoc sicpjs.tex --listings -o sicp.epub --toc --epub-chapter-level=3 --number-sections --metadata=title:"Structure and Interpretation of Computer Programs—JavaScript Adaptation" --css ../$(CSS)/sicp.css --epub-cover-image=../$(IMAGES)/coverpage.png --epub-embed-font=../$(FONTS)/STIXGeneral-Bold-subset.woff --epub-embed-font=../$(FONTS)/STIXGeneral-Italic-subset.woff --epub-embed-font=../$(FONTS)/STIXGeneral-Regular-subset.woff --epub-embed-font=../$(FONTS)/STIXIntegralsD-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeFiveSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeFourSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeOneSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeThreeSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeTwoSym-Regular.woff --epub-embed-font=../$(FONTS)/dejamono-r-subset.woff --epub-embed-font=../$(FONTS)/dejasans-b-arrows.woff --epub-embed-font=../$(FONTS)/incons-r-subset.woff --epub-embed-font=../$(FONTS)/incons-rb-subset.woff --epub-embed-font=../$(FONTS)/incons-ri-subset.woff --epub-embed-font=../$(FONTS)/jsMath-cmex10-subset.woff --epub-embed-font=../$(FONTS)/linbio-r-subset.woff --epub-embed-font=../$(FONTS)/linbio-rb-subset.woff --epub-embed-font=../$(FONTS)/linbio-ri-subset.woff --epub-embed-font=../$(FONTS)/linlib-as-subset.woff --epub-embed-font=../$(FONTS)/linlib-r-subset.woff --epub-embed-font=../$(FONTS)/linlib-rb-subset.woff --epub-embed-font=../$(FONTS)/linlib-ri-subset.woff
30+
npm start epub; npm start epub; \
31+
cd $(LATEX_EPUB); pandoc sicpjs.tex --listings -o sicp.epub --toc --epub-chapter-level=3 --number-sections --metadata=title:"Structure and Interpretation of Computer Programs—JavaScript Adaptation" --css ../$(CSS)/sicp.css --epub-cover-image=../$(IMAGES)/coverpage.png --epub-embed-font=../$(FONTS)/STIXGeneral-Bold-subset.woff --epub-embed-font=../$(FONTS)/STIXGeneral-Italic-subset.woff --epub-embed-font=../$(FONTS)/STIXGeneral-Regular-subset.woff --epub-embed-font=../$(FONTS)/STIXIntegralsD-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeFiveSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeFourSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeOneSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeThreeSym-Regular.woff --epub-embed-font=../$(FONTS)/STIXSizeTwoSym-Regular.woff --epub-embed-font=../$(FONTS)/dejamono-r-subset.woff --epub-embed-font=../$(FONTS)/dejasans-b-arrows.woff --epub-embed-font=../$(FONTS)/incons-r-subset.woff --epub-embed-font=../$(FONTS)/incons-rb-subset.woff --epub-embed-font=../$(FONTS)/incons-ri-subset.woff --epub-embed-font=../$(FONTS)/jsMath-cmex10-subset.woff --epub-embed-font=../$(FONTS)/linbio-r-subset.woff --epub-embed-font=../$(FONTS)/linbio-rb-subset.woff --epub-embed-font=../$(FONTS)/linbio-ri-subset.woff --epub-embed-font=../$(FONTS)/linlib-as-subset.woff --epub-embed-font=../$(FONTS)/linlib-r-subset.woff --epub-embed-font=../$(FONTS)/linlib-rb-subset.woff --epub-embed-font=../$(FONTS)/linlib-ri-subset.woff
3032

3133
svg_pdf:
3234
./svg_to_pdf.sh
3335

3436
clean:
35-
rm -rf $(DOCS)/*
36-
rm -rf $(LATEXDIR)
37+
rm -r $(DOCS)/*; \
38+
rm -r $(LATEX_PDF)/*; \
39+
rm -r $(LATEX_EPUB)/*; \
40+
rm -r $(GENERATED_HTML_JS)/*; \
41+
rm -r $(GENERATED_HTML_SPLIT)/*
42+
43+
try:
44+
cd $(DOCS); http-server
3745

3846
prepare:
39-
cp latex/sicpjs.pdf latex/sicp.epub $(DOCS)
40-
cp -r $(GENERATED_HTML_JS)/* $(DOCS)
41-
cp -r $(GENERATED_HTML_SPLIT) $(DOCS)/split
47+
cp -f latex/sicpjs.pdf latex/sicp.epub $(DOCS); \
48+
cp -rf $(GENERATED_HTML_JS)/* $(DOCS); \
49+
rm -r $(DOCS)/split; cp -rf $(GENERATED_HTML_SPLIT) $(DOCS)/splitg
4250

4351
install:
44-
cd $(DOCS); scp -r * sicp@web1.comp.nus.edu.sg:public_html; echo "check the website and make sure everything works: https://sicp.comp.nus.edu.sg"
52+
cd $(DOCS); scp -p -r * sicp@web1.comp.nus.edu.sg:public_html; echo "check the website and make sure everything works: https://sicp.comp.nus.edu.sg"
4553

4654
staging:
47-
cd $(DOCS); scp -r * sicp@web1.comp.nus.edu.sg:public_html/staging; echo "check the website and make sure everything works: https://sicp.comp.nus.edu.sg"
48-
49-
cs1101s:
50-
cd $(DOCS); scp -r * cs1101s@sunfire.comp.nus.edu.sg:web1_public_html/. ; echo "now: ssh cs1101s@sunfire.comp.nus.edu.sg and: "; echo "scp -r web1_public_html/* sicp@web1.comp.nus.edu.sg:public_html"
55+
cd $(DOCS); scp -p -r * sicp@web1.comp.nus.edu.sg:public_html/staging; echo "check the website and make sure everything works: https://sicp.comp.nus.edu.sg/staging"
5156

57+
henz:
58+
cd $(DOCS); scp -p -r * henz@suna.comp.nus.edu.sg:public_html/sicp; echo "check the website and make sure everything works: https://www.comp.nus.edu.sg/~henz/sicpg"
5259

images/coverpage.png

-1000 KB
Binary file not shown.

javascript/htmlContent.js

+27-10
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,58 @@ const shortTitleDefault = `SICP — JS`;
44
const longTitleDefault = `Structure and Interpretation of Computer Programs — JavaScript Adaptation`;
55
let shortTitle = shortTitleDefault;
66
let longTitle = longTitleDefault;
7+
let this_edition = `
8+
<div class="title-text-EDITION">
9+
<span class="title-text-EDITION">Mobile-friendly Web Edition</span>
10+
</div>`;
711
let legend = `
812
<div class="title-text-ALSO">
913
<span class="title-text-ALSO">also available</span><BR/>
1014
</div>
1115
<div class="title-text-OTHEREDITIONS">
1216
<span class="title-text-OTHEREDITIONS">
13-
<a href="https://sicp.comp.nus.edu.sg/sicpjs.pdf">PDF edition</a></span>
17+
<a href="sicpjs.pdf">PDF edition</a></span>
1418
</div>
1519
<div class="title-text-OTHEREDITIONS">
1620
<span class="title-text-OTHEREDITIONS">
17-
<a href="https://sicp.comp.nus.edu.sg/sicp.epub">E-book edition</a></span>
21+
<a href="sicp.epub">E-book edition</a></span>
22+
<div class="title-text-OTHEREDITIONS">
23+
<span class="title-text-OTHEREDITIONS">
24+
<a href="split">Comparison edition</a></span>
1825
</div>`;
1926

2027
export const switchTitle = (version) => {
2128
if (version == "js") {
2229
shortTitle = shortTitleDefault;
2330
longTitle = longTitleDefault;
31+
this_edition = `
32+
<div class="title-text-EDITION">
33+
<span class="title-text-EDITION">Mobile-friendly Web Edition</span>
34+
</div>`;
2435
legend = `
2536
<div class="title-text-ALSO">
2637
<span class="title-text-ALSO">also available</span><BR/>
2738
</div>
2839
<div class="title-text-OTHEREDITIONS">
2940
<span class="title-text-OTHEREDITIONS">
30-
<a href="https://sicp.comp.nus.edu.sg/sicpjs.pdf">PDF edition</a></span>
41+
<a href="sicpjs.pdf">PDF edition</a></span>
3142
</div>
3243
<div class="title-text-OTHEREDITIONS">
3344
<span class="title-text-OTHEREDITIONS">
34-
<a href="https://sicp.comp.nus.edu.sg/sicp.epub">E-book edition</a></span>
45+
<a href="sicp.epub">E-book edition</a></span>
46+
</div>
47+
<div class="title-text-OTHEREDITIONS">
48+
<span class="title-text-OTHEREDITIONS">
49+
<a href="split">Comparison edition</a></span>
3550
</div>`;
3651

3752
} else if (version == "split") {
3853
shortTitle = `SICP &mdash; Scheme/JS`;
39-
longTitle = `Structure and Interpretation of Computer Programs &mdash; Orginal / JavaScript Adaptation Comparison`;
54+
longTitle = `Structure and Interpretation of Computer Programs &mdash; Comparison Edition`;
55+
this_edition = `
56+
<div class="title-text-EDITION">
57+
<span class="title-text-EDITION">Comparison Edition</span>
58+
</div>`;
4059
legend = `
4160
<div class="title-text-ALSO">
4261
<span class="title-text-ALSO">Differences highlighted in</span><BR/>
@@ -182,7 +201,7 @@ export const html_links_part2 = (writeTo, toIndexFolder) => {
182201
183202
<div class="container scroll">
184203
185-
`);}
204+
`);}
186205

187206

188207
export const indexPage = (writeTo) => {
@@ -193,9 +212,7 @@ export const indexPage = (writeTo) => {
193212
height="auto" width="100%">
194213
</TD>
195214
<TD class="tight" width="30%" valign="top" align="left">
196-
<div class="title-text-EDITION">
197-
<span class="title-text-EDITION">Mobile-friendly Web Edition</span>
198-
</div>
215+
${this_edition}
199216
<span style="vertical-align:-77%"/>
200217
<BR/>
201218
${legend}
@@ -223,4 +240,4 @@ export const beforeContentWrapper = `<div id='permalink-msg'>
223240
</div>
224241
</div>
225242
<div class='chapter-content'>
226-
`
243+
`
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

javascript/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const createMain = () => {
215215
if (!fs.existsSync(path.join(outputDir, "/chapters"))) {
216216
fs.mkdirSync(path.join(outputDir, "/chapters"));
217217
}
218-
fse.copy(path.join(__dirname, "/html_assets"),
218+
fse.copy(path.join(__dirname, "/../static"),
219219
outputDir,
220220
err => {
221221
if (err) return console.error(err)

javascript/latexContent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const preamble = `\\documentclass[a4paper, 12pt]{report}
7070
}
7171
7272
\\usepackage{graphicx}
73-
\\graphicspath{ {../rails/public/chapters/} }
73+
\\graphicspath{ {../static/} }
7474
7575
\\usepackage[answerdelayed]{exercise}
7676
\\newcounter{ExerciseDisplayNumber}[chapter]

javascript/parseXmlHtml.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,7 @@ const afterContent = (writeTo) => {
644644

645645
if (chapArrIndex > 0) {
646646
writeTo.push(`
647-
<button type='button' class='btn btn-secondary' style='background-color: #fff;'>
648-
<a href='./${tableOfContent[allFilepath[chapArrIndex-1]].index}.html'>&lt; Previous</a>
649-
</button>
647+
<a class='btn btn-secondary btn-nav' href='./${tableOfContent[allFilepath[chapArrIndex-1]].index}.html'>&lt; Previous</a>
650648
`);
651649
}
652650
writeTo.push(`
@@ -655,9 +653,7 @@ const afterContent = (writeTo) => {
655653

656654
if (chapArrIndex < allFilepath.length - 1) {
657655
writeTo.push(`
658-
<button type='button' class='btn btn-secondary' style='background-color: #fff;'>
659-
<a class='scroll-next' id='${chapArrIndex+2}' href='./${tableOfContent[allFilepath[chapArrIndex+1]].index}.html'>Next &gt;</a>
660-
</button>
656+
<a class='btn btn-secondary btn-nav' id='${chapArrIndex+2}' href='./${tableOfContent[allFilepath[chapArrIndex+1]].index}.html'>Next &gt;</a>
661657
`);
662658
}
663659
writeTo.push(`</div>

nodejs/index.js

-139
This file was deleted.

0 commit comments

Comments
 (0)