mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Remove required space from TAGEND token regex
Originally, I thought this was necessary to prevent parsing the token as part of an edge. I forgot that the token will always be separated from the link/edge by the node id. Added an unit test for an edge case to be certain.
This commit is contained in:
parent
844f9d96e7
commit
ed4feaebf2
@ -369,6 +369,13 @@ describe('[Text] when parsing', () => {
|
|||||||
expect(vert['B'].text).toBe(`This node has a ${keyword} as text`);
|
expect(vert['B'].text).toBe(`This node has a ${keyword} as text`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should handle edge case for odd vertex with node id ending with minus', function () {
|
||||||
|
const res = flow.parser.parse('graph TD;A_node-->odd->Vertex Text];');
|
||||||
|
const vert = flow.parser.yy.getVertices();
|
||||||
|
|
||||||
|
expect(vert['odd-'].type).toBe('odd');
|
||||||
|
expect(vert['odd-'].text).toBe('Vertex Text');
|
||||||
|
});
|
||||||
it('should allow forward slashes in lean_right vertices', function () {
|
it('should allow forward slashes in lean_right vertices', function () {
|
||||||
const rest = flow.parser.parse(`graph TD;A_node-->B[/This node has a / as text/];`);
|
const rest = flow.parser.parse(`graph TD;A_node-->B[/This node has a / as text/];`);
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ that id.
|
|||||||
|
|
||||||
"[|" { return 'VERTEX_WITH_PROPS_START'; }
|
"[|" { return 'VERTEX_WITH_PROPS_START'; }
|
||||||
|
|
||||||
\>/!\s { this.pushState("text"); return 'TAGEND'; }
|
\> { this.pushState("text"); return 'TAGEND'; }
|
||||||
|
|
||||||
<text>")]" { this.popState(); return 'CYLINDEREND'; }
|
<text>")]" { this.popState(); return 'CYLINDEREND'; }
|
||||||
<*>"[(" { this.pushState("text") ;return 'CYLINDERSTART'; }
|
<*>"[(" { this.pushState("text") ;return 'CYLINDERSTART'; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user