Bugfix for empty blank lines
This commit is contained in:
parent
9b54feab84
commit
d32c8534cb
|
@ -104,7 +104,9 @@ mindmap
|
|||
things<br>
|
||||
happen!
|
||||
]
|
||||
::icon(mdi mdi-numeric-8-circle)
|
||||
Child2
|
||||
:::disabled
|
||||
GrandChild1
|
||||
GrandChild2
|
||||
Child3(Child 3 has a long wrapped text as well)
|
||||
|
|
|
@ -63,9 +63,11 @@
|
|||
"dagre": "^0.8.5",
|
||||
"dagre-d3": "^0.6.4",
|
||||
"dompurify": "2.3.10",
|
||||
"fast-clone": "^1.5.13",
|
||||
"graphlib": "^2.1.8",
|
||||
"khroma": "^2.0.0",
|
||||
"moment-mini": "^2.24.0",
|
||||
"non-layered-tidy-tree-layout": "^2.0.2",
|
||||
"stylis": "^4.0.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -119,7 +119,7 @@ root
|
|||
});
|
||||
it('mutiple types (circle)', function () {
|
||||
var str = `mindmap
|
||||
root((the root))
|
||||
root((the root))
|
||||
`;
|
||||
|
||||
mindmap.parse(str);
|
||||
|
@ -217,4 +217,23 @@ root((the root))
|
|||
expect(child.children[1].nodeId).toEqual('b');
|
||||
});
|
||||
});
|
||||
it('should be possible to have meaningless empty rows in a mindmap abc123', function () {
|
||||
var str = `mindmap
|
||||
root(Root)
|
||||
Child(Child)
|
||||
a(a)
|
||||
|
||||
b[New Stuff]`;
|
||||
mindmap.parse(str);
|
||||
const mm = mindmap.yy.getMindmap();
|
||||
expect(mm.nodeId).toEqual('root');
|
||||
expect(mm.descr).toEqual('Root');
|
||||
expect(mm.children.length).toEqual(1);
|
||||
|
||||
const child = mm.children[0];
|
||||
expect(child.nodeId).toEqual('Child');
|
||||
expect(child.children[0].nodeId).toEqual('a');
|
||||
expect(child.children.length).toEqual(2);
|
||||
expect(child.children[1].nodeId).toEqual('b');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,22 +24,22 @@
|
|||
<CLASS>.+ { this.popState();return 'CLASS'; }
|
||||
<CLASS>\n { this.popState();}
|
||||
[\n\s]*"::icon(" { this.begin('ICON'); }
|
||||
[\n]+ /* return 'NL'; */
|
||||
<ICON>[^\)]+ { return 'ICON'; }
|
||||
<ICON>\) {this.popState();}
|
||||
"((" { this.begin('NODE');return 'NODE_DSTART'; }
|
||||
"(" { this.begin('NODE');return 'NODE_DSTART'; }
|
||||
"[" { this.begin('NODE');return 'NODE_DSTART'; }
|
||||
[^\(\[\n]+ return 'NODE_ID';
|
||||
[\s]+ return 'SPACELIST' /* skip all whitespace */ ;
|
||||
[^\(\[\n]+ return 'NODE_ID';
|
||||
<<EOF>> return 'EOF';
|
||||
<NODE>["] { console.log('Starting NSTR');this.begin("NSTR");}
|
||||
<NSTR>[^"]+ { console.log('description:', yytext); return "NODE_DESCR";}
|
||||
<NSTR>["] {this.popState();}
|
||||
<NODE>[\)] {this.popState();console.log('node end');return "NODE_DEND";}
|
||||
<NODE>[\]] {this.popState();console.log('node end');return "NODE_DEND";}
|
||||
<NODE>[\)]\) {this.popState();console.log('node end ))');return "NODE_DEND";}
|
||||
<NODE>[\)] {this.popState();console.log('node end )');return "NODE_DEND";}
|
||||
<NODE>[\]] {this.popState();console.log('node end ...');return "NODE_DEND";}
|
||||
<NODE>[^\)\]]+ { console.log('Long description:', yytext); return 'NODE_DESCR';}
|
||||
|
||||
[\n]+ /* return 'NL'; */
|
||||
// [\[] return 'NODE_START';
|
||||
// .+ return 'TXT' ;
|
||||
|
||||
|
@ -65,10 +65,11 @@ line
|
|||
;
|
||||
|
||||
statement
|
||||
: node
|
||||
| SPACELIST node { yy.addNode($1.length, $2.id, $2.descr, $2.type); }
|
||||
| SPACELIST EOF
|
||||
: SPACELIST node { yy.addNode($1.length, $2.id, $2.descr, $2.type); }
|
||||
| SPACELIST ICON { yy.decorateNode({icon: $2}); }
|
||||
| SPACELIST EOF
|
||||
| SPACELIST NL
|
||||
| node { console.log($1.id);yy.addNode(0, $1.id, $1.descr, $1.type); }
|
||||
| ICON { yy.decorateNode({icon: $1}); }
|
||||
| SPACELIST CLASS { yy.decorateNode({class: $2}); }
|
||||
| CLASS { yy.decorateNode({class: $1}); }
|
||||
|
@ -77,6 +78,6 @@ statement
|
|||
node
|
||||
: NODE_ID { $$ = { id: $1, descr: $1, type: yy.nodeType.DEFAULT }; }
|
||||
| NODE_ID NODE_DSTART NODE_DESCR NODE_DEND
|
||||
{ $$ = { id: $1, descr: $3, type: yy.getTypeFromStart($2) }; }
|
||||
{ console.log("node found ..", $1); $$ = { id: $1, descr: $3, type: yy.getTypeFromStart($2) }; }
|
||||
;
|
||||
%%
|
||||
|
|
Loading…
Reference in New Issue