Skip to content

Commit b6d5ec2

Browse files
committed
Fix source-extracting scripts to ignore on ids in front of code
1 parent ad66293 commit b6d5ec2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bin/build_code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var fs = require("fs");
33
var file = process.argv[2];
44
var input = fs.readFileSync(file, "utf8");
55

6-
var included = /\/\/ include_code(.*)\n(?:\/\/.*\n)*\s*(?:\[sandbox=.*\n)?\[source,.*?\]\n----\n([\s\S]*?\n)----/g, m;
6+
var included = /\/\/ include_code(.*)\n(?:\/\/.*\n)*\s*(?:\[sandbox=.*\n|\[\[.*\n)*\[source,.*?\]\n----\n([\s\S]*?\n)----/g, m;
77
var files = Object.create(null);
88
var defaultFile = "code/chapter/" + file.replace(".txt", ".js");
99

bin/run_tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function pos(index) {
3939

4040
var sandboxes = {}, anonId = 0;
4141

42-
var re = /((?:\/\/.*\n|\s)*)(?:\[sandbox="([^"]*)"\]\n)?\[source,([^\]]+)\]\n----\n([\s\S]*?\n)----/g, m;
42+
var re = /((?:\/\/.*\n|\s)*)(?:\[sandbox="([^"]*)"\]\n|\[\[.*\n)*\[source,([^\]]+)\]\n----\n([\s\S]*?\n)----/g, m;
4343
while (m = re.exec(input)) {
4444
var snippet = m[4], hasConf = m[1].match(/\/\/ test: (.*)/);
4545
var sandbox = m[2] || "null", type = m[3], config = hasConf ? hasConf[1] : "";

0 commit comments

Comments
 (0)