Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix snippet sandboxed execution. tested in both Mac and Windows

fix snippet regex to work on windows \r\n (for win) \n (for *nix)
  • Loading branch information...
commit c9740d92ede8d4fc2fbe26a37f7e5b202e483a8c 1 parent f74d8c2
woloski authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/wheat/data.js
View
8 lib/wheat/data.js
@@ -2,7 +2,7 @@ var Git = require('git-fs'),
Path = require('path'),
Step = require('step'),
util = require(process.binding('natives').util ? 'util' : 'sys'),
- Script = process.binding('evals').Script,
+ Script = require('vm'),
QueryString = require('querystring');
function preProcessMarkdown(markdown) {
@@ -23,10 +23,10 @@ function preProcessMarkdown(markdown) {
// Look for snippet placeholders
var unique = props.uniqueSnippets = {};
- props.snippets = (markdown.match(/\n<[^<>:\s]+\.[a-z]{2,4}(\*|[#].+)?>\n/g) || []).map(
+ props.snippets = (markdown.match(/(\r\n|\n)<[^<>:\s]+\.[a-z]{2,4}(\*|[#].+)?>(\r\n|\n)/g) || []).map(
function (original) {
- var path = original.substr(2, original.length - 4);
-
+ var path = original.slice(original.indexOf("<")+1, original.indexOf(">"));
+
var filename = path;
execute = path[path.length - 1] === "*";
if (execute) {
Please sign in to comment.
Something went wrong with that request. Please try again.