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.nodeId).toEqual('root');
|
||||||
expect(mm.children.length).toEqual(2);
|
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];
|
const child = mm.children[0];
|
||||||
expect(child.nodeId).toEqual('A');
|
expect(child.nodeId).toEqual('A');
|
||||||
const child2 = mm.children[1];
|
const child2 = mm.children[1];
|
||||||
|
@ -65,10 +65,8 @@
|
|||||||
|
|
||||||
start
|
start
|
||||||
// %{ : info document 'EOF' { return yy; } }
|
// %{ : info document 'EOF' { return yy; } }
|
||||||
: MINDMAP document { return yy; }
|
: mindMap
|
||||||
| MINDMAP NL document { return yy; }
|
| spaceLines mindMap
|
||||||
| spaceLines MINDMAP document { return yy; }
|
|
||||||
| spaceLines MINDMAP NL document { return yy; }
|
|
||||||
;
|
;
|
||||||
|
|
||||||
spaceLines
|
spaceLines
|
||||||
@ -77,6 +75,11 @@ spaceLines
|
|||||||
| spaceLines NL
|
| spaceLines NL
|
||||||
;
|
;
|
||||||
|
|
||||||
|
mindMap
|
||||||
|
: MINDMAP document { return yy; }
|
||||||
|
| MINDMAP NL document { return yy; }
|
||||||
|
;
|
||||||
|
|
||||||
stop
|
stop
|
||||||
: NL {yy.getLogger().trace('Stop NL ');}
|
: NL {yy.getLogger().trace('Stop NL ');}
|
||||||
| EOF {yy.getLogger().trace('Stop EOF ');}
|
| EOF {yy.getLogger().trace('Stop EOF ');}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user