Merge pull request #134 from bollwyvl/patch-1

Use a library-level variable for assigning ids
This commit is contained in:
Knut Sveidqvist 2015-03-10 20:06:43 +01:00
commit 34ee8a0e21
1 changed files with 3 additions and 5 deletions

View File

@ -15,6 +15,8 @@ var gantt = require('./diagrams/gantt/ganttRenderer');
var ganttParser = require('./diagrams/gantt/parser/gantt'); var ganttParser = require('./diagrams/gantt/parser/gantt');
var ganttDb = require('./diagrams/gantt/ganttDb'); var ganttDb = require('./diagrams/gantt/ganttDb');
var nextId = 0;
/** /**
* Function that parses a mermaid diagram defintion. If parsing fails the parseError callback is called and an error is * Function that parses a mermaid diagram defintion. If parsing fails the parseError callback is called and an error is
* thrown and * thrown and
@ -80,7 +82,6 @@ var init = function (sequenceConfig) {
} }
} }
var cnt = 0;
for (i = 0; i < arr.length; i++) { for (i = 0; i < arr.length; i++) {
var element = arr[i]; var element = arr[i];
@ -91,10 +92,7 @@ var init = function (sequenceConfig) {
continue; continue;
} }
var id; id = 'mermaidChart' + nextId++;
id = 'mermaidChart' + cnt;
cnt++;
var txt = element.innerHTML; var txt = element.innerHTML;
txt = txt.replace(/>/g,'&gt;'); txt = txt.replace(/>/g,'&gt;');