-
Notifications
You must be signed in to change notification settings - Fork 115
Web Edition
For development & deployment:
- node.js
The generated web pages are static and can be hosted on any standard web servers.
The original text is stored as xml files in the xml
folder.
The html pages are generated in three steps.
-
Generate Table of Content, containing information on
chapterIndex
andchapterTitle
of different chapters/sections/subsections. -
Process all
xml
files and set upSnippet
s andReference
ssetupSnippetsHtml
function in processSnippetHtml.js file process all the<SNIPPET>
tags found in the xml files and store their respectivename
,codeStr
andrequireName
in an objectsnippetStore
for later reference.setupReferencesHtml
function in processReferenceHtml.js file found all<LABEL>
tags in the xml files. Depend on their parent being<SECTION>
,<FIGURE>
,<EXERCISE>
or<FOOTNOTE>
, their respectivereferenceName
,displayName
,href
andchapterIndex
of the chapter they belong to are stored in an objectreferenceStore
for later reference. -
Translate
xml
content tohtml
and write into the generatedhtml
files insidehtml_js
foldersee
parseXmlHtml.js
file for further details on the translation process of eachxml
tags.
Run yarn install
to install dependencies.
yarn web
The generated html pages are saved in sicpjs_html
folder.
The entire program is located at nodejs. To test any changes made to the nodejs project, cd html_js && http-server --port=8080
to view the textbook on a local server, by visiting localhost:8080
with your browser.
For future developers, start with index.js and parseXmlHtml.js. Most of the remaining functions (helper functions) can be found being references from these two files.