mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Remove grammar and unit test that expects HEX token
This was never really used and had many things wrong with it. I believe that if a hex was provided in the diagram specification, the alphanum grammar would break it up into a BRKT and NUM token and use the first line with the addVertex() function. Second, the styleLink grammar provides the exact same functionality with the linkStyle keyword. Third, updateLink() expects an array of nums, not a hex digit. Fourth, no documentation is provided on this grammar statement existing. Fifth, the unit test does not work in version 10.2.4
This commit is contained in:
parent
0a4e5f5f6b
commit
3fa3ed7b18
@ -26,15 +26,6 @@ describe('[Style] when parsing', () => {
|
|||||||
expect(vert['Q'].styles[0]).toBe('background:#fff');
|
expect(vert['Q'].styles[0]).toBe('background:#fff');
|
||||||
});
|
});
|
||||||
|
|
||||||
// log.debug(flow.parser.parse('graph TD;style Q background:#fff;'));
|
|
||||||
it('should handle styles for edges', function () {
|
|
||||||
const res = flow.parser.parse('graph TD;a-->b;\nstyle #0 stroke: #f66;');
|
|
||||||
|
|
||||||
const edges = flow.parser.yy.getEdges();
|
|
||||||
|
|
||||||
expect(edges.length).toBe(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle multiple styles for a vortex', function () {
|
it('should handle multiple styles for a vortex', function () {
|
||||||
const res = flow.parser.parse('graph TD;style R background:#fff,border:1px solid red;');
|
const res = flow.parser.parse('graph TD;style R background:#fff,border:1px solid red;');
|
||||||
|
|
||||||
|
@ -118,7 +118,6 @@ that id.
|
|||||||
|
|
||||||
[0-9]+ return 'NUM';
|
[0-9]+ return 'NUM';
|
||||||
\# return 'BRKT';
|
\# return 'BRKT';
|
||||||
\#[0-9]+ return 'HEX';
|
|
||||||
":::" return 'STYLE_SEPARATOR';
|
":::" return 'STYLE_SEPARATOR';
|
||||||
":" return 'COLON';
|
":" return 'COLON';
|
||||||
"&" return 'AMP';
|
"&" return 'AMP';
|
||||||
@ -505,8 +504,7 @@ clickStatement
|
|||||||
|
|
||||||
styleStatement:STYLE SPACE idString SPACE stylesOpt
|
styleStatement:STYLE SPACE idString SPACE stylesOpt
|
||||||
{$$ = $1;yy.addVertex($3,undefined,undefined,$5);}
|
{$$ = $1;yy.addVertex($3,undefined,undefined,$5);}
|
||||||
| STYLE SPACE HEX SPACE stylesOpt
|
|
||||||
{$$ = $1;yy.updateLink($3,$5);}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
linkStyleStatement
|
linkStyleStatement
|
||||||
@ -541,7 +539,7 @@ style: styleComponent
|
|||||||
{$$ = $1 + $2;}
|
{$$ = $1 + $2;}
|
||||||
;
|
;
|
||||||
|
|
||||||
styleComponent: NUM | NODE_STRING| COLON | UNIT | SPACE | HEX | BRKT | STYLE | PCT ;
|
styleComponent: NUM | NODE_STRING| COLON | UNIT | SPACE | BRKT | STYLE | PCT ;
|
||||||
|
|
||||||
/* Token lists */
|
/* Token lists */
|
||||||
idStringToken : NUM | NODE_STRING | DOWN | MINUS | DEFAULT | COMMA | COLON;
|
idStringToken : NUM | NODE_STRING | DOWN | MINUS | DEFAULT | COMMA | COLON;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user