mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 23:39:50 +02:00
Allow node ids with keywords as suffixes
I've extracted alpha and punctuation characters from the huge regex and made multiple occurences of alpha characters be recognised as a single ALPHA token. This way everything should work just like before, with the difference that alpha strings will swallow keywords, ie. `spend` is `ALPHA`, while previously it would have been `ALPHA ALPHA end`.
This commit is contained in:
@@ -320,6 +320,18 @@ describe('when parsing ',function(){
|
||||
expect(edges[0].end).toBe('sender');
|
||||
});
|
||||
|
||||
it('should handle node names ending with keywords',function(){
|
||||
var res = flow.parser.parse('graph TD\nblend --> monograph');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
expect(vert['blend'].id).toBe('blend');
|
||||
expect(vert['monograph'].id).toBe('monograph');
|
||||
expect(edges[0].start).toBe('blend');
|
||||
expect(edges[0].end).toBe('monograph');
|
||||
});
|
||||
|
||||
it('should handle open ended edges',function(){
|
||||
var res = flow.parser.parse('graph TD;A---B;');
|
||||
|
||||
|
Reference in New Issue
Block a user