Fix for br tags within nodes for new line

This commit is contained in:
knsv 2014-11-25 22:58:57 +01:00
parent 2317ea5117
commit 9c31ac8aa6
11 changed files with 934 additions and 179 deletions

454
dist/mermaid.full.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

454
dist/mermaid.slim.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,7 @@
"gulp-jison": "~1.0.0",
"gulp-rename": "~1.2.0",
"gulp-uglify": "~1.0.1",
"he": "^0.5.0",
"jasmine": "~2.0.1",
"jison": "~0.4.15",
"karma": "~0.12.20",

View File

@ -2,6 +2,8 @@ var graph = require('./graphDb');
var flow = require('./parser/flow');
var utils = require('./utils');
var seq = require('./sequenceRenderer');
var he = require('he');
/**
* Function that adds the vertices found in the graph definition to the graph to be rendered.
* @param vert Object containing the vertices.
@ -57,6 +59,7 @@ var addVertices = function (vert, g) {
// Create the node in the graph based on defined form
if (vertice.type === 'round') {
console.log(verticeText);
g.setNode(vertice.id, {labelType: "html",label: verticeText, rx: 5, ry: 5, style: style, id:vertice.id});
} else {
if (vertice.type === 'diamond') {
@ -226,18 +229,21 @@ var init = function () {
id = 'mermaidChart' + cnt;
cnt++;
var chartText = element.textContent.trim();
var txt = element.innerHTML;
txt = txt.replace(/>/g,'>');
txt = txt.replace(/</g,'&lt;');
txt = he.decode(txt).trim();
element.innerHTML = '<svg id="' + id + '" width="100%">' +
'<g />' +
'</svg>';
if(utils.detectType(chartText) === 'graph'){
draw(chartText, id);
if(utils.detectType(txt) === 'graph'){
draw(txt, id);
graph.bindFunctions();
}
else{
seq.draw(chartText,id);
seq.draw(txt,id);
}
}
@ -253,7 +259,7 @@ exports.version = function(){
}
var equals = function (val, variable){
if(typeof variable !== 'undefined'){
if(typeof variable === 'undefined'){
return false;
}
else{

View File

@ -40,6 +40,7 @@
"]" return 'SQE';
"{" return 'DIAMOND_START'
"}" return 'DIAMOND_STOP'
"\"" return 'QUOTE';
\s return 'SPACE';
\n return 'NEWLINE';
@ -97,6 +98,10 @@ vertex: alphaNum SQS text SQE
{$$ = $1;yy.addVertex($1,$3,'round');}
| alphaNum DIAMOND_START text DIAMOND_STOP
{$$ = $1;yy.addVertex($1,$3,'diamond');}
| alphaNum TAGEND text SQE
{$$ = $1;yy.addVertex($1,$3,'odd');}
| alphaNum TAGSTART text TAGEND
{$$ = $1;yy.addVertex($1,$3,'diamond');}
| alphaNum
{$$ = $1;yy.addVertex($1);}
;
@ -132,10 +137,7 @@ alphaNumToken
{$$ = $1;}
| DOT
{$$ = $1;}
| TAGSTART
{$$ = $1;}
| TAGEND
{$$ = $1;}
| BRKT
{$$ = '<br>';}
;
@ -161,16 +163,6 @@ arrowText:
{$$ = $2;}
;
// Characters and spaces
//text: alphaNum SPACE text
// {$$ = $1 + ' ' +$3;}
// | alphaNum spaceList MINUS spaceList text
// {$$ = $1 + ' - ' +$5;}
// | alphaNum spaceList TAGSTART DIR TAGEND spaceList text
// {$$ = $1 + ' - ' +$5;}
// | alphaNum
// {$$ = $1;}
// ;
text: textToken
{$$=$1;}
| text textToken
@ -208,6 +200,35 @@ textToken: ALPHA
| MINUS
{$$ = $1;}
;
textNoTags: textNoTagsToken
{$$=$1;}
| textNoTags textNoTagsToken
{$$=$1+''+$2;}
;
textNoTagsToken: ALPHA
{$$=$1;}
| NUM
{$$=$1;}
| COLON
{$$ = $1;}
| COMMA
{$$ = $1;}
| PLUS
{$$ = $1;}
| EQUALS
{$$ = $1;}
| MULT
{$$ = $1;}
| DOT
{$$ = $1;}
| BRKT
{$$ = '<br>';}
| SPACE
{$$ = $1;}
| MINUS
{$$ = $1;}
;
classDefStatement:CLASSDEF SPACE alphaNum SPACE stylesOpt
{$$ = $1;yy.addClass($3,$5);}

View File

@ -72,12 +72,12 @@
}
*/
var parser = (function(){
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[1,21],$V2=[1,22],$V3=[1,23],$V4=[1,24],$V5=[1,25],$V6=[1,26],$V7=[1,27],$V8=[1,28],$V9=[1,29],$Va=[1,30],$Vb=[1,31],$Vc=[1,15],$Vd=[1,16],$Ve=[1,17],$Vf=[1,14],$Vg=[31,32,33,34,35,36,37,38,39,40,41,51,53,54,55],$Vh=[11,44,45,46,47],$Vi=[9,11,21,24,26,44,45,46,47],$Vj=[9,11,21,24,26,31,32,33,34,35,36,37,38,39,40,41,44,45,46,47],$Vk=[9,11,21,24,26,30,31,32,33,34,35,36,37,38,39,40,41,44,45,46,47],$Vl=[6,9],$Vm=[31,32,33,34,35,36,37,38,39,40,41],$Vn=[31,32,33,34,35,36,37,38,39,40,41,48],$Vo=[1,81],$Vp=[1,82],$Vq=[1,70],$Vr=[1,71],$Vs=[1,72],$Vt=[1,73],$Vu=[1,74],$Vv=[1,75],$Vw=[1,76],$Vx=[1,77],$Vy=[1,78],$Vz=[1,79],$VA=[1,80],$VB=[9,23,25,27,30,31,32,33,34,35,36,37,38,39,40,41,48],$VC=[1,106],$VD=[1,103],$VE=[1,101],$VF=[1,104],$VG=[1,102],$VH=[1,109],$VI=[1,108],$VJ=[1,107],$VK=[1,105],$VL=[1,114],$VM=[11,34],$VN=[9,11,30,31,32,33,34,38,41,56,59];
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[1,21],$V2=[1,22],$V3=[1,23],$V4=[1,24],$V5=[1,25],$V6=[1,26],$V7=[1,27],$V8=[1,28],$V9=[1,29],$Va=[1,15],$Vb=[1,16],$Vc=[1,17],$Vd=[1,14],$Ve=[33,34,35,36,37,38,39,40,41,53,55,56,57],$Vf=[11,44,45,46,47],$Vg=[9,11,21,24,26,28,29,44,45,46,47],$Vh=[9,11,21,24,26,28,29,33,34,35,36,37,38,39,40,41,44,45,46,47],$Vi=[9,11,21,24,26,28,29,32,33,34,35,36,37,38,39,40,41,44,45,46,47],$Vj=[6,9],$Vk=[33,34,35,36,37,38,39,40,41],$Vl=[33,34,35,36,37,38,39,40,41,48],$Vm=[1,81],$Vn=[1,79],$Vo=[1,78],$Vp=[1,82],$Vq=[1,70],$Vr=[1,71],$Vs=[1,72],$Vt=[1,73],$Vu=[1,74],$Vv=[1,75],$Vw=[1,76],$Vx=[1,77],$Vy=[1,80],$Vz=[9,23,25,27,28,29,32,33,34,35,36,37,38,39,40,41,48],$VA=[2,54],$VB=[1,110],$VC=[1,107],$VD=[1,105],$VE=[1,108],$VF=[1,106],$VG=[1,113],$VH=[1,112],$VI=[1,111],$VJ=[1,109],$VK=[2,19],$VL=[1,118],$VM=[11,36],$VN=[9,11,32,33,34,35,36,40,41,58,61];
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"classDefStatement":15,"classStatement":16,"clickStatement":17,"vertex":18,"link":19,"alphaNum":20,"SQS":21,"text":22,"SQE":23,"PS":24,"PE":25,"DIAMOND_START":26,"DIAMOND_STOP":27,"alphaNumStatement":28,"alphaNumToken":29,"MINUS":30,"ALPHA":31,"NUM":32,"COLON":33,"COMMA":34,"PLUS":35,"EQUALS":36,"MULT":37,"DOT":38,"TAGSTART":39,"TAGEND":40,"BRKT":41,"linkStatement":42,"arrowText":43,"ARROW_POINT":44,"ARROW_CIRCLE":45,"ARROW_CROSS":46,"ARROW_OPEN":47,"PIPE":48,"textToken":49,"textStatement":50,"CLASSDEF":51,"stylesOpt":52,"CLASS":53,"CLICK":54,"STYLE":55,"HEX":56,"style":57,"styleComponent":58,"UNIT":59,"$accept":0,"$end":1},
terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",21:"SQS",23:"SQE",24:"PS",25:"PE",26:"DIAMOND_START",27:"DIAMOND_STOP",30:"MINUS",31:"ALPHA",32:"NUM",33:"COLON",34:"COMMA",35:"PLUS",36:"EQUALS",37:"MULT",38:"DOT",39:"TAGSTART",40:"TAGEND",41:"BRKT",44:"ARROW_POINT",45:"ARROW_CIRCLE",46:"ARROW_CROSS",47:"ARROW_OPEN",48:"PIPE",51:"CLASSDEF",53:"CLASS",54:"CLICK",55:"STYLE",56:"HEX",59:"UNIT"},
productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[12,2],[12,2],[12,2],[13,3],[13,1],[18,4],[18,4],[18,4],[18,1],[20,1],[20,2],[28,1],[28,3],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[19,2],[19,1],[42,1],[42,1],[42,1],[42,1],[43,3],[22,1],[22,2],[50,1],[50,2],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[15,5],[16,5],[17,5],[14,5],[14,5],[52,1],[52,3],[57,1],[57,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1]],
symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"classDefStatement":15,"classStatement":16,"clickStatement":17,"vertex":18,"link":19,"alphaNum":20,"SQS":21,"text":22,"SQE":23,"PS":24,"PE":25,"DIAMOND_START":26,"DIAMOND_STOP":27,"TAGEND":28,"TAGSTART":29,"alphaNumStatement":30,"alphaNumToken":31,"MINUS":32,"ALPHA":33,"NUM":34,"COLON":35,"COMMA":36,"PLUS":37,"EQUALS":38,"MULT":39,"DOT":40,"BRKT":41,"linkStatement":42,"arrowText":43,"ARROW_POINT":44,"ARROW_CIRCLE":45,"ARROW_CROSS":46,"ARROW_OPEN":47,"PIPE":48,"textToken":49,"textStatement":50,"textNoTags":51,"textNoTagsToken":52,"CLASSDEF":53,"stylesOpt":54,"CLASS":55,"CLICK":56,"STYLE":57,"HEX":58,"style":59,"styleComponent":60,"UNIT":61,"$accept":0,"$end":1},
terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",21:"SQS",23:"SQE",24:"PS",25:"PE",26:"DIAMOND_START",27:"DIAMOND_STOP",28:"TAGEND",29:"TAGSTART",32:"MINUS",33:"ALPHA",34:"NUM",35:"COLON",36:"COMMA",37:"PLUS",38:"EQUALS",39:"MULT",40:"DOT",41:"BRKT",44:"ARROW_POINT",45:"ARROW_CIRCLE",46:"ARROW_CROSS",47:"ARROW_OPEN",48:"PIPE",53:"CLASSDEF",55:"CLASS",56:"CLICK",57:"STYLE",58:"HEX",61:"UNIT"},
productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[12,2],[12,2],[12,2],[13,3],[13,1],[18,4],[18,4],[18,4],[18,4],[18,4],[18,1],[20,1],[20,2],[30,1],[30,3],[31,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,1],[19,2],[19,1],[42,1],[42,1],[42,1],[42,1],[43,3],[22,1],[22,2],[50,1],[50,2],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[51,1],[51,2],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[15,5],[16,5],[17,5],[14,5],[14,5],[54,1],[54,3],[59,1],[59,2],[60,1],[60,1],[60,1],[60,1],[60,1],[60,1],[60,1],[60,1],[60,1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
/* this == yyval */
@ -101,25 +101,28 @@ break;
case 16:
this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round');
break;
case 17:
case 17: case 19:
this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond');
break;
case 18:
this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd');
break;
case 20:
this.$ = $$[$0];yy.addVertex($$[$0]);
break;
case 19: case 21: case 23: case 24: case 41: case 45: case 46: case 65:
case 21: case 23: case 25: case 26: case 41: case 45: case 46: case 58: case 60: case 61: case 78:
this.$=$$[$0];
break;
case 20: case 42:
case 22: case 42: case 59:
this.$=$$[$0-1]+''+$$[$0];
break;
case 22:
case 24:
this.$=$$[$0-2]+'-'+$$[$0];
break;
case 25: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 35: case 47: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 56: case 57:
case 27: case 28: case 29: case 30: case 31: case 32: case 35: case 47: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 56: case 57: case 62: case 63: case 64: case 65: case 66: case 67: case 69: case 70:
this.$ = $$[$0];
break;
case 33: case 55:
case 33: case 55: case 68:
this.$ = '<br>';
break;
case 34:
@ -140,37 +143,37 @@ break;
case 40:
this.$ = $$[$0-1];
break;
case 58:
case 71:
this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]);
break;
case 59:
case 72:
this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]);
break;
case 60:
case 73:
this.$ = $$[$0-4];yy.setClickEvent($$[$0-2], $$[$0]);
break;
case 61:
case 74:
this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]);
break;
case 62:
case 75:
this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]);
break;
case 63:
case 76:
this.$ = [$$[$0]]
break;
case 64:
case 77:
$$[$0-2].push($$[$0]);this.$ = $$[$0-2];
break;
case 66:
case 79:
this.$ = $$[$0-1] + $$[$0];
break;
case 67: case 68: case 69: case 70: case 71: case 72: case 73: case 74: case 75:
case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88:
this.$=$$[$0]
break;
}
},
table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,12:6,13:8,14:9,15:10,16:11,17:12,18:13,20:18,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,51:$Vc,53:$Vd,54:$Ve,55:$Vf},{9:[1,32]},{6:[1,33]},{5:34,12:6,13:8,14:9,15:10,16:11,17:12,18:13,20:18,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,51:$Vc,53:$Vd,54:$Ve,55:$Vf},{6:[2,5],7:35,9:$V0},o($Vg,[2,7],{7:36,9:$V0}),{11:[1,37]},{11:[1,38]},{11:[1,39]},{11:[1,40]},{11:[1,41]},{11:[2,14],19:42,42:43,44:[1,44],45:[1,45],46:[1,46],47:[1,47]},{9:[1,48]},{9:[1,49]},{9:[1,50]},{9:[1,51]},o($Vh,[2,18],{21:[1,52],24:[1,53],26:[1,54]}),o($Vi,[2,19],{28:19,29:20,20:55,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb}),o($Vj,[2,21],{30:[1,56]}),o($Vk,[2,23]),o($Vk,[2,24]),o($Vk,[2,25]),o($Vk,[2,26]),o($Vk,[2,27]),o($Vk,[2,28]),o($Vk,[2,29]),o($Vk,[2,30]),o($Vk,[2,31]),o($Vk,[2,32]),o($Vk,[2,33]),{10:[1,57]},{1:[2,1]},{6:[1,58]},{5:59,12:6,13:8,14:9,15:10,16:11,17:12,18:13,20:18,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,51:$Vc,53:$Vd,54:$Ve,55:$Vf},o($Vg,[2,6]),o($Vl,[2,8]),o($Vl,[2,9]),o($Vl,[2,10]),o($Vl,[2,11]),o($Vl,[2,12]),{18:60,20:18,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb},o($Vm,[2,35],{43:61,48:[1,62]}),o($Vn,[2,36]),o($Vn,[2,37]),o($Vn,[2,38]),o($Vn,[2,39]),{20:63,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,56:[1,64]},{20:65,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb},{20:66,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb},{20:67,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb},{9:$Vo,22:68,30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,49:69},{9:$Vo,22:83,30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,49:69},{9:$Vo,22:84,30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,49:69},o($Vi,[2,20]),{29:85,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb},{11:[1,86]},{1:[2,2]},{6:[2,4]},{11:[2,13]},o($Vm,[2,34]),{9:$Vo,22:87,30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,49:69},{9:[1,88]},{9:[1,89]},{9:[1,90]},{9:[1,91]},{9:[1,92]},{9:$Vo,23:[1,93],30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,49:94},o($VB,[2,41]),o($VB,[2,45]),o($VB,[2,46]),o($VB,[2,47]),o($VB,[2,48]),o($VB,[2,49]),o($VB,[2,50]),o($VB,[2,51]),o($VB,[2,52]),o($VB,[2,53]),o($VB,[2,54]),o($VB,[2,55]),o($VB,[2,56]),o($VB,[2,57]),{9:$Vo,25:[1,95],30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,49:94},{9:$Vo,27:[1,96],30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,49:94},o($Vj,[2,22]),o([9,31,32,33,34,35,36,37,38,39,40,41,51,53,54,55],[2,3]),{9:$Vo,30:$Vp,31:$Vq,32:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,48:[1,97],49:94},{9:$VC,30:$VD,31:$VE,32:$VF,33:$VG,38:$VH,41:$VI,52:98,56:$VJ,57:99,58:100,59:$VK},{9:$VC,30:$VD,31:$VE,32:$VF,33:$VG,38:$VH,41:$VI,52:110,56:$VJ,57:99,58:100,59:$VK},{9:$VC,30:$VD,31:$VE,32:$VF,33:$VG,38:$VH,41:$VI,52:111,56:$VJ,57:99,58:100,59:$VK},{20:112,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb},{20:113,28:19,29:20,31:$V1,32:$V2,33:$V3,34:$V4,35:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb},o($Vh,[2,15]),o($VB,[2,42]),o($Vh,[2,16]),o($Vh,[2,17]),o($Vm,[2,40]),{11:[2,61],34:$VL},o($VM,[2,63],{58:115,9:$VC,30:$VD,31:$VE,32:$VF,33:$VG,38:$VH,41:$VI,56:$VJ,59:$VK}),o($VN,[2,65]),o($VN,[2,67]),o($VN,[2,68]),o($VN,[2,69]),o($VN,[2,70]),o($VN,[2,71]),o($VN,[2,72]),o($VN,[2,73]),o($VN,[2,74]),o($VN,[2,75]),{11:[2,62],34:$VL},{11:[2,58],34:$VL},{11:[2,59]},{11:[2,60]},{9:$VC,30:$VD,31:$VE,32:$VF,33:$VG,38:$VH,41:$VI,56:$VJ,57:116,58:100,59:$VK},o($VN,[2,66]),o($VM,[2,64],{58:115,9:$VC,30:$VD,31:$VE,32:$VF,33:$VG,38:$VH,41:$VI,56:$VJ,59:$VK})],
defaultActions: {33:[2,1],58:[2,2],59:[2,4],60:[2,13],112:[2,59],113:[2,60]},
table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,12:6,13:8,14:9,15:10,16:11,17:12,18:13,20:18,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9,53:$Va,55:$Vb,56:$Vc,57:$Vd},{9:[1,30]},{6:[1,31]},{5:32,12:6,13:8,14:9,15:10,16:11,17:12,18:13,20:18,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9,53:$Va,55:$Vb,56:$Vc,57:$Vd},{6:[2,5],7:33,9:$V0},o($Ve,[2,7],{7:34,9:$V0}),{11:[1,35]},{11:[1,36]},{11:[1,37]},{11:[1,38]},{11:[1,39]},{11:[2,14],19:40,42:41,44:[1,42],45:[1,43],46:[1,44],47:[1,45]},{9:[1,46]},{9:[1,47]},{9:[1,48]},{9:[1,49]},o($Vf,[2,20],{21:[1,50],24:[1,51],26:[1,52],28:[1,53],29:[1,54]}),o($Vg,[2,21],{30:19,31:20,20:55,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9}),o($Vh,[2,23],{32:[1,56]}),o($Vi,[2,25]),o($Vi,[2,26]),o($Vi,[2,27]),o($Vi,[2,28]),o($Vi,[2,29]),o($Vi,[2,30]),o($Vi,[2,31]),o($Vi,[2,32]),o($Vi,[2,33]),{10:[1,57]},{1:[2,1]},{6:[1,58]},{5:59,12:6,13:8,14:9,15:10,16:11,17:12,18:13,20:18,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9,53:$Va,55:$Vb,56:$Vc,57:$Vd},o($Ve,[2,6]),o($Vj,[2,8]),o($Vj,[2,9]),o($Vj,[2,10]),o($Vj,[2,11]),o($Vj,[2,12]),{18:60,20:18,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9},o($Vk,[2,35],{43:61,48:[1,62]}),o($Vl,[2,36]),o($Vl,[2,37]),o($Vl,[2,38]),o($Vl,[2,39]),{20:63,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9,58:[1,64]},{20:65,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9},{20:66,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9},{20:67,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9},{9:$Vm,22:68,28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:69},{9:$Vm,22:83,28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:69},{9:$Vm,22:84,28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:69},{9:$Vm,22:85,28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:69},{9:$Vm,22:86,28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:69},o($Vg,[2,22]),{31:87,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9},{11:[1,88]},{1:[2,2]},{6:[2,4]},{11:[2,13]},o($Vk,[2,34]),{9:$Vm,22:89,28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:69},{9:[1,90]},{9:[1,91]},{9:[1,92]},{9:[1,93]},{9:[1,94]},{9:$Vm,23:[1,95],28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:96},o($Vz,[2,41]),o($Vz,[2,45]),o($Vz,[2,46]),o($Vz,[2,47]),o($Vz,[2,48]),o($Vz,[2,49]),o($Vz,[2,50]),o($Vz,[2,51]),o($Vz,[2,52]),o($Vz,[2,53]),o($Vz,$VA),o($Vz,[2,55]),o($Vz,[2,56]),o($Vz,[2,57]),{9:$Vm,25:[1,97],28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:96},{9:$Vm,27:[1,98],28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:96},{9:$Vm,23:[1,99],28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:96},{9:$Vm,28:[1,100],29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,49:96},o($Vh,[2,24]),o([9,33,34,35,36,37,38,39,40,41,53,55,56,57],[2,3]),{9:$Vm,28:$Vn,29:$Vo,32:$Vp,33:$Vq,34:$Vr,35:$Vs,36:$Vt,37:$Vu,38:$Vv,39:$Vw,40:$Vx,41:$Vy,48:[1,101],49:96},{9:$VB,32:$VC,33:$VD,34:$VE,35:$VF,40:$VG,41:$VH,54:102,58:$VI,59:103,60:104,61:$VJ},{9:$VB,32:$VC,33:$VD,34:$VE,35:$VF,40:$VG,41:$VH,54:114,58:$VI,59:103,60:104,61:$VJ},{9:$VB,32:$VC,33:$VD,34:$VE,35:$VF,40:$VG,41:$VH,54:115,58:$VI,59:103,60:104,61:$VJ},{20:116,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9},{20:117,30:19,31:20,33:$V1,34:$V2,35:$V3,36:$V4,37:$V5,38:$V6,39:$V7,40:$V8,41:$V9},o($Vf,[2,15]),o($Vz,[2,42]),o($Vf,[2,16]),o($Vf,[2,17]),o($Vf,[2,18]),o([9,28,29,32,33,34,35,36,37,38,39,40,41],$VA,{11:$VK,44:$VK,45:$VK,46:$VK,47:$VK}),o($Vk,[2,40]),{11:[2,74],36:$VL},o($VM,[2,76],{60:119,9:$VB,32:$VC,33:$VD,34:$VE,35:$VF,40:$VG,41:$VH,58:$VI,61:$VJ}),o($VN,[2,78]),o($VN,[2,80]),o($VN,[2,81]),o($VN,[2,82]),o($VN,[2,83]),o($VN,[2,84]),o($VN,[2,85]),o($VN,[2,86]),o($VN,[2,87]),o($VN,[2,88]),{11:[2,75],36:$VL},{11:[2,71],36:$VL},{11:[2,72]},{11:[2,73]},{9:$VB,32:$VC,33:$VD,34:$VE,35:$VF,40:$VG,41:$VH,58:$VI,59:120,60:104,61:$VJ},o($VN,[2,79]),o($VM,[2,77],{60:119,9:$VB,32:$VC,33:$VD,34:$VE,35:$VF,40:$VG,41:$VH,58:$VI,61:$VJ})],
defaultActions: {31:[2,1],58:[2,2],59:[2,4],60:[2,13],116:[2,72],117:[2,73]},
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
@ -643,13 +646,13 @@ options: {},
performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
var YYSTATE=YY_START;
switch($avoiding_name_collisions) {
case 0:return 55;
case 0:return 57;
break;
case 1:return 51;
case 1:return 53;
break;
case 2:return 53;
case 2:return 55;
break;
case 3:return 54;
case 3:return 56;
break;
case 4:return 8;
break;
@ -665,25 +668,25 @@ case 9:return 10;
break;
case 10:return 10;
break;
case 11:return 32;
case 11:return 34;
break;
case 12:return 41;
break;
case 13:return 33;
case 13:return 35;
break;
case 14:return 11;
break;
case 15:return 34;
case 15:return 36;
break;
case 16:return 36;
case 16:return 38;
break;
case 17:return 37;
case 17:return 39;
break;
case 18:return 38;
case 18:return 40;
break;
case 19:return 39;
case 19:return 29;
break;
case 20:return 40;
case 20:return 28;
break;
case 21:return 46;
break;
@ -693,13 +696,13 @@ case 23:return 45;
break;
case 24:return 47;
break;
case 25:return 30;
case 25:return 32;
break;
case 26:return 35;
case 26:return 37;
break;
case 27:return 36;
case 27:return 38;
break;
case 28:return 31;
case 28:return 33;
break;
case 29:return 48;
break;
@ -715,16 +718,18 @@ case 34:return 26
break;
case 35:return 27
break;
case 36:return 9;
case 36:return 'QUOTE';
break;
case 37:return 'NEWLINE';
case 37:return 9;
break;
case 38:return 6;
case 38:return 'NEWLINE';
break;
case 39:return 6;
break;
}
},
rules: [/^(?:style\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:click\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:RL\b)/,/^(?:TB\b)/,/^(?:BT\b)/,/^(?:TD\b)/,/^(?:BR\b)/,/^(?:[0-9])/,/^(?:#)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/],
conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"inclusive":true}}
rules: [/^(?:style\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:click\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:RL\b)/,/^(?:TB\b)/,/^(?:BT\b)/,/^(?:TD\b)/,/^(?:BR\b)/,/^(?:[0-9])/,/^(?:#)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:")/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/],
conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"inclusive":true}}
});
return lexer;
})();

View File

@ -224,9 +224,41 @@ describe('when parsing ',function(){
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();
expect(edges.length).toBe(0);
expect(vert['a'].type).toBe('odd');
});
it('should handle a single diamond node',function(){
// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a<A>;');
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();
expect(edges.length).toBe(0);
expect(vert['a'].type).toBe('diamond');
});
it('should handle a single diamond node with html in it',function(){
// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a<A <br> end>;');
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();
expect(edges.length).toBe(0);
expect(vert['a'].type).toBe('diamond');
expect(vert['a'].text).toBe('A <br> end');
});
it('should handle a single diamond node with html in it',function(){
// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a(A <br> end);');
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();
expect(edges.length).toBe(0);
expect(vert['a'].type).toBe('round');
expect(vert['a'].text).toBe('A <br> end');
});
it('should handle a single node with alphanumerics starting on a char',function(){
// Silly but syntactically correct
var res = flow.parser.parse('graph TD;id1;');

View File

@ -22,7 +22,7 @@ module.exports.draw = function (text, id) {
for(i=0;i<actorKeys.length;i++){
var key = actorKeys[i];
console.log('Doing key: '+key)
//console.log('Doing key: '+key)
var startMargin = 50;
var margin = 50;

View File

@ -3,11 +3,11 @@
<head>
<script src="../dist/mermaid.full.js"></script>
<scrpt>
<script>
var mermaid_config = {
startOnLoad:true
}
</scrpt>
</script>
<script>
function apa(){
console.log('CLICKED');
@ -22,7 +22,7 @@
chimp:Chimpansenhoppar
</div>
<div class="mermaid">
graph TB;A(Astrid # a)-->B[Irene];
graph TB;A(Astrid <br> b)-->B[Irene];
A-->C[Christer];
B-->D[Micke];
B-->E[Maria];