Skip to content

Commit

Permalink
Making it possible to have style/% in class definitions as described …
Browse files Browse the repository at this point in the history
…in issue #54
  • Loading branch information
knsv committed Jan 8, 2015
1 parent 5a720b6 commit 9527237
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 17 deletions.
6 changes: 3 additions & 3 deletions dist/mermaid.full.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/mermaid.full.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/mermaid.slim.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/mermaid.slim.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/diagrams/flowchart/parser/flow.jison
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ style: styleComponent
{$$ = $1 + $2;}
;

styleComponent: ALPHA | COLON | MINUS | NUM | UNIT | SPACE | HEX | BRKT | DOT;
styleComponent: ALPHA | COLON | MINUS | NUM | UNIT | SPACE | HEX | BRKT | DOT | STYLE | PCT ;

/* Token lists */

Expand Down
6 changes: 3 additions & 3 deletions src/diagrams/flowchart/parser/flow.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/diagrams/flowchart/parser/flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,26 @@ describe('when parsing ',function(){
expect(edges[0].type).toBe('arrow');
});

it('should handle classDefs with style in classes',function(){
var res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass font-style:bold;');

var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();


expect(edges[0].type).toBe('arrow');
});

it('should handle classDefs with % in classes',function(){
var res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass fill:#f96,stroke:#333,stroke-width:4px,font-size:50%,font-style:bold;');

var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();


expect(edges[0].type).toBe('arrow');
});

describe("it should handle text on edges",function(){
it('it should handle text without space',function(){
var res = flow.parser.parse('graph TD;A--x|textNoSpace|B;');
Expand Down
2 changes: 1 addition & 1 deletion test/web.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>Sub graphs</h1>
cyr[Cyrillic]-->cyr2((Circle shape Начало))
end
classDef green fill:#9f6,stroke:#333,stroke-width:2px;
classDef orange fill:#f96,stroke:#333,stroke-width:4px;
classDef orange fill:#f96,stroke:#333,stroke-width:4px,font-size:50%,font-style:bold;
class sq,e green
class di orange
</div>
Expand Down

0 comments on commit 9527237

Please sign in to comment.