Skip to content

Commit

Permalink
bug abe space getattr
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslabbe committed Aug 3, 2016
1 parent 5feaf3b commit cefe01b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions dist/cli/helpers/regex-helper.js
Expand Up @@ -11,9 +11,11 @@ var _ = require('../');

function getAttr(str, attr) {
// var rex = new RegExp(attr + '=["\']([^\'"]+)')
var rex = new RegExp(attr + '=["|\']([\\S\\s]*?)["|\']( [a-zA-Z0-9-]*?=|}})');
var rex = new RegExp(attr + '=["|\']([\\S\\s]*?)["|\']( +[a-zA-Z0-9-]*?=|}})');
// var rex = new RegExp(attr + '=["|\']([\\S\\s]*?)["|\']( [a-zA-Z0-9-]*?=|}})')
var res = rex.exec(str);
return typeof res !== null && res !== null && res.length > 1 ? res[1] : '';
res = typeof res !== null && res !== null && res.length > 1 ? res[1] : '';
return res;
}

/**
Expand Down
1 change: 0 additions & 1 deletion dist/server/controllers/editor.js
Expand Up @@ -67,7 +67,6 @@ function add(obj, json, text, fakeContent, util) {
if (fakeContent) {
value = util.lorem(obj.type);
}

util.add(obj);

return value;
Expand Down
6 changes: 4 additions & 2 deletions src/cli/helpers/regex-helper.js
Expand Up @@ -2,9 +2,11 @@ import {cli} from '../'

export function getAttr (str, attr) {
// var rex = new RegExp(attr + '=["\']([^\'"]+)')
var rex = new RegExp(attr + '=["|\']([\\S\\s]*?)["|\']( [a-zA-Z0-9-]*?=|}})')
var rex = new RegExp(attr + '=["|\']([\\S\\s]*?)["|\']( +[a-zA-Z0-9-]*?=|}})')
// var rex = new RegExp(attr + '=["|\']([\\S\\s]*?)["|\']( [a-zA-Z0-9-]*?=|}})')
var res = rex.exec(str)
return (typeof res !== null && res !== null && res.length > 1) ? res[1] : ''
res = (typeof res !== null && res !== null && res.length > 1) ? res[1] : ''
return res
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/server/controllers/editor.js
Expand Up @@ -62,7 +62,6 @@ function add(obj, json, text, fakeContent, util) {
if(fakeContent) {
value = util.lorem(obj.type)
}

util.add(obj)

return value
Expand Down

0 comments on commit cefe01b

Please sign in to comment.