mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
Added keywords as valid text token, fix for issue #8
This commit is contained in:
@@ -264,9 +264,12 @@ textToken: ALPHA
|
||||
{$$ = $1;}
|
||||
| MINUS
|
||||
{$$ = $1;}
|
||||
| DIR
|
||||
| keywords
|
||||
{$$ = $1;}
|
||||
;
|
||||
keywords
|
||||
: STYLE | LINKSTYLE | CLASSDEF | CLASS | CLICK | GRAPH | DIR;
|
||||
|
||||
|
||||
textNoTags: textNoTagsToken
|
||||
{$$=$1;}
|
||||
@@ -296,7 +299,7 @@ textNoTagsToken: ALPHA
|
||||
{$$ = $1;}
|
||||
| MINUS
|
||||
{$$ = $1;}
|
||||
| DIR
|
||||
| keywords
|
||||
{$$ = $1;}
|
||||
;
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@@ -98,6 +98,15 @@ describe('when parsing ',function(){
|
||||
expect(edges[0].type).toBe('arrow_cross');
|
||||
expect(edges[0].text).toBe('text including URL space');
|
||||
|
||||
});
|
||||
it('should handle text on edges with graph keyword',function(){
|
||||
var res = flow.parser.parse('graph TD;A--x|text including graph space|B;');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
expect(edges[0].text).toBe('text including graph space');
|
||||
|
||||
});
|
||||
it('should handle multi-line text',function(){
|
||||
var res = flow.parser.parse('graph TD;A--o|text space|B;\n B-->|more text with space|C;');
|
||||
|
Reference in New Issue
Block a user