Permalink
Browse files

Merge pull request #41 from woloski/patch-2

fix snippet sandboxed execution and snippet regex
  • Loading branch information...
2 parents f74d8c2 + c9740d9 commit cf723dbaa1ad603cc18ff0844752c7b9c60937a0 @creationix creationix committed Jan 7, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/wheat/data.js
View
@@ -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) {

0 comments on commit cf723db

Please sign in to comment.