Fix for subgraphs

This commit is contained in:
knsv
2015-03-22 18:36:17 +01:00
parent 0ed5a01756
commit c966aad496
7 changed files with 18 additions and 7 deletions

View File

@@ -223,6 +223,9 @@ exports.addSubGraph = function (list, title) {
return a.filter(function(item) {
var type = typeof item;
if(item===' '){
return false;
}
if(type in prims)
return prims[type].hasOwnProperty(item) ? false : (prims[type][item] = true);
else
@@ -233,7 +236,6 @@ exports.addSubGraph = function (list, title) {
var subG = [];
subG = uniq(subG.concat.apply(subG,list));
//console.log(subG);
subGraphs.push({nodes:subG,title:title});
};

View File

@@ -348,7 +348,7 @@ describe('when parsing ',function(){
});
it('should handle subgraphs',function(){
var res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\nc-->d\nend\n');
var res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\n\n c-->d \nend\n');
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();