Skip to content

Commit

Permalink
Move per-chapter extracted code to code/chapter. Put code symlink in …
Browse files Browse the repository at this point in the history
…html root
  • Loading branch information
marijnh committed Jun 16, 2014
1 parent 23f46e9 commit 2164e27
Show file tree
Hide file tree
Showing 23 changed files with 22 additions and 36 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/tex/*
/html/*.html
/html/js/0*.js
/html/js/1*.js
/code/chapter/*
/node_modules
.tern-port
toc.txt
img/cover.xcf
2 changes: 1 addition & 1 deletion 00_intro.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:next_link: 01_values
:load_files: ["js/00_intro.js"]
:load_files: ["code/chapter/00_intro.js"]

= Introduction =

Expand Down
2 changes: 1 addition & 1 deletion 04_data.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 4
:prev_link: 03_functions
:next_link: 05_higher_order
:load_files: ["js/code/jacques_journal.js", "js/04_data.js"]
:load_files: ["code/jacques_journal.js", "code/chapter/04_data.js"]

= Data Structures: Objects and Arrays =

Expand Down
2 changes: 1 addition & 1 deletion 05_higher_order.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 5
:prev_link: 04_data
:next_link: 06_object
:load_files: ["js/code/ancestry.js", "js/00_intro.js", "js/05_higher_order.js"]
:load_files: ["code/ancestry.js", "code/chapter/00_intro.js", "code/chapter/05_higher_order.js"]

= Higher-Order Functions =

Expand Down
2 changes: 1 addition & 1 deletion 06_object.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 6
:prev_link: 05_higher_order
:next_link: 07_elife
:load_files: ["js/code/mountains.js", "js/06_object.js"]
:load_files: ["code/mountains.js", "code/chapter/06_object.js"]

= The Secret Life of Objects =

Expand Down
2 changes: 1 addition & 1 deletion 07_elife.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 7
:prev_link: 06_object
:next_link: 08_error
:load_files: ["js/07_elife.js", "js/animateworld.js"]
:load_files: ["code/chapter/07_elife.js", "js/animateworld.js"]

= Project: Electronic Life =

Expand Down
2 changes: 1 addition & 1 deletion 08_error.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 8
:prev_link: 07_elife
:next_link: 09_regexp
:load_files: ["js/08_error.js"]
:load_files: ["code/chapter/08_error.js"]

= Bugs and Error Handling =

Expand Down
2 changes: 1 addition & 1 deletion 10_modules.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 10
:prev_link: 09_regexp
:next_link: 11_language
:load_files: ["js/10_modules.js", "js/loadfile.js"]
:load_files: ["code/chapter/10_modules.js", "js/loadfile.js"]

= Modules =

Expand Down
2 changes: 1 addition & 1 deletion 11_language.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 11
:prev_link: 10_modules
:next_link: 12_browser
:load_files: ["js/11_language.js"]
:load_files: ["code/chapter/11_language.js"]

= Project: A Programming Language =

Expand Down
4 changes: 2 additions & 2 deletions 12_browser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ the JavaScript program) to be fetched from a URL.
[source,text/html]
----
<h1>Testing alert</h1>
<script src="js/hello.js"></script>
<script src="code/hello.js"></script>
----

The _js/hello.js_ file included here contains the same simple program,
The _code/hello.js_ file included here contains the same simple program,
`alert("hello!")`. When an HTML page references other URLs as part of
itself, for example an image file or a script, web browsers will
retrieve those immediately, and include them in the page.
Expand Down
2 changes: 1 addition & 1 deletion 13_dom.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 13
:prev_link: 12_browser
:next_link: 14_event
:load_files: ["js/code/mountains.js", "js/13_dom.js"]
:load_files: ["code/mountains.js", "code/chapter/13_dom.js"]

= The Document Object Model =

Expand Down
4 changes: 2 additions & 2 deletions 14_event.txt
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ isolated JavaScript environment, which runs alongside the main program
for a document, and can only communicate with it by sending and
receiving messages.

Assume we have this code in `js/squareworker.js`, which is a program
Assume we have this code in `code/squareworker.js`, which is a program
that computes squares, which we will run inside of an isolated worker
process.

Expand All @@ -669,7 +669,7 @@ worker, sends it a few messages, and outputs the responses.

[source,javascript]
----
var squareWorker = new Worker("js/squareworker.js");
var squareWorker = new Worker("code/squareworker.js");
squareWorker.addEventListener("message", function(event) {
console.log("The worker responded:", event.data);
});
Expand Down
2 changes: 1 addition & 1 deletion 15_game.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 15
:prev_link: 14_event
:next_link: 16_canvas
:load_files: ["js/15_game.js", "js/code/game_levels.js"]
:load_files: ["code/chapter/15_game.js", "code/game_levels.js"]

= Project: A Platform Game =

Expand Down
2 changes: 1 addition & 1 deletion 16_canvas.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 16
:prev_link: 15_game
:next_link: 17_http
:load_files: ["js/15_game.js", "js/code/game_levels.js", "js/16_canvas.js"]
:load_files: ["code/chapter/15_game.js", "code/game_levels.js", "code/chapter/16_canvas.js"]

= Drawing on Canvas =

Expand Down
2 changes: 1 addition & 1 deletion 17_http.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 17
:prev_link: 16_canvas
:next_link: 18_forms
:load_files: ["js/17_http.js", "js/promise.js"]
:load_files: ["code/chapter/17_http.js", "js/promise.js"]

= HTTP =

Expand Down
2 changes: 1 addition & 1 deletion 19_paint.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:chap_num: 19
:prev_link: 18_forms
:next_link: 20_FIXME
:load_files: ["js/19_paint.js"]
:load_files: ["code/chapter/19_paint.js"]

= Project: A Paint Program =

Expand Down
2 changes: 1 addition & 1 deletion bin/build_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ while (m = included.exec(input)) {
}

if (code.length) {
var out = "html/js/" + file.replace(".txt", ".js");
var out = "code/chapter/" + file.replace(".txt", ".js");
fs.writeFileSync(out, code.join("\n"), "utf8");
}
Empty file added code/chapter/.keep
Empty file.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions html/code
15 changes: 0 additions & 15 deletions html/js/00_intro.js

This file was deleted.

1 change: 0 additions & 1 deletion html/js/code

This file was deleted.

0 comments on commit 2164e27

Please sign in to comment.