mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-20 16:56:41 +02:00
Added keywords as valid text token, fix for issue #8
This commit is contained in:
@@ -264,9 +264,12 @@ textToken: ALPHA
|
|||||||
{$$ = $1;}
|
{$$ = $1;}
|
||||||
| MINUS
|
| MINUS
|
||||||
{$$ = $1;}
|
{$$ = $1;}
|
||||||
| DIR
|
| keywords
|
||||||
{$$ = $1;}
|
{$$ = $1;}
|
||||||
;
|
;
|
||||||
|
keywords
|
||||||
|
: STYLE | LINKSTYLE | CLASSDEF | CLASS | CLICK | GRAPH | DIR;
|
||||||
|
|
||||||
|
|
||||||
textNoTags: textNoTagsToken
|
textNoTags: textNoTagsToken
|
||||||
{$$=$1;}
|
{$$=$1;}
|
||||||
@@ -296,7 +299,7 @@ textNoTagsToken: ALPHA
|
|||||||
{$$ = $1;}
|
{$$ = $1;}
|
||||||
| MINUS
|
| MINUS
|
||||||
{$$ = $1;}
|
{$$ = $1;}
|
||||||
| DIR
|
| keywords
|
||||||
{$$ = $1;}
|
{$$ = $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].type).toBe('arrow_cross');
|
||||||
expect(edges[0].text).toBe('text including URL space');
|
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(){
|
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;');
|
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