Skip to content

Commit

Permalink
Merge 0082c23 into c7b559f
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Jan 29, 2020
2 parents c7b559f + 0082c23 commit bf08a9f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/mermaidAPI.md
Expand Up @@ -275,11 +275,12 @@ mermaidAPI.initialize({
### Parameters

- `id` the id of the element to be rendered
- `txt` the graph definition
- `_txt`
- `cb` callback which is called after rendering is finished with the svg code as inparam.
- `container` selector to element in which a div with the graph temporarily will be inserted. In one is
provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
completed.
- `txt` the graph definition

##

Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/state/parser/stateDiagram.jison
Expand Up @@ -48,7 +48,7 @@
<STATE>.*"[[fork]]" {this.popState();yytext=yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yytext);*/return 'FORK';}
<STATE>.*"[[join]]" {this.popState();yytext=yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yytext);*/return 'JOIN';}
<STATE>["] this.begin("STATE_STRING");
<STATE>"as"\s* {this.popState();this.pushState('STATE_ID');return "AS";}
<STATE>\s*"as"\s+ {this.popState();this.pushState('STATE_ID');return "AS";}
<STATE_ID>[^\n\{]* {this.popState();/* console.log('STATE_ID', yytext);*/return "ID";}
<STATE_STRING>["] this.popState();
<STATE_STRING>[^"]* { /*console.log('Long description:', yytext);*/return "STATE_DESCR";}
Expand Down
33 changes: 33 additions & 0 deletions src/diagrams/state/stateDiagram.spec.js
Expand Up @@ -53,6 +53,39 @@ describe('state diagram, ', function() {

parser.parse(str);
});

it('handle "as" in state names', function() {
const str = `stateDiagram
assemble
state assemble
`;

parser.parse(str);
});
it('handle "as" in state names 1', function() {
const str = `stateDiagram
assemble
state assemble
`;

parser.parse(str);
});
it('handle "as" in state names 2', function() {
const str = `stateDiagram
assembleas
state assembleas
`;

parser.parse(str);
});
it('handle "as" in state names 3', function() {
const str = `stateDiagram
state "as" as as
`;

parser.parse(str);
});

it('scale', function() {
const str = `stateDiagram\n
scale 350 width
Expand Down

0 comments on commit bf08a9f

Please sign in to comment.