Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a library-level variable for assigning ids #134

Merged
merged 1 commit into from
Mar 10, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var gantt = require('./diagrams/gantt/ganttRenderer');
var ganttParser = require('./diagrams/gantt/parser/gantt');
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
* thrown and
Expand Down Expand Up @@ -80,7 +82,6 @@ var init = function (sequenceConfig) {
}
}

var cnt = 0;
for (i = 0; i < arr.length; i++) {
var element = arr[i];

Expand All @@ -91,10 +92,7 @@ var init = function (sequenceConfig) {
continue;
}

var id;

id = 'mermaidChart' + cnt;
cnt++;
id = 'mermaidChart' + nextId++;

var txt = element.innerHTML;
txt = txt.replace(/>/g,'&gt;');
Expand Down