Skip to content
This repository

fix snippet sandboxed execution and snippet regex #41

Merged
merged 1 commit into from over 2 years ago

2 participants

Matias Woloski Tim Caswell
Matias Woloski

snippet regex work on windows \r\n (for win) \n (for *nix)
Both things were tested in both Mac and Windows

fix snippet sandboxed execution. tested in both Mac and Windows
fix snippet regex to work on windows \r\n (for win) \n (for *nix)
c9740d9
Tim Caswell creationix merged commit cf723db into from January 06, 2012
Tim Caswell creationix closed this January 06, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 06, 2012
fix snippet sandboxed execution. tested in both Mac and Windows
fix snippet regex to work on windows \r\n (for win) \n (for *nix)
c9740d9
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. 8  lib/wheat/data.js
8  lib/wheat/data.js
@@ -2,7 +2,7 @@ var Git = require('git-fs'),
2 2
     Path = require('path'),
3 3
     Step = require('step'),
4 4
     util = require(process.binding('natives').util ? 'util' : 'sys'),
5  
-    Script = process.binding('evals').Script,
  5
+    Script = require('vm'),
6 6
     QueryString = require('querystring');
7 7
 
8 8
 function preProcessMarkdown(markdown) {
@@ -23,10 +23,10 @@ function preProcessMarkdown(markdown) {
23 23
 
24 24
   // Look for snippet placeholders
25 25
   var unique = props.uniqueSnippets = {};
26  
-  props.snippets = (markdown.match(/\n<[^<>:\s]+\.[a-z]{2,4}(\*|[#].+)?>\n/g) || []).map(
  26
+  props.snippets = (markdown.match(/(\r\n|\n)<[^<>:\s]+\.[a-z]{2,4}(\*|[#].+)?>(\r\n|\n)/g) || []).map(
27 27
     function (original) {
28  
-      var path = original.substr(2, original.length - 4);
29  
-
  28
+      var path = original.slice(original.indexOf("<")+1, original.indexOf(">"));
  29
+      
30 30
       var filename = path;
31 31
       execute = path[path.length - 1] === "*";
32 32
       if (execute) {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.