diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-12 20:43:55 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-12 20:43:55 -0800 |
commit | 92ace5f0d4ddf3f5f1d612bb0e5f0f3ade4b5adf (patch) | |
tree | 6763a21daca1dce97aeef1c88a2a1684e7253bd3 /tools | |
parent | fed6a57f30ecdbcf4805b1900dd0f164856c1163 (diff) |
Moved spec2js.js to tools/.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/spec2js.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/spec2js.js b/tools/spec2js.js new file mode 100755 index 0000000..6bf366f --- /dev/null +++ b/tools/spec2js.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node + +var fs = require('fs'); +var util = require('util'); + +fs.readFile('spec.txt', 'utf8', function(err, data) { + if (err) { + return console.log(err); + } + var examples = []; + data.replace(/^\.\n([\s\S]*?)^\.\n([\s\S]*?)^\.$/gm, + function(_,x,y){ + examples.push({markdown: x, html: y}); + }); + console.log(util.inspect(examples, { depth: null })); + console.warn(examples.length + ' examples'); +}); |