mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
#4012 Neater grammar for the rows before mindmap
This commit is contained in:
parent
80903e427c
commit
bc56a7d4f1
@ -366,6 +366,18 @@ root
|
||||
expect(mm.nodeId).toEqual('root');
|
||||
expect(mm.children.length).toEqual(2);
|
||||
|
||||
const child = mm.children[0];
|
||||
expect(child.nodeId).toEqual('A');
|
||||
const child2 = mm.children[1];
|
||||
expect(child2.nodeId).toEqual('B');
|
||||
});
|
||||
it('MMP-25 Handle rows above the mindmap declarations, no space', function () {
|
||||
let str = '\n\n\nmindmap\nroot\n A\n \n\n B';
|
||||
mindmap.parse(str);
|
||||
const mm = mindmap.yy.getMindmap();
|
||||
expect(mm.nodeId).toEqual('root');
|
||||
expect(mm.children.length).toEqual(2);
|
||||
|
||||
const child = mm.children[0];
|
||||
expect(child.nodeId).toEqual('A');
|
||||
const child2 = mm.children[1];
|
||||
|
@ -65,11 +65,9 @@
|
||||
|
||||
start
|
||||
// %{ : info document 'EOF' { return yy; } }
|
||||
: MINDMAP document { return yy; }
|
||||
| MINDMAP NL document { return yy; }
|
||||
| spaceLines MINDMAP document { return yy; }
|
||||
| spaceLines MINDMAP NL document { return yy; }
|
||||
;
|
||||
: mindMap
|
||||
| spaceLines mindMap
|
||||
;
|
||||
|
||||
spaceLines
|
||||
: SPACELINE
|
||||
@ -77,6 +75,11 @@ spaceLines
|
||||
| spaceLines NL
|
||||
;
|
||||
|
||||
mindMap
|
||||
: MINDMAP document { return yy; }
|
||||
| MINDMAP NL document { return yy; }
|
||||
;
|
||||
|
||||
stop
|
||||
: NL {yy.getLogger().trace('Stop NL ');}
|
||||
| EOF {yy.getLogger().trace('Stop EOF ');}
|
||||
|
Loading…
x
Reference in New Issue
Block a user