Added logger for dealing with issue #179
Added markdown files for the documentation. parseError exposed from the mermaidAPI
This commit is contained in:
parent
0dc983d04a
commit
6f96b5dd14
|
@ -25049,19 +25049,19 @@ module.exports={
|
||||||
|
|
||||||
},{}],87:[function(require,module,exports){
|
},{}],87:[function(require,module,exports){
|
||||||
/* global window */
|
/* global window */
|
||||||
//console.log('Setting up d3');
|
//log.debug('Setting up d3');
|
||||||
var d3;
|
var d3;
|
||||||
|
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
d3 = require("d3");
|
d3 = require("d3");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Exception ... but ok');
|
//log.debug('Exception ... but ok');
|
||||||
//console.log(e);
|
//log.debug(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(d3);
|
//log.debug(d3);
|
||||||
|
|
||||||
if (!d3) {
|
if (!d3) {
|
||||||
//if(typeof window !== 'undefined')
|
//if(typeof window !== 'undefined')
|
||||||
|
@ -25072,10 +25072,10 @@ if (!d3) {
|
||||||
// window = {};
|
// window = {};
|
||||||
// window.d3 = d3;
|
// window.d3 = d3;
|
||||||
//}
|
//}
|
||||||
//console.log('window');
|
//log.debug('window');
|
||||||
//console.log(window);
|
//log.debug(window);
|
||||||
module.exports = d3;
|
module.exports = d3;
|
||||||
|
/* jshint ignore:start */
|
||||||
/*
|
/*
|
||||||
|
|
||||||
D3 Text Wrap
|
D3 Text Wrap
|
||||||
|
@ -25530,11 +25530,12 @@ Detailed instructions at http://www.github.com/vijithassar/d3textwrap
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
/* jshint ignore:end */
|
||||||
},{"d3":1}],88:[function(require,module,exports){
|
},{"d3":1}],88:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var message = '';
|
var message = '';
|
||||||
var info = false;
|
var info = false;
|
||||||
|
|
||||||
|
@ -25555,16 +25556,16 @@ exports.getInfo = function(){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{}],89:[function(require,module,exports){
|
},{"../../logger":104}],89:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-11.
|
* Created by knut on 14-12-11.
|
||||||
*/
|
*/
|
||||||
var db = require('./exampleDb');
|
var db = require('./exampleDb');
|
||||||
var exampleParser = require('./parser/example.js');
|
var exampleParser = require('./parser/example.js');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
/**
|
/**
|
||||||
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
||||||
* @param text
|
* @param text
|
||||||
|
@ -25602,7 +25603,7 @@ exports.draw = function (txt, id, ver) {
|
||||||
svg.attr("width", 400 );
|
svg.attr("width", 400 );
|
||||||
//svg.attr("viewBox", '0 0 300 150');
|
//svg.attr("viewBox", '0 0 300 150');
|
||||||
};
|
};
|
||||||
},{"../../d3":87,"./exampleDb":88,"./parser/example.js":90}],90:[function(require,module,exports){
|
},{"../../d3":87,"../../logger":104,"./exampleDb":88,"./parser/example.js":90}],90:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -26231,14 +26232,14 @@ if (typeof module !== 'undefined' && require.main === module) {
|
||||||
}).call(this,require("1YiZ5S"))
|
}).call(this,require("1YiZ5S"))
|
||||||
},{"1YiZ5S":82,"fs":80,"path":81}],91:[function(require,module,exports){
|
},{"1YiZ5S":82,"fs":80,"path":81}],91:[function(require,module,exports){
|
||||||
/* global window */
|
/* global window */
|
||||||
|
var log = require('../../logger').create();
|
||||||
var dagreD3;
|
var dagreD3;
|
||||||
//console.log('setting up dagre-d3');
|
//log.debug('setting up dagre-d3');
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
dagreD3 = require("dagre-d3");
|
dagreD3 = require("dagre-d3");
|
||||||
//console.log('Got it (dagre-d3)');
|
//log.debug('Got it (dagre-d3)');
|
||||||
} catch (e) {console.log('Could not load dagre-d3');}
|
} catch (e) {log.debug('Could not load dagre-d3');}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dagreD3) {
|
if (!dagreD3) {
|
||||||
|
@ -26247,7 +26248,7 @@ if (!dagreD3) {
|
||||||
|
|
||||||
module.exports = dagreD3;
|
module.exports = dagreD3;
|
||||||
|
|
||||||
},{"dagre-d3":2}],92:[function(require,module,exports){
|
},{"../../logger":104,"dagre-d3":2}],92:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-11.
|
* Created by knut on 14-12-11.
|
||||||
*/
|
*/
|
||||||
|
@ -26256,6 +26257,8 @@ var flow = require('./parser/flow');
|
||||||
var dot = require('./parser/dot');
|
var dot = require('./parser/dot');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var dagreD3 = require('./dagre-d3');
|
var dagreD3 = require('./dagre-d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
};
|
};
|
||||||
module.exports.setConf = function(cnf){
|
module.exports.setConf = function(cnf){
|
||||||
|
@ -26299,7 +26302,7 @@ exports.addVertices = function (vert, g) {
|
||||||
*/
|
*/
|
||||||
var classStr = '';
|
var classStr = '';
|
||||||
|
|
||||||
//console.log(vertice.classes);
|
//log.debug(vertice.classes);
|
||||||
|
|
||||||
if(vertice.classes.length >0){
|
if(vertice.classes.length >0){
|
||||||
classStr = vertice.classes.join(" ");
|
classStr = vertice.classes.join(" ");
|
||||||
|
@ -26480,7 +26483,7 @@ exports.getClasses = function (text, isDot) {
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
exports.draw = function (text, id,isDot) {
|
exports.draw = function (text, id,isDot) {
|
||||||
|
log.debug('Drawing flowchart');
|
||||||
var parser;
|
var parser;
|
||||||
graph.clear();
|
graph.clear();
|
||||||
if(isDot){
|
if(isDot){
|
||||||
|
@ -26533,7 +26536,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
||||||
var vert = graph.getVertices();
|
var vert = graph.getVertices();
|
||||||
|
|
||||||
//console.log(vert);
|
//log.debug(vert);
|
||||||
var edges = graph.getEdges();
|
var edges = graph.getEdges();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -26544,7 +26547,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
d3.selectAll('cluster').append('text');
|
d3.selectAll('cluster').append('text');
|
||||||
|
|
||||||
for(j=0;j<subG.nodes.length;j++){
|
for(j=0;j<subG.nodes.length;j++){
|
||||||
//console.log('Setting node',subG.nodes[j],' to subgraph '+id);
|
//log.debug('Setting node',subG.nodes[j],' to subgraph '+id);
|
||||||
g.setParent(subG.nodes[j],subG.id);
|
g.setParent(subG.nodes[j],subG.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26688,7 +26691,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
|
|
||||||
if (subG.title !== 'undefined') {
|
if (subG.title !== 'undefined') {
|
||||||
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
||||||
//console.log('looking up: #' + id + ' #' + subG.id)
|
//log.debug('looking up: #' + id + ' #' + subG.id)
|
||||||
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
||||||
|
|
||||||
var xPos = clusterRects[0].x.baseVal.value;
|
var xPos = clusterRects[0].x.baseVal.value;
|
||||||
|
@ -26715,11 +26718,11 @@ exports.draw = function (text, id,isDot) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"../../d3":87,"./dagre-d3":91,"./graphDb":93,"./parser/dot":94,"./parser/flow":95}],93:[function(require,module,exports){
|
},{"../../d3":87,"../../logger":104,"./dagre-d3":91,"./graphDb":93,"./parser/dot":94,"./parser/flow":95}],93:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-03.
|
* Created by knut on 14-11-03.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var vertices = {};
|
var vertices = {};
|
||||||
var edges = [];
|
var edges = [];
|
||||||
var classes = [];
|
var classes = [];
|
||||||
|
@ -26781,7 +26784,7 @@ exports.addVertex = function (id, text, type, style) {
|
||||||
* @param linktext
|
* @param linktext
|
||||||
*/
|
*/
|
||||||
exports.addLink = function (start, end, type, linktext) {
|
exports.addLink = function (start, end, type, linktext) {
|
||||||
//console.log('Got edge', start, end);
|
//log.debug('Got edge', start, end);
|
||||||
var edge = {start: start, end: end, type: undefined, text: ''};
|
var edge = {start: start, end: end, type: undefined, text: ''};
|
||||||
linktext = type.text;
|
linktext = type.text;
|
||||||
|
|
||||||
|
@ -26876,7 +26879,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
//console.log('Checking now for ::'+id);
|
//log.debug('Checking now for ::'+id);
|
||||||
if(typeof vertices[id] !== 'undefined'){
|
if(typeof vertices[id] !== 'undefined'){
|
||||||
funs.push(function(){
|
funs.push(function(){
|
||||||
var elem = document.getElementById(id);
|
var elem = document.getElementById(id);
|
||||||
|
@ -26884,7 +26887,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//console.log('id was null: '+id);
|
//log.debug('id was null: '+id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26969,8 +26972,8 @@ exports.addSubGraph = function (list, title) {
|
||||||
|
|
||||||
|
|
||||||
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
||||||
//console.log('subGraph:' + subGraph.title + subGraph.id);
|
//log.debug('subGraph:' + subGraph.title + subGraph.id);
|
||||||
//console.log(subGraph.nodes);
|
//log.debug(subGraph.nodes);
|
||||||
subGraphs.push(subGraph);
|
subGraphs.push(subGraph);
|
||||||
subCount = subCount + 1;
|
subCount = subCount + 1;
|
||||||
return subGraph.id;
|
return subGraph.id;
|
||||||
|
@ -26980,11 +26983,11 @@ var getPosForId = function(id){
|
||||||
var i;
|
var i;
|
||||||
for(i=0;i<subGraphs.length;i++){
|
for(i=0;i<subGraphs.length;i++){
|
||||||
if(subGraphs[i].id===id){
|
if(subGraphs[i].id===id){
|
||||||
//console.log('Found pos for ',id,' ',i);
|
//log.debug('Found pos for ',id,' ',i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log('No pos found for ',id,' ',i);
|
//log.debug('No pos found for ',id,' ',i);
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
var secCount = -1;
|
var secCount = -1;
|
||||||
|
@ -27050,9 +27053,9 @@ exports.getSubGraphs = function (list) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{}],94:[function(require,module,exports){
|
},{"../../logger":104}],94:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -28720,6 +28723,7 @@ if (typeof module !== 'undefined' && require.main === module) {
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var dateFormat = '';
|
var dateFormat = '';
|
||||||
var title = '';
|
var title = '';
|
||||||
|
@ -28777,8 +28781,8 @@ exports.getTasks=function(){
|
||||||
|
|
||||||
|
|
||||||
var getStartDate = function(prevTime, dateFormat, str){
|
var getStartDate = function(prevTime, dateFormat, str){
|
||||||
//console.log('Deciding start date:'+str);
|
//log.debug('Deciding start date:'+str);
|
||||||
//console.log('with dateformat:'+dateFormat);
|
//log.debug('with dateformat:'+dateFormat);
|
||||||
|
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
|
|
||||||
|
@ -28799,9 +28803,9 @@ var getStartDate = function(prevTime, dateFormat, str){
|
||||||
if(moment(str,dateFormat.trim(),true).isValid()){
|
if(moment(str,dateFormat.trim(),true).isValid()){
|
||||||
return moment(str,dateFormat.trim(),true).toDate();
|
return moment(str,dateFormat.trim(),true).toDate();
|
||||||
}else{
|
}else{
|
||||||
console.log('Invalid date:'+str);
|
log.debug('Invalid date:'+str);
|
||||||
console.log('With date format:'+dateFormat.trim());
|
log.debug('With date format:'+dateFormat.trim());
|
||||||
//console.log('----');
|
//log.debug('----');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default date - now
|
// Default date - now
|
||||||
|
@ -28948,14 +28952,14 @@ exports.addTask = function(descr,data){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{"moment":85}],97:[function(require,module,exports){
|
},{"../../logger":104,"moment":85}],97:[function(require,module,exports){
|
||||||
var gantt = require('./parser/gantt').parser;
|
var gantt = require('./parser/gantt').parser;
|
||||||
gantt.yy = require('./ganttDb');
|
gantt.yy = require('./ganttDb');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var daysInChart;
|
var daysInChart;
|
||||||
var conf = {
|
var conf = {
|
||||||
|
@ -29318,7 +29322,7 @@ module.exports.draw = function (text, id) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
for (var j = 0; j < i; j++) {
|
for (var j = 0; j < i; j++) {
|
||||||
prevGap += numOccurances[i - 1][1];
|
prevGap += numOccurances[i - 1][1];
|
||||||
// console.log(prevGap);
|
// log.debug(prevGap);
|
||||||
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -29378,7 +29382,7 @@ module.exports.draw = function (text, id) {
|
||||||
return getCounts(arr)[word] || 0;
|
return getCounts(arr)[word] || 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},{"../../d3":87,"./ganttDb":96,"./parser/gantt":98,"moment":85}],98:[function(require,module,exports){
|
},{"../../d3":87,"../../logger":104,"./ganttDb":96,"./parser/gantt":98,"moment":85}],98:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -30783,15 +30787,15 @@ var actors = {};
|
||||||
var actorKeys = [];
|
var actorKeys = [];
|
||||||
var messages = [];
|
var messages = [];
|
||||||
var notes = [];
|
var notes = [];
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
|
|
||||||
exports.addActor = function(id,name,description){
|
exports.addActor = function(id,name,description){
|
||||||
//console.log('Adding actor: '+id);
|
|
||||||
actors[id] = {name:name, description:description};
|
actors[id] = {name:name, description:description};
|
||||||
actorKeys.push(id);
|
actorKeys.push(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.addMessage = function(idFrom, idTo, message, answer){
|
exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
|
||||||
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30799,7 +30803,7 @@ exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
exports.addSignal = function(idFrom, idTo, message, messageType){
|
exports.addSignal = function(idFrom, idTo, message, messageType){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
log.debug('Adding message from='+idFrom+' to='+idTo+' message='+message+' type='+messageType);
|
||||||
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30859,7 +30863,7 @@ exports.addNote = function (actor, placement, message){
|
||||||
|
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.apply = function(param){
|
exports.apply = function(param){
|
||||||
|
@ -30868,7 +30872,7 @@ exports.apply = function(param){
|
||||||
exports.apply(item);
|
exports.apply(item);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// console.log(param);
|
// log.debug(param);
|
||||||
switch(param.type){
|
switch(param.type){
|
||||||
case 'addActor':
|
case 'addActor':
|
||||||
exports.addActor(param.actor, param.actor, param.actor);
|
exports.addActor(param.actor, param.actor, param.actor);
|
||||||
|
@ -30880,7 +30884,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'loopStart':
|
case 'loopStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -30888,7 +30892,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'optStart':
|
case 'optStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -30896,7 +30900,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'altStart':
|
case 'altStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -30907,11 +30911,9 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('xxx',param);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},{}],101:[function(require,module,exports){
|
},{"../../logger":104}],101:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
@ -30920,6 +30922,8 @@ var sq = require('./parser/sequenceDiagram').parser;
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
var svgDraw = require('./svgDraw');
|
var svgDraw = require('./svgDraw');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
|
|
||||||
diagramMarginX:50,
|
diagramMarginX:50,
|
||||||
|
@ -31294,7 +31298,7 @@ module.exports.draw = function (text, id) {
|
||||||
if(conf.useMaxWidth) {
|
if(conf.useMaxWidth) {
|
||||||
diagram.attr("height", '100%');
|
diagram.attr("height", '100%');
|
||||||
diagram.attr("width", '100%');
|
diagram.attr("width", '100%');
|
||||||
diagram.attr('style', 'max-width:' + (width) + 'px;')
|
diagram.attr('style', 'max-width:' + (width) + 'px;');
|
||||||
}else{
|
}else{
|
||||||
diagram.attr("height",height);
|
diagram.attr("height",height);
|
||||||
diagram.attr("width", width );
|
diagram.attr("width", width );
|
||||||
|
@ -31302,10 +31306,11 @@ module.exports.draw = function (text, id) {
|
||||||
diagram.attr("viewBox", (box.startx-conf.diagramMarginX) + ' -' +conf.diagramMarginY + ' ' + width + ' ' + height);
|
diagram.attr("viewBox", (box.startx-conf.diagramMarginX) + ' -' +conf.diagramMarginY + ' ' + width + ' ' + height);
|
||||||
};
|
};
|
||||||
|
|
||||||
},{"../../d3":87,"./parser/sequenceDiagram":99,"./sequenceDb":100,"./svgDraw":102}],102:[function(require,module,exports){
|
},{"../../d3":87,"../../logger":104,"./parser/sequenceDiagram":99,"./sequenceDb":100,"./svgDraw":102}],102:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-20.
|
* Created by knut on 14-12-20.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
exports.drawRect = function(elem , rectData){
|
exports.drawRect = function(elem , rectData){
|
||||||
var rectElem = elem.append("rect");
|
var rectElem = elem.append("rect");
|
||||||
rectElem.attr("x", rectData.x);
|
rectElem.attr("x", rectData.x);
|
||||||
|
@ -31550,14 +31555,20 @@ exports.getNoteRect = function(){
|
||||||
return rect;
|
return rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}],103:[function(require,module,exports){
|
},{"../../logger":104}],103:[function(require,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
|
/**
|
||||||
|
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
|
||||||
|
* the diagrams to svg code.
|
||||||
|
*/
|
||||||
var he = require('he');
|
var he = require('he');
|
||||||
var mermaidAPI = require('./mermaidAPI');
|
var mermaidAPI = require('./mermaidAPI');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
module.exports.mermaidAPI = mermaidAPI;
|
module.exports.mermaidAPI = mermaidAPI;
|
||||||
/**
|
/**
|
||||||
|
* ## init
|
||||||
* Function that goes through the document to find the chart definitions in there and render them.
|
* Function that goes through the document to find the chart definitions in there and render them.
|
||||||
*
|
*
|
||||||
* The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
* The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
||||||
|
@ -31568,21 +31579,19 @@ module.exports.mermaidAPI = mermaidAPI;
|
||||||
* - an array of DOM nodes (as would come from a jQuery selector)
|
* - an array of DOM nodes (as would come from a jQuery selector)
|
||||||
* - a W3C selector, a la `.mermaid`
|
* - a W3C selector, a la `.mermaid`
|
||||||
*
|
*
|
||||||
* ```
|
* ```mermaid
|
||||||
* graph LR;
|
* graph LR;
|
||||||
* a(Find elements)-->b{Processed};
|
* a(Find elements)-->b{Processed}
|
||||||
* b-->|Yes|c(Leave element);
|
* b-->|Yes|c(Leave element)
|
||||||
* c-->|No |d(Transform);
|
* b-->|No |d(Transform)
|
||||||
* ```
|
* ```
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Renders the mermaid diagrams
|
* Renders the mermaid diagrams
|
||||||
* @* param nodes- a css selector or an array of nodes
|
* @param nodes a css selector or an array of nodes
|
||||||
*/
|
*/
|
||||||
var init = function () {
|
var init = function () {
|
||||||
var nodes;
|
var nodes;
|
||||||
if(arguments.length === 2){
|
if(arguments.length === 2){
|
||||||
// sequence config was passed as #1
|
/*! sequence config was passed as #1 */
|
||||||
if(typeof arguments[0] !== 'undefined'){
|
if(typeof arguments[0] !== 'undefined'){
|
||||||
mermaid.sequenceConfig = arguments[0];
|
mermaid.sequenceConfig = arguments[0];
|
||||||
}
|
}
|
||||||
|
@ -31596,7 +31605,7 @@ var init = function () {
|
||||||
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
||||||
: typeof nodes === "string" ? document.querySelectorAll(nodes)
|
: typeof nodes === "string" ? document.querySelectorAll(nodes)
|
||||||
: nodes instanceof Node ? [nodes]
|
: nodes instanceof Node ? [nodes]
|
||||||
// Last case - sequence config was passed pick next
|
/*! Last case - sequence config was passed pick next */
|
||||||
: nodes;
|
: nodes;
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
|
@ -31605,7 +31614,15 @@ var init = function () {
|
||||||
mermaidAPI.initialize(mermaid_config);
|
mermaidAPI.initialize(mermaid_config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug('STar On Load (0): '+mermaid.startOnLoad);
|
||||||
|
if(typeof mermaid.startOnLoad !== 'undefined'){
|
||||||
|
log.debug('STar On Load: '+mermaid.startOnLoad);
|
||||||
|
mermaidAPI.initialize({startOnLoad:mermaid.startOnLoad});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(typeof mermaid.ganttConfig !== 'undefined'){
|
if(typeof mermaid.ganttConfig !== 'undefined'){
|
||||||
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
|
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
|
||||||
}
|
}
|
||||||
|
@ -31617,7 +31634,7 @@ var init = function () {
|
||||||
for (i = 0; i < nodes.length; i++) {
|
for (i = 0; i < nodes.length; i++) {
|
||||||
var element = nodes[i];
|
var element = nodes[i];
|
||||||
|
|
||||||
// Check if previously processed
|
/*! Check if previously processed */
|
||||||
if(!element.getAttribute("data-processed")) {
|
if(!element.getAttribute("data-processed")) {
|
||||||
element.setAttribute("data-processed", true);
|
element.setAttribute("data-processed", true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -31637,11 +31654,10 @@ var init = function () {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.tester = function(){};
|
|
||||||
|
|
||||||
exports.init = init;
|
exports.init = init;
|
||||||
|
exports.parse = mermaidAPI.parse;
|
||||||
/**
|
/**
|
||||||
|
* ## version
|
||||||
* Function returning version information
|
* Function returning version information
|
||||||
* @returns {string} A string containing the version info
|
* @returns {string} A string containing the version info
|
||||||
*/
|
*/
|
||||||
|
@ -31649,10 +31665,16 @@ exports.version = function(){
|
||||||
return 'v'+require('../package.json').version;
|
return 'v'+require('../package.json').version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## initialize
|
||||||
|
* This function overrides the default configuration.
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
exports.initialize = function(config){
|
exports.initialize = function(config){
|
||||||
mermaidAPI.initialize(config);
|
mermaidAPI.initialize(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var equals = function (val, variable){
|
var equals = function (val, variable){
|
||||||
if(typeof variable === 'undefined'){
|
if(typeof variable === 'undefined'){
|
||||||
return false;
|
return false;
|
||||||
|
@ -31662,6 +31684,15 @@ var equals = function (val, variable){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global mermaid object. Contains the functions:
|
||||||
|
* * init
|
||||||
|
* * initialize
|
||||||
|
* * version
|
||||||
|
* * parse
|
||||||
|
* * parseError
|
||||||
|
* * render
|
||||||
|
*/
|
||||||
global.mermaid = {
|
global.mermaid = {
|
||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
htmlLabels: true,
|
htmlLabels: true,
|
||||||
|
@ -31679,14 +31710,26 @@ global.mermaid = {
|
||||||
return mermaidAPI.parse(text);
|
return mermaidAPI.parse(text);
|
||||||
},
|
},
|
||||||
parseError: function(err, hash) {
|
parseError: function(err, hash) {
|
||||||
console.log('Mermaid Syntax error:');
|
log.debug('Mermaid Syntax error:');
|
||||||
console.log(err);
|
log.debug(err);
|
||||||
},
|
},
|
||||||
render:function(id, text,callback, element){
|
render:function(id, text,callback, element){
|
||||||
return mermaidAPI.render(id, text,callback, element);
|
return mermaidAPI.render(id, text,callback, element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## parseError
|
||||||
|
* This function overrides the default configuration.
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
|
exports.parseError = global.mermaid.parseError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ##contentLoaded
|
||||||
|
* Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
|
||||||
|
* calls init for rendering the mermaid diagrams on the page.
|
||||||
|
*/
|
||||||
exports.contentLoaded = function(){
|
exports.contentLoaded = function(){
|
||||||
var config;
|
var config;
|
||||||
// Check state of start config mermaid namespace
|
// Check state of start config mermaid namespace
|
||||||
|
@ -31697,7 +31740,6 @@ exports.contentLoaded = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(global.mermaid.startOnLoad) {
|
if(global.mermaid.startOnLoad) {
|
||||||
|
|
||||||
// For backwards compatability reasons also check mermaid_config variable
|
// For backwards compatability reasons also check mermaid_config variable
|
||||||
if (typeof mermaid_config !== 'undefined') {
|
if (typeof mermaid_config !== 'undefined') {
|
||||||
// Check if property startOnLoad is set
|
// Check if property startOnLoad is set
|
||||||
|
@ -31706,6 +31748,7 @@ exports.contentLoaded = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
mermaidAPI.initialize({startOnLoad:global.mermaid.startOnLoad});
|
||||||
// No config found, do check API config
|
// No config found, do check API config
|
||||||
config = mermaidAPI.getConfig();
|
config = mermaidAPI.getConfig();
|
||||||
if(config.startOnLoad){
|
if(config.startOnLoad){
|
||||||
|
@ -31725,7 +31768,7 @@ exports.contentLoaded = function(){
|
||||||
|
|
||||||
|
|
||||||
if(typeof document !== 'undefined'){
|
if(typeof document !== 'undefined'){
|
||||||
/**
|
/*!
|
||||||
* Wait for document loaded before starting the execution
|
* Wait for document loaded before starting the execution
|
||||||
*/
|
*/
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
document.addEventListener('DOMContentLoaded', function(){
|
||||||
|
@ -31734,7 +31777,104 @@ if(typeof document !== 'undefined'){
|
||||||
}
|
}
|
||||||
|
|
||||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../package.json":86,"./mermaidAPI":104,"he":83}],104:[function(require,module,exports){
|
},{"../package.json":86,"./logger":104,"./mermaidAPI":105,"he":83}],104:[function(require,module,exports){
|
||||||
|
(function (process){
|
||||||
|
/**
|
||||||
|
* #logger
|
||||||
|
* logger = require('logger').create()
|
||||||
|
* logger.info("blah")
|
||||||
|
* => [2011-3-3T20:24:4.810 info (5021)] blah
|
||||||
|
* logger.debug("boom")
|
||||||
|
* =>
|
||||||
|
* logger.level = Logger.levels.debug
|
||||||
|
* logger.debug(function() { return "booom" })
|
||||||
|
* => [2011-3-3T20:24:4.810 error (5021)] booom
|
||||||
|
*/
|
||||||
|
var Logger;
|
||||||
|
|
||||||
|
Logger = (function() {
|
||||||
|
function Logger(options) {
|
||||||
|
var level, num, ref;
|
||||||
|
this.options = options || {};
|
||||||
|
this.level = this.options.level || Logger.levels.default;
|
||||||
|
ref = Logger.levels;
|
||||||
|
for (level in ref) {
|
||||||
|
num = ref[level];
|
||||||
|
Logger.define(this, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.add = function(level, message, callback) {
|
||||||
|
if (this.level > (Logger.levels[level] || 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
message = callback();
|
||||||
|
} else if (typeof message === 'function') {
|
||||||
|
message = message();
|
||||||
|
}
|
||||||
|
return this.write({
|
||||||
|
timestamp: new Date,
|
||||||
|
severity: level,
|
||||||
|
message: message,
|
||||||
|
pid: process.pid
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function formatTime(timestamp){
|
||||||
|
var hh = timestamp.getUTCHours();
|
||||||
|
var mm = timestamp.getUTCMinutes();
|
||||||
|
var ss = timestamp.getSeconds();
|
||||||
|
var ms = timestamp.getMilliseconds();
|
||||||
|
// If you were building a timestamp instead of a duration, you would uncomment the following line to get 12-hour (not 24) time
|
||||||
|
// if (hh > 12) {hh = hh % 12;}
|
||||||
|
// These lines ensure you have two-digits
|
||||||
|
if (hh < 10) {hh = "0"+hh;}
|
||||||
|
if (mm < 10) {mm = "0"+mm;}
|
||||||
|
if (ss < 10) {ss = "0"+ss;}
|
||||||
|
if (ms < 100){ms = "0"+ms;}
|
||||||
|
if (ms < 10) {ms = "00"+ms;}
|
||||||
|
// This formats your string to HH:MM:SS
|
||||||
|
var t = hh+":"+mm+":"+ss +' ('+ms+')';
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.write = function(options) {
|
||||||
|
if(typeof console !== 'undefined'){
|
||||||
|
if(typeof log.debug !== 'undefined'){
|
||||||
|
return log.debug(this.build_message(options));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.prototype.build_message = function(options) {
|
||||||
|
return "[" + formatTime(options.timestamp) + "] " + options.message;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Logger;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
Logger.define = function(logger, level) {
|
||||||
|
return logger[level] = function(message, callback) {
|
||||||
|
return this.add(level, message, callback);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.levels = {
|
||||||
|
debug: 1,
|
||||||
|
info: 2,
|
||||||
|
warn: 3,
|
||||||
|
error: 4,
|
||||||
|
fatal: 5,
|
||||||
|
default:3
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.create = function(type, options) {
|
||||||
|
return new Logger(options);
|
||||||
|
};
|
||||||
|
}).call(this,require("1YiZ5S"))
|
||||||
|
},{"1YiZ5S":82}],105:[function(require,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var graph = require('./diagrams/flowchart/graphDb');
|
var graph = require('./diagrams/flowchart/graphDb');
|
||||||
var flow = require('./diagrams/flowchart/parser/flow');
|
var flow = require('./diagrams/flowchart/parser/flow');
|
||||||
|
@ -31753,6 +31893,7 @@ var ganttParser = require('./diagrams/gantt/parser/gantt');
|
||||||
var ganttDb = require('./diagrams/gantt/ganttDb');
|
var ganttDb = require('./diagrams/gantt/ganttDb');
|
||||||
var d3 = require('./d3');
|
var d3 = require('./d3');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
// Default options, can be overridden at initialization time
|
// Default options, can be overridden at initialization time
|
||||||
/**
|
/**
|
||||||
|
@ -31972,7 +32113,7 @@ var setConf = function(cnf){
|
||||||
|
|
||||||
var j;
|
var j;
|
||||||
for(j=0;j<lvl2Keys.length;j++) {
|
for(j=0;j<lvl2Keys.length;j++) {
|
||||||
//console.log('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
//log.debug('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
||||||
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
||||||
|
|
||||||
config[lvl1Keys[i]] = {};
|
config[lvl1Keys[i]] = {};
|
||||||
|
@ -31994,20 +32135,43 @@ exports.initialize = function(options){
|
||||||
exports.getConfig = function(){
|
exports.getConfig = function(){
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.parseError = function(err, hash) {
|
||||||
|
if(typeof mermaid !== 'undefined') {
|
||||||
|
mermaid.parseError(err,hash);
|
||||||
|
}else{
|
||||||
|
log.debug('Mermaid Syntax error:');
|
||||||
|
log.debug(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
global.mermaidAPI = {
|
global.mermaidAPI = {
|
||||||
render : exports.render,
|
render : exports.render,
|
||||||
parse : exports.parse,
|
parse : exports.parse,
|
||||||
initialize : exports.initialize,
|
initialize : exports.initialize,
|
||||||
detectType : utils.detectType
|
detectType : utils.detectType,
|
||||||
|
parseError : exports.parseError
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../package.json":86,"./d3":87,"./diagrams/example/exampleDb":88,"./diagrams/example/exampleRenderer":89,"./diagrams/example/parser/example":90,"./diagrams/flowchart/flowRenderer":92,"./diagrams/flowchart/graphDb":93,"./diagrams/flowchart/parser/dot":94,"./diagrams/flowchart/parser/flow":95,"./diagrams/gantt/ganttDb":96,"./diagrams/gantt/ganttRenderer":97,"./diagrams/gantt/parser/gantt":98,"./diagrams/sequenceDiagram/parser/sequenceDiagram":99,"./diagrams/sequenceDiagram/sequenceDb":100,"./diagrams/sequenceDiagram/sequenceRenderer":101,"./utils":105}],105:[function(require,module,exports){
|
},{"../package.json":86,"./d3":87,"./diagrams/example/exampleDb":88,"./diagrams/example/exampleRenderer":89,"./diagrams/example/parser/example":90,"./diagrams/flowchart/flowRenderer":92,"./diagrams/flowchart/graphDb":93,"./diagrams/flowchart/parser/dot":94,"./diagrams/flowchart/parser/flow":95,"./diagrams/gantt/ganttDb":96,"./diagrams/gantt/ganttRenderer":97,"./diagrams/gantt/parser/gantt":98,"./diagrams/sequenceDiagram/parser/sequenceDiagram":99,"./diagrams/sequenceDiagram/sequenceDb":100,"./diagrams/sequenceDiagram/sequenceRenderer":101,"./logger":104,"./utils":106}],106:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
var log = require('./logger').create();
|
||||||
/**
|
/**
|
||||||
|
* @function detectType
|
||||||
* Detects the type of the graph text.
|
* Detects the type of the graph text.
|
||||||
|
* ```mermaid
|
||||||
|
* graph LR
|
||||||
|
* a-->b
|
||||||
|
* b-->c
|
||||||
|
* c-->d
|
||||||
|
* d-->e
|
||||||
|
* e-->f
|
||||||
|
* f-->g
|
||||||
|
* g-->h
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @param {string} text The text defining the graph
|
* @param {string} text The text defining the graph
|
||||||
* @param {string} text The second text defining the graph
|
* @param {string} text The second text defining the graph
|
||||||
* @returns {string} A graph definition key
|
* @returns {string} A graph definition key
|
||||||
|
@ -32018,22 +32182,27 @@ module.exports.detectType = function(text,a){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*sequence/)){
|
if(text.match(/^\s*sequence/)){
|
||||||
//console.log('Detected sequence syntax');
|
/* ```mermaid
|
||||||
|
graph TB
|
||||||
|
a-->b
|
||||||
|
b-->c
|
||||||
|
```
|
||||||
|
*/
|
||||||
return "sequence";
|
return "sequence";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*digraph/)) {
|
if(text.match(/^\s*digraph/)) {
|
||||||
//console.log('Detected dot syntax');
|
//log.debug('Detected dot syntax');
|
||||||
return "dotGraph";
|
return "dotGraph";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*info/)) {
|
if(text.match(/^\s*info/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "info";
|
return "info";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*gantt/)) {
|
if(text.match(/^\s*gantt/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "gantt";
|
return "gantt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32126,4 +32295,4 @@ module.exports.cloneCssStyles = function(svg, classes){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}]},{},[103])
|
},{"./logger":104}]},{},[103])
|
File diff suppressed because one or more lines are too long
|
@ -15833,19 +15833,19 @@ module.exports={
|
||||||
|
|
||||||
},{}],86:[function(require,module,exports){
|
},{}],86:[function(require,module,exports){
|
||||||
/* global window */
|
/* global window */
|
||||||
//console.log('Setting up d3');
|
//log.debug('Setting up d3');
|
||||||
var d3;
|
var d3;
|
||||||
|
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
d3 = require("d3");
|
d3 = require("d3");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Exception ... but ok');
|
//log.debug('Exception ... but ok');
|
||||||
//console.log(e);
|
//log.debug(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(d3);
|
//log.debug(d3);
|
||||||
|
|
||||||
if (!d3) {
|
if (!d3) {
|
||||||
//if(typeof window !== 'undefined')
|
//if(typeof window !== 'undefined')
|
||||||
|
@ -15856,10 +15856,10 @@ if (!d3) {
|
||||||
// window = {};
|
// window = {};
|
||||||
// window.d3 = d3;
|
// window.d3 = d3;
|
||||||
//}
|
//}
|
||||||
//console.log('window');
|
//log.debug('window');
|
||||||
//console.log(window);
|
//log.debug(window);
|
||||||
module.exports = d3;
|
module.exports = d3;
|
||||||
|
/* jshint ignore:start */
|
||||||
/*
|
/*
|
||||||
|
|
||||||
D3 Text Wrap
|
D3 Text Wrap
|
||||||
|
@ -16314,11 +16314,12 @@ Detailed instructions at http://www.github.com/vijithassar/d3textwrap
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
/* jshint ignore:end */
|
||||||
},{"d3":"tokjIE"}],87:[function(require,module,exports){
|
},{"d3":"tokjIE"}],87:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var message = '';
|
var message = '';
|
||||||
var info = false;
|
var info = false;
|
||||||
|
|
||||||
|
@ -16339,16 +16340,16 @@ exports.getInfo = function(){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{}],88:[function(require,module,exports){
|
},{"../../logger":103}],88:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-11.
|
* Created by knut on 14-12-11.
|
||||||
*/
|
*/
|
||||||
var db = require('./exampleDb');
|
var db = require('./exampleDb');
|
||||||
var exampleParser = require('./parser/example.js');
|
var exampleParser = require('./parser/example.js');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
/**
|
/**
|
||||||
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
||||||
* @param text
|
* @param text
|
||||||
|
@ -16386,7 +16387,7 @@ exports.draw = function (txt, id, ver) {
|
||||||
svg.attr("width", 400 );
|
svg.attr("width", 400 );
|
||||||
//svg.attr("viewBox", '0 0 300 150');
|
//svg.attr("viewBox", '0 0 300 150');
|
||||||
};
|
};
|
||||||
},{"../../d3":86,"./exampleDb":87,"./parser/example.js":89}],89:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./exampleDb":87,"./parser/example.js":89}],89:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -17015,14 +17016,14 @@ if (typeof module !== 'undefined' && require.main === module) {
|
||||||
}).call(this,require("1YiZ5S"))
|
}).call(this,require("1YiZ5S"))
|
||||||
},{"1YiZ5S":81,"fs":79,"path":80}],90:[function(require,module,exports){
|
},{"1YiZ5S":81,"fs":79,"path":80}],90:[function(require,module,exports){
|
||||||
/* global window */
|
/* global window */
|
||||||
|
var log = require('../../logger').create();
|
||||||
var dagreD3;
|
var dagreD3;
|
||||||
//console.log('setting up dagre-d3');
|
//log.debug('setting up dagre-d3');
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
dagreD3 = require("dagre-d3");
|
dagreD3 = require("dagre-d3");
|
||||||
//console.log('Got it (dagre-d3)');
|
//log.debug('Got it (dagre-d3)');
|
||||||
} catch (e) {console.log('Could not load dagre-d3');}
|
} catch (e) {log.debug('Could not load dagre-d3');}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dagreD3) {
|
if (!dagreD3) {
|
||||||
|
@ -17031,7 +17032,7 @@ if (!dagreD3) {
|
||||||
|
|
||||||
module.exports = dagreD3;
|
module.exports = dagreD3;
|
||||||
|
|
||||||
},{"dagre-d3":1}],91:[function(require,module,exports){
|
},{"../../logger":103,"dagre-d3":1}],91:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-11.
|
* Created by knut on 14-12-11.
|
||||||
*/
|
*/
|
||||||
|
@ -17040,6 +17041,8 @@ var flow = require('./parser/flow');
|
||||||
var dot = require('./parser/dot');
|
var dot = require('./parser/dot');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var dagreD3 = require('./dagre-d3');
|
var dagreD3 = require('./dagre-d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
};
|
};
|
||||||
module.exports.setConf = function(cnf){
|
module.exports.setConf = function(cnf){
|
||||||
|
@ -17083,7 +17086,7 @@ exports.addVertices = function (vert, g) {
|
||||||
*/
|
*/
|
||||||
var classStr = '';
|
var classStr = '';
|
||||||
|
|
||||||
//console.log(vertice.classes);
|
//log.debug(vertice.classes);
|
||||||
|
|
||||||
if(vertice.classes.length >0){
|
if(vertice.classes.length >0){
|
||||||
classStr = vertice.classes.join(" ");
|
classStr = vertice.classes.join(" ");
|
||||||
|
@ -17264,7 +17267,7 @@ exports.getClasses = function (text, isDot) {
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
exports.draw = function (text, id,isDot) {
|
exports.draw = function (text, id,isDot) {
|
||||||
|
log.debug('Drawing flowchart');
|
||||||
var parser;
|
var parser;
|
||||||
graph.clear();
|
graph.clear();
|
||||||
if(isDot){
|
if(isDot){
|
||||||
|
@ -17317,7 +17320,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
||||||
var vert = graph.getVertices();
|
var vert = graph.getVertices();
|
||||||
|
|
||||||
//console.log(vert);
|
//log.debug(vert);
|
||||||
var edges = graph.getEdges();
|
var edges = graph.getEdges();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -17328,7 +17331,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
d3.selectAll('cluster').append('text');
|
d3.selectAll('cluster').append('text');
|
||||||
|
|
||||||
for(j=0;j<subG.nodes.length;j++){
|
for(j=0;j<subG.nodes.length;j++){
|
||||||
//console.log('Setting node',subG.nodes[j],' to subgraph '+id);
|
//log.debug('Setting node',subG.nodes[j],' to subgraph '+id);
|
||||||
g.setParent(subG.nodes[j],subG.id);
|
g.setParent(subG.nodes[j],subG.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17472,7 +17475,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
|
|
||||||
if (subG.title !== 'undefined') {
|
if (subG.title !== 'undefined') {
|
||||||
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
||||||
//console.log('looking up: #' + id + ' #' + subG.id)
|
//log.debug('looking up: #' + id + ' #' + subG.id)
|
||||||
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
||||||
|
|
||||||
var xPos = clusterRects[0].x.baseVal.value;
|
var xPos = clusterRects[0].x.baseVal.value;
|
||||||
|
@ -17499,11 +17502,11 @@ exports.draw = function (text, id,isDot) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"../../d3":86,"./dagre-d3":90,"./graphDb":92,"./parser/dot":93,"./parser/flow":94}],92:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./dagre-d3":90,"./graphDb":92,"./parser/dot":93,"./parser/flow":94}],92:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-03.
|
* Created by knut on 14-11-03.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var vertices = {};
|
var vertices = {};
|
||||||
var edges = [];
|
var edges = [];
|
||||||
var classes = [];
|
var classes = [];
|
||||||
|
@ -17565,7 +17568,7 @@ exports.addVertex = function (id, text, type, style) {
|
||||||
* @param linktext
|
* @param linktext
|
||||||
*/
|
*/
|
||||||
exports.addLink = function (start, end, type, linktext) {
|
exports.addLink = function (start, end, type, linktext) {
|
||||||
//console.log('Got edge', start, end);
|
//log.debug('Got edge', start, end);
|
||||||
var edge = {start: start, end: end, type: undefined, text: ''};
|
var edge = {start: start, end: end, type: undefined, text: ''};
|
||||||
linktext = type.text;
|
linktext = type.text;
|
||||||
|
|
||||||
|
@ -17660,7 +17663,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
//console.log('Checking now for ::'+id);
|
//log.debug('Checking now for ::'+id);
|
||||||
if(typeof vertices[id] !== 'undefined'){
|
if(typeof vertices[id] !== 'undefined'){
|
||||||
funs.push(function(){
|
funs.push(function(){
|
||||||
var elem = document.getElementById(id);
|
var elem = document.getElementById(id);
|
||||||
|
@ -17668,7 +17671,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//console.log('id was null: '+id);
|
//log.debug('id was null: '+id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17753,8 +17756,8 @@ exports.addSubGraph = function (list, title) {
|
||||||
|
|
||||||
|
|
||||||
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
||||||
//console.log('subGraph:' + subGraph.title + subGraph.id);
|
//log.debug('subGraph:' + subGraph.title + subGraph.id);
|
||||||
//console.log(subGraph.nodes);
|
//log.debug(subGraph.nodes);
|
||||||
subGraphs.push(subGraph);
|
subGraphs.push(subGraph);
|
||||||
subCount = subCount + 1;
|
subCount = subCount + 1;
|
||||||
return subGraph.id;
|
return subGraph.id;
|
||||||
|
@ -17764,11 +17767,11 @@ var getPosForId = function(id){
|
||||||
var i;
|
var i;
|
||||||
for(i=0;i<subGraphs.length;i++){
|
for(i=0;i<subGraphs.length;i++){
|
||||||
if(subGraphs[i].id===id){
|
if(subGraphs[i].id===id){
|
||||||
//console.log('Found pos for ',id,' ',i);
|
//log.debug('Found pos for ',id,' ',i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log('No pos found for ',id,' ',i);
|
//log.debug('No pos found for ',id,' ',i);
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
var secCount = -1;
|
var secCount = -1;
|
||||||
|
@ -17834,9 +17837,9 @@ exports.getSubGraphs = function (list) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{}],93:[function(require,module,exports){
|
},{"../../logger":103}],93:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -19504,6 +19507,7 @@ if (typeof module !== 'undefined' && require.main === module) {
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var dateFormat = '';
|
var dateFormat = '';
|
||||||
var title = '';
|
var title = '';
|
||||||
|
@ -19561,8 +19565,8 @@ exports.getTasks=function(){
|
||||||
|
|
||||||
|
|
||||||
var getStartDate = function(prevTime, dateFormat, str){
|
var getStartDate = function(prevTime, dateFormat, str){
|
||||||
//console.log('Deciding start date:'+str);
|
//log.debug('Deciding start date:'+str);
|
||||||
//console.log('with dateformat:'+dateFormat);
|
//log.debug('with dateformat:'+dateFormat);
|
||||||
|
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
|
|
||||||
|
@ -19583,9 +19587,9 @@ var getStartDate = function(prevTime, dateFormat, str){
|
||||||
if(moment(str,dateFormat.trim(),true).isValid()){
|
if(moment(str,dateFormat.trim(),true).isValid()){
|
||||||
return moment(str,dateFormat.trim(),true).toDate();
|
return moment(str,dateFormat.trim(),true).toDate();
|
||||||
}else{
|
}else{
|
||||||
console.log('Invalid date:'+str);
|
log.debug('Invalid date:'+str);
|
||||||
console.log('With date format:'+dateFormat.trim());
|
log.debug('With date format:'+dateFormat.trim());
|
||||||
//console.log('----');
|
//log.debug('----');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default date - now
|
// Default date - now
|
||||||
|
@ -19732,14 +19736,14 @@ exports.addTask = function(descr,data){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{"moment":84}],96:[function(require,module,exports){
|
},{"../../logger":103,"moment":84}],96:[function(require,module,exports){
|
||||||
var gantt = require('./parser/gantt').parser;
|
var gantt = require('./parser/gantt').parser;
|
||||||
gantt.yy = require('./ganttDb');
|
gantt.yy = require('./ganttDb');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var daysInChart;
|
var daysInChart;
|
||||||
var conf = {
|
var conf = {
|
||||||
|
@ -20102,7 +20106,7 @@ module.exports.draw = function (text, id) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
for (var j = 0; j < i; j++) {
|
for (var j = 0; j < i; j++) {
|
||||||
prevGap += numOccurances[i - 1][1];
|
prevGap += numOccurances[i - 1][1];
|
||||||
// console.log(prevGap);
|
// log.debug(prevGap);
|
||||||
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -20162,7 +20166,7 @@ module.exports.draw = function (text, id) {
|
||||||
return getCounts(arr)[word] || 0;
|
return getCounts(arr)[word] || 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},{"../../d3":86,"./ganttDb":95,"./parser/gantt":97,"moment":84}],97:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./ganttDb":95,"./parser/gantt":97,"moment":84}],97:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -21567,15 +21571,15 @@ var actors = {};
|
||||||
var actorKeys = [];
|
var actorKeys = [];
|
||||||
var messages = [];
|
var messages = [];
|
||||||
var notes = [];
|
var notes = [];
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
|
|
||||||
exports.addActor = function(id,name,description){
|
exports.addActor = function(id,name,description){
|
||||||
//console.log('Adding actor: '+id);
|
|
||||||
actors[id] = {name:name, description:description};
|
actors[id] = {name:name, description:description};
|
||||||
actorKeys.push(id);
|
actorKeys.push(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.addMessage = function(idFrom, idTo, message, answer){
|
exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
|
||||||
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21583,7 +21587,7 @@ exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
exports.addSignal = function(idFrom, idTo, message, messageType){
|
exports.addSignal = function(idFrom, idTo, message, messageType){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
log.debug('Adding message from='+idFrom+' to='+idTo+' message='+message+' type='+messageType);
|
||||||
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21643,7 +21647,7 @@ exports.addNote = function (actor, placement, message){
|
||||||
|
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.apply = function(param){
|
exports.apply = function(param){
|
||||||
|
@ -21652,7 +21656,7 @@ exports.apply = function(param){
|
||||||
exports.apply(item);
|
exports.apply(item);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// console.log(param);
|
// log.debug(param);
|
||||||
switch(param.type){
|
switch(param.type){
|
||||||
case 'addActor':
|
case 'addActor':
|
||||||
exports.addActor(param.actor, param.actor, param.actor);
|
exports.addActor(param.actor, param.actor, param.actor);
|
||||||
|
@ -21664,7 +21668,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'loopStart':
|
case 'loopStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -21672,7 +21676,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'optStart':
|
case 'optStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -21680,7 +21684,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'altStart':
|
case 'altStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -21691,11 +21695,9 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('xxx',param);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},{}],100:[function(require,module,exports){
|
},{"../../logger":103}],100:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
@ -21704,6 +21706,8 @@ var sq = require('./parser/sequenceDiagram').parser;
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
var svgDraw = require('./svgDraw');
|
var svgDraw = require('./svgDraw');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
|
|
||||||
diagramMarginX:50,
|
diagramMarginX:50,
|
||||||
|
@ -22078,7 +22082,7 @@ module.exports.draw = function (text, id) {
|
||||||
if(conf.useMaxWidth) {
|
if(conf.useMaxWidth) {
|
||||||
diagram.attr("height", '100%');
|
diagram.attr("height", '100%');
|
||||||
diagram.attr("width", '100%');
|
diagram.attr("width", '100%');
|
||||||
diagram.attr('style', 'max-width:' + (width) + 'px;')
|
diagram.attr('style', 'max-width:' + (width) + 'px;');
|
||||||
}else{
|
}else{
|
||||||
diagram.attr("height",height);
|
diagram.attr("height",height);
|
||||||
diagram.attr("width", width );
|
diagram.attr("width", width );
|
||||||
|
@ -22086,10 +22090,11 @@ module.exports.draw = function (text, id) {
|
||||||
diagram.attr("viewBox", (box.startx-conf.diagramMarginX) + ' -' +conf.diagramMarginY + ' ' + width + ' ' + height);
|
diagram.attr("viewBox", (box.startx-conf.diagramMarginX) + ' -' +conf.diagramMarginY + ' ' + width + ' ' + height);
|
||||||
};
|
};
|
||||||
|
|
||||||
},{"../../d3":86,"./parser/sequenceDiagram":98,"./sequenceDb":99,"./svgDraw":101}],101:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./parser/sequenceDiagram":98,"./sequenceDb":99,"./svgDraw":101}],101:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-20.
|
* Created by knut on 14-12-20.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
exports.drawRect = function(elem , rectData){
|
exports.drawRect = function(elem , rectData){
|
||||||
var rectElem = elem.append("rect");
|
var rectElem = elem.append("rect");
|
||||||
rectElem.attr("x", rectData.x);
|
rectElem.attr("x", rectData.x);
|
||||||
|
@ -22334,14 +22339,20 @@ exports.getNoteRect = function(){
|
||||||
return rect;
|
return rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}],102:[function(require,module,exports){
|
},{"../../logger":103}],102:[function(require,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
|
/**
|
||||||
|
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
|
||||||
|
* the diagrams to svg code.
|
||||||
|
*/
|
||||||
var he = require('he');
|
var he = require('he');
|
||||||
var mermaidAPI = require('./mermaidAPI');
|
var mermaidAPI = require('./mermaidAPI');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
module.exports.mermaidAPI = mermaidAPI;
|
module.exports.mermaidAPI = mermaidAPI;
|
||||||
/**
|
/**
|
||||||
|
* ## init
|
||||||
* Function that goes through the document to find the chart definitions in there and render them.
|
* Function that goes through the document to find the chart definitions in there and render them.
|
||||||
*
|
*
|
||||||
* The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
* The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
||||||
|
@ -22352,21 +22363,19 @@ module.exports.mermaidAPI = mermaidAPI;
|
||||||
* - an array of DOM nodes (as would come from a jQuery selector)
|
* - an array of DOM nodes (as would come from a jQuery selector)
|
||||||
* - a W3C selector, a la `.mermaid`
|
* - a W3C selector, a la `.mermaid`
|
||||||
*
|
*
|
||||||
* ```
|
* ```mermaid
|
||||||
* graph LR;
|
* graph LR;
|
||||||
* a(Find elements)-->b{Processed};
|
* a(Find elements)-->b{Processed}
|
||||||
* b-->|Yes|c(Leave element);
|
* b-->|Yes|c(Leave element)
|
||||||
* c-->|No |d(Transform);
|
* b-->|No |d(Transform)
|
||||||
* ```
|
* ```
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Renders the mermaid diagrams
|
* Renders the mermaid diagrams
|
||||||
* @* param nodes- a css selector or an array of nodes
|
* @param nodes a css selector or an array of nodes
|
||||||
*/
|
*/
|
||||||
var init = function () {
|
var init = function () {
|
||||||
var nodes;
|
var nodes;
|
||||||
if(arguments.length === 2){
|
if(arguments.length === 2){
|
||||||
// sequence config was passed as #1
|
/*! sequence config was passed as #1 */
|
||||||
if(typeof arguments[0] !== 'undefined'){
|
if(typeof arguments[0] !== 'undefined'){
|
||||||
mermaid.sequenceConfig = arguments[0];
|
mermaid.sequenceConfig = arguments[0];
|
||||||
}
|
}
|
||||||
|
@ -22380,7 +22389,7 @@ var init = function () {
|
||||||
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
||||||
: typeof nodes === "string" ? document.querySelectorAll(nodes)
|
: typeof nodes === "string" ? document.querySelectorAll(nodes)
|
||||||
: nodes instanceof Node ? [nodes]
|
: nodes instanceof Node ? [nodes]
|
||||||
// Last case - sequence config was passed pick next
|
/*! Last case - sequence config was passed pick next */
|
||||||
: nodes;
|
: nodes;
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
|
@ -22389,7 +22398,15 @@ var init = function () {
|
||||||
mermaidAPI.initialize(mermaid_config);
|
mermaidAPI.initialize(mermaid_config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug('STar On Load (0): '+mermaid.startOnLoad);
|
||||||
|
if(typeof mermaid.startOnLoad !== 'undefined'){
|
||||||
|
log.debug('STar On Load: '+mermaid.startOnLoad);
|
||||||
|
mermaidAPI.initialize({startOnLoad:mermaid.startOnLoad});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(typeof mermaid.ganttConfig !== 'undefined'){
|
if(typeof mermaid.ganttConfig !== 'undefined'){
|
||||||
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
|
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
|
||||||
}
|
}
|
||||||
|
@ -22401,7 +22418,7 @@ var init = function () {
|
||||||
for (i = 0; i < nodes.length; i++) {
|
for (i = 0; i < nodes.length; i++) {
|
||||||
var element = nodes[i];
|
var element = nodes[i];
|
||||||
|
|
||||||
// Check if previously processed
|
/*! Check if previously processed */
|
||||||
if(!element.getAttribute("data-processed")) {
|
if(!element.getAttribute("data-processed")) {
|
||||||
element.setAttribute("data-processed", true);
|
element.setAttribute("data-processed", true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -22421,11 +22438,10 @@ var init = function () {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.tester = function(){};
|
|
||||||
|
|
||||||
exports.init = init;
|
exports.init = init;
|
||||||
|
exports.parse = mermaidAPI.parse;
|
||||||
/**
|
/**
|
||||||
|
* ## version
|
||||||
* Function returning version information
|
* Function returning version information
|
||||||
* @returns {string} A string containing the version info
|
* @returns {string} A string containing the version info
|
||||||
*/
|
*/
|
||||||
|
@ -22433,10 +22449,16 @@ exports.version = function(){
|
||||||
return 'v'+require('../package.json').version;
|
return 'v'+require('../package.json').version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## initialize
|
||||||
|
* This function overrides the default configuration.
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
exports.initialize = function(config){
|
exports.initialize = function(config){
|
||||||
mermaidAPI.initialize(config);
|
mermaidAPI.initialize(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var equals = function (val, variable){
|
var equals = function (val, variable){
|
||||||
if(typeof variable === 'undefined'){
|
if(typeof variable === 'undefined'){
|
||||||
return false;
|
return false;
|
||||||
|
@ -22446,6 +22468,15 @@ var equals = function (val, variable){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global mermaid object. Contains the functions:
|
||||||
|
* * init
|
||||||
|
* * initialize
|
||||||
|
* * version
|
||||||
|
* * parse
|
||||||
|
* * parseError
|
||||||
|
* * render
|
||||||
|
*/
|
||||||
global.mermaid = {
|
global.mermaid = {
|
||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
htmlLabels: true,
|
htmlLabels: true,
|
||||||
|
@ -22463,14 +22494,26 @@ global.mermaid = {
|
||||||
return mermaidAPI.parse(text);
|
return mermaidAPI.parse(text);
|
||||||
},
|
},
|
||||||
parseError: function(err, hash) {
|
parseError: function(err, hash) {
|
||||||
console.log('Mermaid Syntax error:');
|
log.debug('Mermaid Syntax error:');
|
||||||
console.log(err);
|
log.debug(err);
|
||||||
},
|
},
|
||||||
render:function(id, text,callback, element){
|
render:function(id, text,callback, element){
|
||||||
return mermaidAPI.render(id, text,callback, element);
|
return mermaidAPI.render(id, text,callback, element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## parseError
|
||||||
|
* This function overrides the default configuration.
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
|
exports.parseError = global.mermaid.parseError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ##contentLoaded
|
||||||
|
* Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
|
||||||
|
* calls init for rendering the mermaid diagrams on the page.
|
||||||
|
*/
|
||||||
exports.contentLoaded = function(){
|
exports.contentLoaded = function(){
|
||||||
var config;
|
var config;
|
||||||
// Check state of start config mermaid namespace
|
// Check state of start config mermaid namespace
|
||||||
|
@ -22481,7 +22524,6 @@ exports.contentLoaded = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(global.mermaid.startOnLoad) {
|
if(global.mermaid.startOnLoad) {
|
||||||
|
|
||||||
// For backwards compatability reasons also check mermaid_config variable
|
// For backwards compatability reasons also check mermaid_config variable
|
||||||
if (typeof mermaid_config !== 'undefined') {
|
if (typeof mermaid_config !== 'undefined') {
|
||||||
// Check if property startOnLoad is set
|
// Check if property startOnLoad is set
|
||||||
|
@ -22490,6 +22532,7 @@ exports.contentLoaded = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
mermaidAPI.initialize({startOnLoad:global.mermaid.startOnLoad});
|
||||||
// No config found, do check API config
|
// No config found, do check API config
|
||||||
config = mermaidAPI.getConfig();
|
config = mermaidAPI.getConfig();
|
||||||
if(config.startOnLoad){
|
if(config.startOnLoad){
|
||||||
|
@ -22509,7 +22552,7 @@ exports.contentLoaded = function(){
|
||||||
|
|
||||||
|
|
||||||
if(typeof document !== 'undefined'){
|
if(typeof document !== 'undefined'){
|
||||||
/**
|
/*!
|
||||||
* Wait for document loaded before starting the execution
|
* Wait for document loaded before starting the execution
|
||||||
*/
|
*/
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
document.addEventListener('DOMContentLoaded', function(){
|
||||||
|
@ -22518,7 +22561,104 @@ if(typeof document !== 'undefined'){
|
||||||
}
|
}
|
||||||
|
|
||||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../package.json":85,"./mermaidAPI":103,"he":82}],103:[function(require,module,exports){
|
},{"../package.json":85,"./logger":103,"./mermaidAPI":104,"he":82}],103:[function(require,module,exports){
|
||||||
|
(function (process){
|
||||||
|
/**
|
||||||
|
* #logger
|
||||||
|
* logger = require('logger').create()
|
||||||
|
* logger.info("blah")
|
||||||
|
* => [2011-3-3T20:24:4.810 info (5021)] blah
|
||||||
|
* logger.debug("boom")
|
||||||
|
* =>
|
||||||
|
* logger.level = Logger.levels.debug
|
||||||
|
* logger.debug(function() { return "booom" })
|
||||||
|
* => [2011-3-3T20:24:4.810 error (5021)] booom
|
||||||
|
*/
|
||||||
|
var Logger;
|
||||||
|
|
||||||
|
Logger = (function() {
|
||||||
|
function Logger(options) {
|
||||||
|
var level, num, ref;
|
||||||
|
this.options = options || {};
|
||||||
|
this.level = this.options.level || Logger.levels.default;
|
||||||
|
ref = Logger.levels;
|
||||||
|
for (level in ref) {
|
||||||
|
num = ref[level];
|
||||||
|
Logger.define(this, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.add = function(level, message, callback) {
|
||||||
|
if (this.level > (Logger.levels[level] || 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
message = callback();
|
||||||
|
} else if (typeof message === 'function') {
|
||||||
|
message = message();
|
||||||
|
}
|
||||||
|
return this.write({
|
||||||
|
timestamp: new Date,
|
||||||
|
severity: level,
|
||||||
|
message: message,
|
||||||
|
pid: process.pid
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function formatTime(timestamp){
|
||||||
|
var hh = timestamp.getUTCHours();
|
||||||
|
var mm = timestamp.getUTCMinutes();
|
||||||
|
var ss = timestamp.getSeconds();
|
||||||
|
var ms = timestamp.getMilliseconds();
|
||||||
|
// If you were building a timestamp instead of a duration, you would uncomment the following line to get 12-hour (not 24) time
|
||||||
|
// if (hh > 12) {hh = hh % 12;}
|
||||||
|
// These lines ensure you have two-digits
|
||||||
|
if (hh < 10) {hh = "0"+hh;}
|
||||||
|
if (mm < 10) {mm = "0"+mm;}
|
||||||
|
if (ss < 10) {ss = "0"+ss;}
|
||||||
|
if (ms < 100){ms = "0"+ms;}
|
||||||
|
if (ms < 10) {ms = "00"+ms;}
|
||||||
|
// This formats your string to HH:MM:SS
|
||||||
|
var t = hh+":"+mm+":"+ss +' ('+ms+')';
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.write = function(options) {
|
||||||
|
if(typeof console !== 'undefined'){
|
||||||
|
if(typeof log.debug !== 'undefined'){
|
||||||
|
return log.debug(this.build_message(options));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.prototype.build_message = function(options) {
|
||||||
|
return "[" + formatTime(options.timestamp) + "] " + options.message;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Logger;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
Logger.define = function(logger, level) {
|
||||||
|
return logger[level] = function(message, callback) {
|
||||||
|
return this.add(level, message, callback);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.levels = {
|
||||||
|
debug: 1,
|
||||||
|
info: 2,
|
||||||
|
warn: 3,
|
||||||
|
error: 4,
|
||||||
|
fatal: 5,
|
||||||
|
default:3
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.create = function(type, options) {
|
||||||
|
return new Logger(options);
|
||||||
|
};
|
||||||
|
}).call(this,require("1YiZ5S"))
|
||||||
|
},{"1YiZ5S":81}],104:[function(require,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var graph = require('./diagrams/flowchart/graphDb');
|
var graph = require('./diagrams/flowchart/graphDb');
|
||||||
var flow = require('./diagrams/flowchart/parser/flow');
|
var flow = require('./diagrams/flowchart/parser/flow');
|
||||||
|
@ -22537,6 +22677,7 @@ var ganttParser = require('./diagrams/gantt/parser/gantt');
|
||||||
var ganttDb = require('./diagrams/gantt/ganttDb');
|
var ganttDb = require('./diagrams/gantt/ganttDb');
|
||||||
var d3 = require('./d3');
|
var d3 = require('./d3');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
// Default options, can be overridden at initialization time
|
// Default options, can be overridden at initialization time
|
||||||
/**
|
/**
|
||||||
|
@ -22756,7 +22897,7 @@ var setConf = function(cnf){
|
||||||
|
|
||||||
var j;
|
var j;
|
||||||
for(j=0;j<lvl2Keys.length;j++) {
|
for(j=0;j<lvl2Keys.length;j++) {
|
||||||
//console.log('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
//log.debug('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
||||||
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
||||||
|
|
||||||
config[lvl1Keys[i]] = {};
|
config[lvl1Keys[i]] = {};
|
||||||
|
@ -22778,20 +22919,43 @@ exports.initialize = function(options){
|
||||||
exports.getConfig = function(){
|
exports.getConfig = function(){
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.parseError = function(err, hash) {
|
||||||
|
if(typeof mermaid !== 'undefined') {
|
||||||
|
mermaid.parseError(err,hash);
|
||||||
|
}else{
|
||||||
|
log.debug('Mermaid Syntax error:');
|
||||||
|
log.debug(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
global.mermaidAPI = {
|
global.mermaidAPI = {
|
||||||
render : exports.render,
|
render : exports.render,
|
||||||
parse : exports.parse,
|
parse : exports.parse,
|
||||||
initialize : exports.initialize,
|
initialize : exports.initialize,
|
||||||
detectType : utils.detectType
|
detectType : utils.detectType,
|
||||||
|
parseError : exports.parseError
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../package.json":85,"./d3":86,"./diagrams/example/exampleDb":87,"./diagrams/example/exampleRenderer":88,"./diagrams/example/parser/example":89,"./diagrams/flowchart/flowRenderer":91,"./diagrams/flowchart/graphDb":92,"./diagrams/flowchart/parser/dot":93,"./diagrams/flowchart/parser/flow":94,"./diagrams/gantt/ganttDb":95,"./diagrams/gantt/ganttRenderer":96,"./diagrams/gantt/parser/gantt":97,"./diagrams/sequenceDiagram/parser/sequenceDiagram":98,"./diagrams/sequenceDiagram/sequenceDb":99,"./diagrams/sequenceDiagram/sequenceRenderer":100,"./utils":104}],104:[function(require,module,exports){
|
},{"../package.json":85,"./d3":86,"./diagrams/example/exampleDb":87,"./diagrams/example/exampleRenderer":88,"./diagrams/example/parser/example":89,"./diagrams/flowchart/flowRenderer":91,"./diagrams/flowchart/graphDb":92,"./diagrams/flowchart/parser/dot":93,"./diagrams/flowchart/parser/flow":94,"./diagrams/gantt/ganttDb":95,"./diagrams/gantt/ganttRenderer":96,"./diagrams/gantt/parser/gantt":97,"./diagrams/sequenceDiagram/parser/sequenceDiagram":98,"./diagrams/sequenceDiagram/sequenceDb":99,"./diagrams/sequenceDiagram/sequenceRenderer":100,"./logger":103,"./utils":105}],105:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
var log = require('./logger').create();
|
||||||
/**
|
/**
|
||||||
|
* @function detectType
|
||||||
* Detects the type of the graph text.
|
* Detects the type of the graph text.
|
||||||
|
* ```mermaid
|
||||||
|
* graph LR
|
||||||
|
* a-->b
|
||||||
|
* b-->c
|
||||||
|
* c-->d
|
||||||
|
* d-->e
|
||||||
|
* e-->f
|
||||||
|
* f-->g
|
||||||
|
* g-->h
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @param {string} text The text defining the graph
|
* @param {string} text The text defining the graph
|
||||||
* @param {string} text The second text defining the graph
|
* @param {string} text The second text defining the graph
|
||||||
* @returns {string} A graph definition key
|
* @returns {string} A graph definition key
|
||||||
|
@ -22802,22 +22966,27 @@ module.exports.detectType = function(text,a){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*sequence/)){
|
if(text.match(/^\s*sequence/)){
|
||||||
//console.log('Detected sequence syntax');
|
/* ```mermaid
|
||||||
|
graph TB
|
||||||
|
a-->b
|
||||||
|
b-->c
|
||||||
|
```
|
||||||
|
*/
|
||||||
return "sequence";
|
return "sequence";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*digraph/)) {
|
if(text.match(/^\s*digraph/)) {
|
||||||
//console.log('Detected dot syntax');
|
//log.debug('Detected dot syntax');
|
||||||
return "dotGraph";
|
return "dotGraph";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*info/)) {
|
if(text.match(/^\s*info/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "info";
|
return "info";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*gantt/)) {
|
if(text.match(/^\s*gantt/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "gantt";
|
return "gantt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22910,4 +23079,4 @@ module.exports.cloneCssStyles = function(svg, classes){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}]},{},[102])
|
},{"./logger":103}]},{},[102])
|
File diff suppressed because one or more lines are too long
|
@ -24716,19 +24716,19 @@ module.exports={
|
||||||
|
|
||||||
},{}],86:[function(require,module,exports){
|
},{}],86:[function(require,module,exports){
|
||||||
/* global window */
|
/* global window */
|
||||||
//console.log('Setting up d3');
|
//log.debug('Setting up d3');
|
||||||
var d3;
|
var d3;
|
||||||
|
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
d3 = require("d3");
|
d3 = require("d3");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Exception ... but ok');
|
//log.debug('Exception ... but ok');
|
||||||
//console.log(e);
|
//log.debug(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(d3);
|
//log.debug(d3);
|
||||||
|
|
||||||
if (!d3) {
|
if (!d3) {
|
||||||
//if(typeof window !== 'undefined')
|
//if(typeof window !== 'undefined')
|
||||||
|
@ -24739,10 +24739,10 @@ if (!d3) {
|
||||||
// window = {};
|
// window = {};
|
||||||
// window.d3 = d3;
|
// window.d3 = d3;
|
||||||
//}
|
//}
|
||||||
//console.log('window');
|
//log.debug('window');
|
||||||
//console.log(window);
|
//log.debug(window);
|
||||||
module.exports = d3;
|
module.exports = d3;
|
||||||
|
/* jshint ignore:start */
|
||||||
/*
|
/*
|
||||||
|
|
||||||
D3 Text Wrap
|
D3 Text Wrap
|
||||||
|
@ -25197,11 +25197,12 @@ Detailed instructions at http://www.github.com/vijithassar/d3textwrap
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
/* jshint ignore:end */
|
||||||
},{"d3":1}],87:[function(require,module,exports){
|
},{"d3":1}],87:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var message = '';
|
var message = '';
|
||||||
var info = false;
|
var info = false;
|
||||||
|
|
||||||
|
@ -25222,16 +25223,16 @@ exports.getInfo = function(){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{}],88:[function(require,module,exports){
|
},{"../../logger":103}],88:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-11.
|
* Created by knut on 14-12-11.
|
||||||
*/
|
*/
|
||||||
var db = require('./exampleDb');
|
var db = require('./exampleDb');
|
||||||
var exampleParser = require('./parser/example.js');
|
var exampleParser = require('./parser/example.js');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
/**
|
/**
|
||||||
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
||||||
* @param text
|
* @param text
|
||||||
|
@ -25269,7 +25270,7 @@ exports.draw = function (txt, id, ver) {
|
||||||
svg.attr("width", 400 );
|
svg.attr("width", 400 );
|
||||||
//svg.attr("viewBox", '0 0 300 150');
|
//svg.attr("viewBox", '0 0 300 150');
|
||||||
};
|
};
|
||||||
},{"../../d3":86,"./exampleDb":87,"./parser/example.js":89}],89:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./exampleDb":87,"./parser/example.js":89}],89:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -25898,14 +25899,14 @@ if (typeof module !== 'undefined' && require.main === module) {
|
||||||
}).call(this,require("1YiZ5S"))
|
}).call(this,require("1YiZ5S"))
|
||||||
},{"1YiZ5S":82,"fs":80,"path":81}],90:[function(require,module,exports){
|
},{"1YiZ5S":82,"fs":80,"path":81}],90:[function(require,module,exports){
|
||||||
/* global window */
|
/* global window */
|
||||||
|
var log = require('../../logger').create();
|
||||||
var dagreD3;
|
var dagreD3;
|
||||||
//console.log('setting up dagre-d3');
|
//log.debug('setting up dagre-d3');
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
dagreD3 = require("dagre-d3");
|
dagreD3 = require("dagre-d3");
|
||||||
//console.log('Got it (dagre-d3)');
|
//log.debug('Got it (dagre-d3)');
|
||||||
} catch (e) {console.log('Could not load dagre-d3');}
|
} catch (e) {log.debug('Could not load dagre-d3');}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dagreD3) {
|
if (!dagreD3) {
|
||||||
|
@ -25914,7 +25915,7 @@ if (!dagreD3) {
|
||||||
|
|
||||||
module.exports = dagreD3;
|
module.exports = dagreD3;
|
||||||
|
|
||||||
},{"dagre-d3":2}],91:[function(require,module,exports){
|
},{"../../logger":103,"dagre-d3":2}],91:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-11.
|
* Created by knut on 14-12-11.
|
||||||
*/
|
*/
|
||||||
|
@ -25923,6 +25924,8 @@ var flow = require('./parser/flow');
|
||||||
var dot = require('./parser/dot');
|
var dot = require('./parser/dot');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var dagreD3 = require('./dagre-d3');
|
var dagreD3 = require('./dagre-d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
};
|
};
|
||||||
module.exports.setConf = function(cnf){
|
module.exports.setConf = function(cnf){
|
||||||
|
@ -25966,7 +25969,7 @@ exports.addVertices = function (vert, g) {
|
||||||
*/
|
*/
|
||||||
var classStr = '';
|
var classStr = '';
|
||||||
|
|
||||||
//console.log(vertice.classes);
|
//log.debug(vertice.classes);
|
||||||
|
|
||||||
if(vertice.classes.length >0){
|
if(vertice.classes.length >0){
|
||||||
classStr = vertice.classes.join(" ");
|
classStr = vertice.classes.join(" ");
|
||||||
|
@ -26147,7 +26150,7 @@ exports.getClasses = function (text, isDot) {
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
exports.draw = function (text, id,isDot) {
|
exports.draw = function (text, id,isDot) {
|
||||||
|
log.debug('Drawing flowchart');
|
||||||
var parser;
|
var parser;
|
||||||
graph.clear();
|
graph.clear();
|
||||||
if(isDot){
|
if(isDot){
|
||||||
|
@ -26200,7 +26203,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
||||||
var vert = graph.getVertices();
|
var vert = graph.getVertices();
|
||||||
|
|
||||||
//console.log(vert);
|
//log.debug(vert);
|
||||||
var edges = graph.getEdges();
|
var edges = graph.getEdges();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -26211,7 +26214,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
d3.selectAll('cluster').append('text');
|
d3.selectAll('cluster').append('text');
|
||||||
|
|
||||||
for(j=0;j<subG.nodes.length;j++){
|
for(j=0;j<subG.nodes.length;j++){
|
||||||
//console.log('Setting node',subG.nodes[j],' to subgraph '+id);
|
//log.debug('Setting node',subG.nodes[j],' to subgraph '+id);
|
||||||
g.setParent(subG.nodes[j],subG.id);
|
g.setParent(subG.nodes[j],subG.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26355,7 +26358,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
|
|
||||||
if (subG.title !== 'undefined') {
|
if (subG.title !== 'undefined') {
|
||||||
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
||||||
//console.log('looking up: #' + id + ' #' + subG.id)
|
//log.debug('looking up: #' + id + ' #' + subG.id)
|
||||||
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
||||||
|
|
||||||
var xPos = clusterRects[0].x.baseVal.value;
|
var xPos = clusterRects[0].x.baseVal.value;
|
||||||
|
@ -26382,11 +26385,11 @@ exports.draw = function (text, id,isDot) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"../../d3":86,"./dagre-d3":90,"./graphDb":92,"./parser/dot":93,"./parser/flow":94}],92:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./dagre-d3":90,"./graphDb":92,"./parser/dot":93,"./parser/flow":94}],92:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-03.
|
* Created by knut on 14-11-03.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var vertices = {};
|
var vertices = {};
|
||||||
var edges = [];
|
var edges = [];
|
||||||
var classes = [];
|
var classes = [];
|
||||||
|
@ -26448,7 +26451,7 @@ exports.addVertex = function (id, text, type, style) {
|
||||||
* @param linktext
|
* @param linktext
|
||||||
*/
|
*/
|
||||||
exports.addLink = function (start, end, type, linktext) {
|
exports.addLink = function (start, end, type, linktext) {
|
||||||
//console.log('Got edge', start, end);
|
//log.debug('Got edge', start, end);
|
||||||
var edge = {start: start, end: end, type: undefined, text: ''};
|
var edge = {start: start, end: end, type: undefined, text: ''};
|
||||||
linktext = type.text;
|
linktext = type.text;
|
||||||
|
|
||||||
|
@ -26543,7 +26546,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
//console.log('Checking now for ::'+id);
|
//log.debug('Checking now for ::'+id);
|
||||||
if(typeof vertices[id] !== 'undefined'){
|
if(typeof vertices[id] !== 'undefined'){
|
||||||
funs.push(function(){
|
funs.push(function(){
|
||||||
var elem = document.getElementById(id);
|
var elem = document.getElementById(id);
|
||||||
|
@ -26551,7 +26554,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//console.log('id was null: '+id);
|
//log.debug('id was null: '+id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26636,8 +26639,8 @@ exports.addSubGraph = function (list, title) {
|
||||||
|
|
||||||
|
|
||||||
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
||||||
//console.log('subGraph:' + subGraph.title + subGraph.id);
|
//log.debug('subGraph:' + subGraph.title + subGraph.id);
|
||||||
//console.log(subGraph.nodes);
|
//log.debug(subGraph.nodes);
|
||||||
subGraphs.push(subGraph);
|
subGraphs.push(subGraph);
|
||||||
subCount = subCount + 1;
|
subCount = subCount + 1;
|
||||||
return subGraph.id;
|
return subGraph.id;
|
||||||
|
@ -26647,11 +26650,11 @@ var getPosForId = function(id){
|
||||||
var i;
|
var i;
|
||||||
for(i=0;i<subGraphs.length;i++){
|
for(i=0;i<subGraphs.length;i++){
|
||||||
if(subGraphs[i].id===id){
|
if(subGraphs[i].id===id){
|
||||||
//console.log('Found pos for ',id,' ',i);
|
//log.debug('Found pos for ',id,' ',i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log('No pos found for ',id,' ',i);
|
//log.debug('No pos found for ',id,' ',i);
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
var secCount = -1;
|
var secCount = -1;
|
||||||
|
@ -26717,9 +26720,9 @@ exports.getSubGraphs = function (list) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{}],93:[function(require,module,exports){
|
},{"../../logger":103}],93:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -28387,6 +28390,7 @@ if (typeof module !== 'undefined' && require.main === module) {
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var dateFormat = '';
|
var dateFormat = '';
|
||||||
var title = '';
|
var title = '';
|
||||||
|
@ -28444,8 +28448,8 @@ exports.getTasks=function(){
|
||||||
|
|
||||||
|
|
||||||
var getStartDate = function(prevTime, dateFormat, str){
|
var getStartDate = function(prevTime, dateFormat, str){
|
||||||
//console.log('Deciding start date:'+str);
|
//log.debug('Deciding start date:'+str);
|
||||||
//console.log('with dateformat:'+dateFormat);
|
//log.debug('with dateformat:'+dateFormat);
|
||||||
|
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
|
|
||||||
|
@ -28466,9 +28470,9 @@ var getStartDate = function(prevTime, dateFormat, str){
|
||||||
if(moment(str,dateFormat.trim(),true).isValid()){
|
if(moment(str,dateFormat.trim(),true).isValid()){
|
||||||
return moment(str,dateFormat.trim(),true).toDate();
|
return moment(str,dateFormat.trim(),true).toDate();
|
||||||
}else{
|
}else{
|
||||||
console.log('Invalid date:'+str);
|
log.debug('Invalid date:'+str);
|
||||||
console.log('With date format:'+dateFormat.trim());
|
log.debug('With date format:'+dateFormat.trim());
|
||||||
//console.log('----');
|
//log.debug('----');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default date - now
|
// Default date - now
|
||||||
|
@ -28615,14 +28619,14 @@ exports.addTask = function(descr,data){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
},{"moment":84}],96:[function(require,module,exports){
|
},{"../../logger":103,"moment":84}],96:[function(require,module,exports){
|
||||||
var gantt = require('./parser/gantt').parser;
|
var gantt = require('./parser/gantt').parser;
|
||||||
gantt.yy = require('./ganttDb');
|
gantt.yy = require('./ganttDb');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var daysInChart;
|
var daysInChart;
|
||||||
var conf = {
|
var conf = {
|
||||||
|
@ -28985,7 +28989,7 @@ module.exports.draw = function (text, id) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
for (var j = 0; j < i; j++) {
|
for (var j = 0; j < i; j++) {
|
||||||
prevGap += numOccurances[i - 1][1];
|
prevGap += numOccurances[i - 1][1];
|
||||||
// console.log(prevGap);
|
// log.debug(prevGap);
|
||||||
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -29045,7 +29049,7 @@ module.exports.draw = function (text, id) {
|
||||||
return getCounts(arr)[word] || 0;
|
return getCounts(arr)[word] || 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},{"../../d3":86,"./ganttDb":95,"./parser/gantt":97,"moment":84}],97:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./ganttDb":95,"./parser/gantt":97,"moment":84}],97:[function(require,module,exports){
|
||||||
(function (process){
|
(function (process){
|
||||||
/* parser generated by jison 0.4.15 */
|
/* parser generated by jison 0.4.15 */
|
||||||
/*
|
/*
|
||||||
|
@ -30450,15 +30454,15 @@ var actors = {};
|
||||||
var actorKeys = [];
|
var actorKeys = [];
|
||||||
var messages = [];
|
var messages = [];
|
||||||
var notes = [];
|
var notes = [];
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
|
|
||||||
exports.addActor = function(id,name,description){
|
exports.addActor = function(id,name,description){
|
||||||
//console.log('Adding actor: '+id);
|
|
||||||
actors[id] = {name:name, description:description};
|
actors[id] = {name:name, description:description};
|
||||||
actorKeys.push(id);
|
actorKeys.push(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.addMessage = function(idFrom, idTo, message, answer){
|
exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
|
||||||
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30466,7 +30470,7 @@ exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
exports.addSignal = function(idFrom, idTo, message, messageType){
|
exports.addSignal = function(idFrom, idTo, message, messageType){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
log.debug('Adding message from='+idFrom+' to='+idTo+' message='+message+' type='+messageType);
|
||||||
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30526,7 +30530,7 @@ exports.addNote = function (actor, placement, message){
|
||||||
|
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.apply = function(param){
|
exports.apply = function(param){
|
||||||
|
@ -30535,7 +30539,7 @@ exports.apply = function(param){
|
||||||
exports.apply(item);
|
exports.apply(item);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// console.log(param);
|
// log.debug(param);
|
||||||
switch(param.type){
|
switch(param.type){
|
||||||
case 'addActor':
|
case 'addActor':
|
||||||
exports.addActor(param.actor, param.actor, param.actor);
|
exports.addActor(param.actor, param.actor, param.actor);
|
||||||
|
@ -30547,7 +30551,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'loopStart':
|
case 'loopStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -30555,7 +30559,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'optStart':
|
case 'optStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -30563,7 +30567,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'altStart':
|
case 'altStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -30574,11 +30578,9 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('xxx',param);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},{}],100:[function(require,module,exports){
|
},{"../../logger":103}],100:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
@ -30587,6 +30589,8 @@ var sq = require('./parser/sequenceDiagram').parser;
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
var svgDraw = require('./svgDraw');
|
var svgDraw = require('./svgDraw');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
|
|
||||||
diagramMarginX:50,
|
diagramMarginX:50,
|
||||||
|
@ -30961,7 +30965,7 @@ module.exports.draw = function (text, id) {
|
||||||
if(conf.useMaxWidth) {
|
if(conf.useMaxWidth) {
|
||||||
diagram.attr("height", '100%');
|
diagram.attr("height", '100%');
|
||||||
diagram.attr("width", '100%');
|
diagram.attr("width", '100%');
|
||||||
diagram.attr('style', 'max-width:' + (width) + 'px;')
|
diagram.attr('style', 'max-width:' + (width) + 'px;');
|
||||||
}else{
|
}else{
|
||||||
diagram.attr("height",height);
|
diagram.attr("height",height);
|
||||||
diagram.attr("width", width );
|
diagram.attr("width", width );
|
||||||
|
@ -30969,10 +30973,11 @@ module.exports.draw = function (text, id) {
|
||||||
diagram.attr("viewBox", (box.startx-conf.diagramMarginX) + ' -' +conf.diagramMarginY + ' ' + width + ' ' + height);
|
diagram.attr("viewBox", (box.startx-conf.diagramMarginX) + ' -' +conf.diagramMarginY + ' ' + width + ' ' + height);
|
||||||
};
|
};
|
||||||
|
|
||||||
},{"../../d3":86,"./parser/sequenceDiagram":98,"./sequenceDb":99,"./svgDraw":101}],101:[function(require,module,exports){
|
},{"../../d3":86,"../../logger":103,"./parser/sequenceDiagram":98,"./sequenceDb":99,"./svgDraw":101}],101:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-20.
|
* Created by knut on 14-12-20.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
exports.drawRect = function(elem , rectData){
|
exports.drawRect = function(elem , rectData){
|
||||||
var rectElem = elem.append("rect");
|
var rectElem = elem.append("rect");
|
||||||
rectElem.attr("x", rectData.x);
|
rectElem.attr("x", rectData.x);
|
||||||
|
@ -31217,7 +31222,7 @@ exports.getNoteRect = function(){
|
||||||
return rect;
|
return rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}],102:[function(require,module,exports){
|
},{"../../logger":103}],102:[function(require,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var graph = require('./diagrams/flowchart/graphDb');
|
var graph = require('./diagrams/flowchart/graphDb');
|
||||||
var flow = require('./diagrams/flowchart/parser/flow');
|
var flow = require('./diagrams/flowchart/parser/flow');
|
||||||
|
@ -31236,6 +31241,7 @@ var ganttParser = require('./diagrams/gantt/parser/gantt');
|
||||||
var ganttDb = require('./diagrams/gantt/ganttDb');
|
var ganttDb = require('./diagrams/gantt/ganttDb');
|
||||||
var d3 = require('./d3');
|
var d3 = require('./d3');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
// Default options, can be overridden at initialization time
|
// Default options, can be overridden at initialization time
|
||||||
/**
|
/**
|
||||||
|
@ -31455,7 +31461,7 @@ var setConf = function(cnf){
|
||||||
|
|
||||||
var j;
|
var j;
|
||||||
for(j=0;j<lvl2Keys.length;j++) {
|
for(j=0;j<lvl2Keys.length;j++) {
|
||||||
//console.log('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
//log.debug('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
||||||
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
||||||
|
|
||||||
config[lvl1Keys[i]] = {};
|
config[lvl1Keys[i]] = {};
|
||||||
|
@ -31477,20 +31483,140 @@ exports.initialize = function(options){
|
||||||
exports.getConfig = function(){
|
exports.getConfig = function(){
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.parseError = function(err, hash) {
|
||||||
|
if(typeof mermaid !== 'undefined') {
|
||||||
|
mermaid.parseError(err,hash);
|
||||||
|
}else{
|
||||||
|
log.debug('Mermaid Syntax error:');
|
||||||
|
log.debug(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
global.mermaidAPI = {
|
global.mermaidAPI = {
|
||||||
render : exports.render,
|
render : exports.render,
|
||||||
parse : exports.parse,
|
parse : exports.parse,
|
||||||
initialize : exports.initialize,
|
initialize : exports.initialize,
|
||||||
detectType : utils.detectType
|
detectType : utils.detectType,
|
||||||
|
parseError : exports.parseError
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../package.json":85,"./d3":86,"./diagrams/example/exampleDb":87,"./diagrams/example/exampleRenderer":88,"./diagrams/example/parser/example":89,"./diagrams/flowchart/flowRenderer":91,"./diagrams/flowchart/graphDb":92,"./diagrams/flowchart/parser/dot":93,"./diagrams/flowchart/parser/flow":94,"./diagrams/gantt/ganttDb":95,"./diagrams/gantt/ganttRenderer":96,"./diagrams/gantt/parser/gantt":97,"./diagrams/sequenceDiagram/parser/sequenceDiagram":98,"./diagrams/sequenceDiagram/sequenceDb":99,"./diagrams/sequenceDiagram/sequenceRenderer":100,"./utils":103}],103:[function(require,module,exports){
|
},{"../package.json":85,"./d3":86,"./diagrams/example/exampleDb":87,"./diagrams/example/exampleRenderer":88,"./diagrams/example/parser/example":89,"./diagrams/flowchart/flowRenderer":91,"./diagrams/flowchart/graphDb":92,"./diagrams/flowchart/parser/dot":93,"./diagrams/flowchart/parser/flow":94,"./diagrams/gantt/ganttDb":95,"./diagrams/gantt/ganttRenderer":96,"./diagrams/gantt/parser/gantt":97,"./diagrams/sequenceDiagram/parser/sequenceDiagram":98,"./diagrams/sequenceDiagram/sequenceDb":99,"./diagrams/sequenceDiagram/sequenceRenderer":100,"./logger":103,"./utils":104}],103:[function(require,module,exports){
|
||||||
|
(function (process){
|
||||||
|
/**
|
||||||
|
* #logger
|
||||||
|
* logger = require('logger').create()
|
||||||
|
* logger.info("blah")
|
||||||
|
* => [2011-3-3T20:24:4.810 info (5021)] blah
|
||||||
|
* logger.debug("boom")
|
||||||
|
* =>
|
||||||
|
* logger.level = Logger.levels.debug
|
||||||
|
* logger.debug(function() { return "booom" })
|
||||||
|
* => [2011-3-3T20:24:4.810 error (5021)] booom
|
||||||
|
*/
|
||||||
|
var Logger;
|
||||||
|
|
||||||
|
Logger = (function() {
|
||||||
|
function Logger(options) {
|
||||||
|
var level, num, ref;
|
||||||
|
this.options = options || {};
|
||||||
|
this.level = this.options.level || Logger.levels.default;
|
||||||
|
ref = Logger.levels;
|
||||||
|
for (level in ref) {
|
||||||
|
num = ref[level];
|
||||||
|
Logger.define(this, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.add = function(level, message, callback) {
|
||||||
|
if (this.level > (Logger.levels[level] || 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
message = callback();
|
||||||
|
} else if (typeof message === 'function') {
|
||||||
|
message = message();
|
||||||
|
}
|
||||||
|
return this.write({
|
||||||
|
timestamp: new Date,
|
||||||
|
severity: level,
|
||||||
|
message: message,
|
||||||
|
pid: process.pid
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function formatTime(timestamp){
|
||||||
|
var hh = timestamp.getUTCHours();
|
||||||
|
var mm = timestamp.getUTCMinutes();
|
||||||
|
var ss = timestamp.getSeconds();
|
||||||
|
var ms = timestamp.getMilliseconds();
|
||||||
|
// If you were building a timestamp instead of a duration, you would uncomment the following line to get 12-hour (not 24) time
|
||||||
|
// if (hh > 12) {hh = hh % 12;}
|
||||||
|
// These lines ensure you have two-digits
|
||||||
|
if (hh < 10) {hh = "0"+hh;}
|
||||||
|
if (mm < 10) {mm = "0"+mm;}
|
||||||
|
if (ss < 10) {ss = "0"+ss;}
|
||||||
|
if (ms < 100){ms = "0"+ms;}
|
||||||
|
if (ms < 10) {ms = "00"+ms;}
|
||||||
|
// This formats your string to HH:MM:SS
|
||||||
|
var t = hh+":"+mm+":"+ss +' ('+ms+')';
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.write = function(options) {
|
||||||
|
if(typeof console !== 'undefined'){
|
||||||
|
if(typeof log.debug !== 'undefined'){
|
||||||
|
return log.debug(this.build_message(options));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.prototype.build_message = function(options) {
|
||||||
|
return "[" + formatTime(options.timestamp) + "] " + options.message;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Logger;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
Logger.define = function(logger, level) {
|
||||||
|
return logger[level] = function(message, callback) {
|
||||||
|
return this.add(level, message, callback);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.levels = {
|
||||||
|
debug: 1,
|
||||||
|
info: 2,
|
||||||
|
warn: 3,
|
||||||
|
error: 4,
|
||||||
|
fatal: 5,
|
||||||
|
default:3
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.create = function(type, options) {
|
||||||
|
return new Logger(options);
|
||||||
|
};
|
||||||
|
}).call(this,require("1YiZ5S"))
|
||||||
|
},{"1YiZ5S":82}],104:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
var log = require('./logger').create();
|
||||||
/**
|
/**
|
||||||
|
* @function detectType
|
||||||
* Detects the type of the graph text.
|
* Detects the type of the graph text.
|
||||||
|
* ```mermaid
|
||||||
|
* graph LR
|
||||||
|
* a-->b
|
||||||
|
* b-->c
|
||||||
|
* c-->d
|
||||||
|
* d-->e
|
||||||
|
* e-->f
|
||||||
|
* f-->g
|
||||||
|
* g-->h
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @param {string} text The text defining the graph
|
* @param {string} text The text defining the graph
|
||||||
* @param {string} text The second text defining the graph
|
* @param {string} text The second text defining the graph
|
||||||
* @returns {string} A graph definition key
|
* @returns {string} A graph definition key
|
||||||
|
@ -31501,22 +31627,27 @@ module.exports.detectType = function(text,a){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*sequence/)){
|
if(text.match(/^\s*sequence/)){
|
||||||
//console.log('Detected sequence syntax');
|
/* ```mermaid
|
||||||
|
graph TB
|
||||||
|
a-->b
|
||||||
|
b-->c
|
||||||
|
```
|
||||||
|
*/
|
||||||
return "sequence";
|
return "sequence";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*digraph/)) {
|
if(text.match(/^\s*digraph/)) {
|
||||||
//console.log('Detected dot syntax');
|
//log.debug('Detected dot syntax');
|
||||||
return "dotGraph";
|
return "dotGraph";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*info/)) {
|
if(text.match(/^\s*info/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "info";
|
return "info";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*gantt/)) {
|
if(text.match(/^\s*gantt/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "gantt";
|
return "gantt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31609,4 +31740,4 @@ module.exports.cloneCssStyles = function(svg, classes){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}]},{},[102])
|
},{"./logger":103}]},{},[102])
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,17 +1,17 @@
|
||||||
/* global window */
|
/* global window */
|
||||||
//console.log('Setting up d3');
|
//log.debug('Setting up d3');
|
||||||
var d3;
|
var d3;
|
||||||
|
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
d3 = require("d3");
|
d3 = require("d3");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Exception ... but ok');
|
//log.debug('Exception ... but ok');
|
||||||
//console.log(e);
|
//log.debug(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(d3);
|
//log.debug(d3);
|
||||||
|
|
||||||
if (!d3) {
|
if (!d3) {
|
||||||
//if(typeof window !== 'undefined')
|
//if(typeof window !== 'undefined')
|
||||||
|
@ -22,10 +22,10 @@ if (!d3) {
|
||||||
// window = {};
|
// window = {};
|
||||||
// window.d3 = d3;
|
// window.d3 = d3;
|
||||||
//}
|
//}
|
||||||
//console.log('window');
|
//log.debug('window');
|
||||||
//console.log(window);
|
//log.debug(window);
|
||||||
module.exports = d3;
|
module.exports = d3;
|
||||||
|
/* jshint ignore:start */
|
||||||
/*
|
/*
|
||||||
|
|
||||||
D3 Text Wrap
|
D3 Text Wrap
|
||||||
|
@ -479,4 +479,5 @@ Detailed instructions at http://www.github.com/vijithassar/d3textwrap
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
/* jshint ignore:end */
|
|
@ -7,7 +7,7 @@ describe('when parsing an info graph it',function() {
|
||||||
ex = require('./parser/example').parser;
|
ex = require('./parser/example').parser;
|
||||||
ex.yy = require('./exampleDb');
|
ex.yy = require('./exampleDb');
|
||||||
parseError = function(err, hash) {
|
parseError = function(err, hash) {
|
||||||
console.log('Syntax error:' + err);
|
log.debug('Syntax error:' + err);
|
||||||
};
|
};
|
||||||
//ex.yy.parseError = parseError;
|
//ex.yy.parseError = parseError;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var message = '';
|
var message = '';
|
||||||
var info = false;
|
var info = false;
|
||||||
|
|
||||||
|
@ -22,5 +22,5 @@ exports.getInfo = function(){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
|
@ -4,7 +4,7 @@
|
||||||
var db = require('./exampleDb');
|
var db = require('./exampleDb');
|
||||||
var exampleParser = require('./parser/example.js');
|
var exampleParser = require('./parser/example.js');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
/**
|
/**
|
||||||
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
||||||
* @param text
|
* @param text
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/* global window */
|
/* global window */
|
||||||
|
var log = require('../../logger').create();
|
||||||
var dagreD3;
|
var dagreD3;
|
||||||
//console.log('setting up dagre-d3');
|
//log.debug('setting up dagre-d3');
|
||||||
if (require) {
|
if (require) {
|
||||||
try {
|
try {
|
||||||
dagreD3 = require("dagre-d3");
|
dagreD3 = require("dagre-d3");
|
||||||
//console.log('Got it (dagre-d3)');
|
//log.debug('Got it (dagre-d3)');
|
||||||
} catch (e) {console.log('Could not load dagre-d3');}
|
} catch (e) {log.debug('Could not load dagre-d3');}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dagreD3) {
|
if (!dagreD3) {
|
||||||
|
|
|
@ -6,6 +6,8 @@ var flow = require('./parser/flow');
|
||||||
var dot = require('./parser/dot');
|
var dot = require('./parser/dot');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var dagreD3 = require('./dagre-d3');
|
var dagreD3 = require('./dagre-d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
};
|
};
|
||||||
module.exports.setConf = function(cnf){
|
module.exports.setConf = function(cnf){
|
||||||
|
@ -49,7 +51,7 @@ exports.addVertices = function (vert, g) {
|
||||||
*/
|
*/
|
||||||
var classStr = '';
|
var classStr = '';
|
||||||
|
|
||||||
//console.log(vertice.classes);
|
//log.debug(vertice.classes);
|
||||||
|
|
||||||
if(vertice.classes.length >0){
|
if(vertice.classes.length >0){
|
||||||
classStr = vertice.classes.join(" ");
|
classStr = vertice.classes.join(" ");
|
||||||
|
@ -230,7 +232,7 @@ exports.getClasses = function (text, isDot) {
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
exports.draw = function (text, id,isDot) {
|
exports.draw = function (text, id,isDot) {
|
||||||
|
log.debug('Drawing flowchart');
|
||||||
var parser;
|
var parser;
|
||||||
graph.clear();
|
graph.clear();
|
||||||
if(isDot){
|
if(isDot){
|
||||||
|
@ -283,7 +285,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
// Fetch the verices/nodes and edges/links from the parsed graph definition
|
||||||
var vert = graph.getVertices();
|
var vert = graph.getVertices();
|
||||||
|
|
||||||
//console.log(vert);
|
//log.debug(vert);
|
||||||
var edges = graph.getEdges();
|
var edges = graph.getEdges();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -294,7 +296,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
d3.selectAll('cluster').append('text');
|
d3.selectAll('cluster').append('text');
|
||||||
|
|
||||||
for(j=0;j<subG.nodes.length;j++){
|
for(j=0;j<subG.nodes.length;j++){
|
||||||
//console.log('Setting node',subG.nodes[j],' to subgraph '+id);
|
//log.debug('Setting node',subG.nodes[j],' to subgraph '+id);
|
||||||
g.setParent(subG.nodes[j],subG.id);
|
g.setParent(subG.nodes[j],subG.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -438,7 +440,7 @@ exports.draw = function (text, id,isDot) {
|
||||||
|
|
||||||
if (subG.title !== 'undefined') {
|
if (subG.title !== 'undefined') {
|
||||||
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
||||||
//console.log('looking up: #' + id + ' #' + subG.id)
|
//log.debug('looking up: #' + id + ' #' + subG.id)
|
||||||
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
||||||
|
|
||||||
var xPos = clusterRects[0].x.baseVal.value;
|
var xPos = clusterRects[0].x.baseVal.value;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-03.
|
* Created by knut on 14-11-03.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
var vertices = {};
|
var vertices = {};
|
||||||
var edges = [];
|
var edges = [];
|
||||||
var classes = [];
|
var classes = [];
|
||||||
|
@ -63,7 +63,7 @@ exports.addVertex = function (id, text, type, style) {
|
||||||
* @param linktext
|
* @param linktext
|
||||||
*/
|
*/
|
||||||
exports.addLink = function (start, end, type, linktext) {
|
exports.addLink = function (start, end, type, linktext) {
|
||||||
//console.log('Got edge', start, end);
|
//log.debug('Got edge', start, end);
|
||||||
var edge = {start: start, end: end, type: undefined, text: ''};
|
var edge = {start: start, end: end, type: undefined, text: ''};
|
||||||
linktext = type.text;
|
linktext = type.text;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
//console.log('Checking now for ::'+id);
|
//log.debug('Checking now for ::'+id);
|
||||||
if(typeof vertices[id] !== 'undefined'){
|
if(typeof vertices[id] !== 'undefined'){
|
||||||
funs.push(function(){
|
funs.push(function(){
|
||||||
var elem = document.getElementById(id);
|
var elem = document.getElementById(id);
|
||||||
|
@ -166,7 +166,7 @@ exports.setClickEvent = function (id,functionName) {
|
||||||
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
elem.onclick = function(){eval(functionName+'(\'' + id + '\')');}; // jshint ignore:line
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//console.log('id was null: '+id);
|
//log.debug('id was null: '+id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -251,8 +251,8 @@ exports.addSubGraph = function (list, title) {
|
||||||
|
|
||||||
|
|
||||||
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
var subGraph = {id:'subGraph'+subCount, nodes:nodeList,title:title};
|
||||||
//console.log('subGraph:' + subGraph.title + subGraph.id);
|
//log.debug('subGraph:' + subGraph.title + subGraph.id);
|
||||||
//console.log(subGraph.nodes);
|
//log.debug(subGraph.nodes);
|
||||||
subGraphs.push(subGraph);
|
subGraphs.push(subGraph);
|
||||||
subCount = subCount + 1;
|
subCount = subCount + 1;
|
||||||
return subGraph.id;
|
return subGraph.id;
|
||||||
|
@ -262,11 +262,11 @@ var getPosForId = function(id){
|
||||||
var i;
|
var i;
|
||||||
for(i=0;i<subGraphs.length;i++){
|
for(i=0;i<subGraphs.length;i++){
|
||||||
if(subGraphs[i].id===id){
|
if(subGraphs[i].id===id){
|
||||||
//console.log('Found pos for ',id,' ',i);
|
//log.debug('Found pos for ',id,' ',i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log('No pos found for ',id,' ',i);
|
//log.debug('No pos found for ',id,' ',i);
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
var secCount = -1;
|
var secCount = -1;
|
||||||
|
@ -332,5 +332,5 @@ exports.getSubGraphs = function (list) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
|
@ -10,7 +10,7 @@ describe('when parsing ',function(){
|
||||||
flow.parser.yy = require('../graphDb');
|
flow.parser.yy = require('../graphDb');
|
||||||
flow.parser.yy.clear();
|
flow.parser.yy.clear();
|
||||||
/*flow.parser.parse.parseError= function parseError(str, hash) {
|
/*flow.parser.parse.parseError= function parseError(str, hash) {
|
||||||
console.logconsole.log(str);
|
log.debugconsole.log(str);
|
||||||
}*/
|
}*/
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ describe('when parsing ',function(){
|
||||||
expect(edges.length).toBe(0);
|
expect(edges.length).toBe(0);
|
||||||
expect(vert['i-d'].styles.length).toBe(0);
|
expect(vert['i-d'].styles.length).toBe(0);
|
||||||
});
|
});
|
||||||
//console.log(flow.parser.parse('graph TD;style Q background:#fff;'));
|
//log.debug(flow.parser.parse('graph TD;style Q background:#fff;'));
|
||||||
it('should handle styles for vertices',function(){
|
it('should handle styles for vertices',function(){
|
||||||
var res = flow.parser.parse('graph TD;style Q background:#fff;');
|
var res = flow.parser.parse('graph TD;style Q background:#fff;');
|
||||||
|
|
||||||
|
@ -1067,7 +1067,7 @@ describe('when parsing ',function(){
|
||||||
expect(vert['Q'].styles[0]).toBe('background:#fff');
|
expect(vert['Q'].styles[0]).toBe('background:#fff');
|
||||||
});
|
});
|
||||||
|
|
||||||
//console.log(flow.parser.parse('graph TD;style Q background:#fff;'));
|
//log.debug(flow.parser.parse('graph TD;style Q background:#fff;'));
|
||||||
it('should handle styles for edges',function(){
|
it('should handle styles for edges',function(){
|
||||||
var res = flow.parser.parse('graph TD;a-->b;\nstyle #0 stroke: #f66;');
|
var res = flow.parser.parse('graph TD;a-->b;\nstyle #0 stroke: #f66;');
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
/* global window */
|
|
||||||
|
|
||||||
/*var d3;
|
|
||||||
|
|
||||||
if (require) {
|
|
||||||
try {
|
|
||||||
d3 = require("d3");
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!d3) {
|
|
||||||
d3 = window.d3;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = d3;*/
|
|
|
@ -7,7 +7,7 @@ describe('when parsing a gantt diagram it',function() {
|
||||||
gantt = require('./parser/gantt').parser;
|
gantt = require('./parser/gantt').parser;
|
||||||
gantt.yy = require('./ganttDb');
|
gantt.yy = require('./ganttDb');
|
||||||
parseError = function(err, hash) {
|
parseError = function(err, hash) {
|
||||||
console.log('Syntax error:' + err);
|
log.debug('Syntax error:' + err);
|
||||||
};
|
};
|
||||||
//ex.yy.parseError = parseError;
|
//ex.yy.parseError = parseError;
|
||||||
});
|
});
|
||||||
|
@ -32,6 +32,17 @@ describe('when parsing a gantt diagram it',function() {
|
||||||
|
|
||||||
gantt.parse(str);
|
gantt.parse(str);
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
* Beslutsflöde inligt nedan. Obs bla bla bla
|
||||||
|
* ```
|
||||||
|
* graph TD
|
||||||
|
* A[Hard pledge] -- text on link -->B(Round edge)
|
||||||
|
* B --> C{to do or not to do}
|
||||||
|
* C -->|Too| D[Result one]
|
||||||
|
* C -->|Doo| E[Result two]
|
||||||
|
```
|
||||||
|
* params bapa - a unique bapap
|
||||||
|
*/
|
||||||
it('should handle a task definition', function () {
|
it('should handle a task definition', function () {
|
||||||
var str = 'gantt\n' +
|
var str = 'gantt\n' +
|
||||||
'dateFormat yyyy-mm-dd\n' +
|
'dateFormat yyyy-mm-dd\n' +
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* Created by knut on 15-01-14.
|
* Created by knut on 15-01-14.
|
||||||
*/
|
*/
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var dateFormat = '';
|
var dateFormat = '';
|
||||||
var title = '';
|
var title = '';
|
||||||
|
@ -59,8 +60,8 @@ exports.getTasks=function(){
|
||||||
|
|
||||||
|
|
||||||
var getStartDate = function(prevTime, dateFormat, str){
|
var getStartDate = function(prevTime, dateFormat, str){
|
||||||
//console.log('Deciding start date:'+str);
|
//log.debug('Deciding start date:'+str);
|
||||||
//console.log('with dateformat:'+dateFormat);
|
//log.debug('with dateformat:'+dateFormat);
|
||||||
|
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
|
|
||||||
|
@ -81,9 +82,9 @@ var getStartDate = function(prevTime, dateFormat, str){
|
||||||
if(moment(str,dateFormat.trim(),true).isValid()){
|
if(moment(str,dateFormat.trim(),true).isValid()){
|
||||||
return moment(str,dateFormat.trim(),true).toDate();
|
return moment(str,dateFormat.trim(),true).toDate();
|
||||||
}else{
|
}else{
|
||||||
console.log('Invalid date:'+str);
|
log.debug('Invalid date:'+str);
|
||||||
console.log('With date format:'+dateFormat.trim());
|
log.debug('With date format:'+dateFormat.trim());
|
||||||
//console.log('----');
|
//log.debug('----');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default date - now
|
// Default date - now
|
||||||
|
@ -230,5 +231,5 @@ exports.addTask = function(descr,data){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
|
@ -1,6 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-18.
|
* Created by knut on 14-11-18.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
describe('when using the ganttDb',function() {
|
describe('when using the ganttDb',function() {
|
||||||
var parseError, gantt;
|
var parseError, gantt;
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
@ -11,7 +12,7 @@ describe('when using the ganttDb',function() {
|
||||||
gDb = require('./ganttDb');
|
gDb = require('./ganttDb');
|
||||||
gDb.clear();
|
gDb.clear();
|
||||||
parseError = function(err, hash) {
|
parseError = function(err, hash) {
|
||||||
console.log('Syntax error:' + err);
|
log.debug('Syntax error:' + err);
|
||||||
};
|
};
|
||||||
//ex.yy.parseError = parseError;
|
//ex.yy.parseError = parseError;
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@ var gantt = require('./parser/gantt').parser;
|
||||||
gantt.yy = require('./ganttDb');
|
gantt.yy = require('./ganttDb');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var daysInChart;
|
var daysInChart;
|
||||||
var conf = {
|
var conf = {
|
||||||
|
@ -365,7 +365,7 @@ module.exports.draw = function (text, id) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
for (var j = 0; j < i; j++) {
|
for (var j = 0; j < i; j++) {
|
||||||
prevGap += numOccurances[i - 1][1];
|
prevGap += numOccurances[i - 1][1];
|
||||||
// console.log(prevGap);
|
// log.debug(prevGap);
|
||||||
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,15 +5,15 @@ var actors = {};
|
||||||
var actorKeys = [];
|
var actorKeys = [];
|
||||||
var messages = [];
|
var messages = [];
|
||||||
var notes = [];
|
var notes = [];
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
|
|
||||||
exports.addActor = function(id,name,description){
|
exports.addActor = function(id,name,description){
|
||||||
//console.log('Adding actor: '+id);
|
|
||||||
actors[id] = {name:name, description:description};
|
actors[id] = {name:name, description:description};
|
||||||
actorKeys.push(id);
|
actorKeys.push(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.addMessage = function(idFrom, idTo, message, answer){
|
exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
|
||||||
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
messages.push({from:idFrom, to:idTo, message:message, answer:answer});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ exports.addMessage = function(idFrom, idTo, message, answer){
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
exports.addSignal = function(idFrom, idTo, message, messageType){
|
exports.addSignal = function(idFrom, idTo, message, messageType){
|
||||||
//console.log('Adding message from='+idFrom+' to='+idTo+' message='+message+' answer='+answer);
|
log.debug('Adding message from='+idFrom+' to='+idTo+' message='+message+' type='+messageType);
|
||||||
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
messages.push({from:idFrom, to:idTo, message:message, type:messageType});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ exports.addNote = function (actor, placement, message){
|
||||||
|
|
||||||
|
|
||||||
exports.parseError = function(err,hash){
|
exports.parseError = function(err,hash){
|
||||||
mermaid.parseError(err,hash);
|
mermaidAPI.parseError(err,hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.apply = function(param){
|
exports.apply = function(param){
|
||||||
|
@ -90,7 +90,7 @@ exports.apply = function(param){
|
||||||
exports.apply(item);
|
exports.apply(item);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// console.log(param);
|
// log.debug(param);
|
||||||
switch(param.type){
|
switch(param.type){
|
||||||
case 'addActor':
|
case 'addActor':
|
||||||
exports.addActor(param.actor, param.actor, param.actor);
|
exports.addActor(param.actor, param.actor, param.actor);
|
||||||
|
@ -102,7 +102,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
exports.addSignal(param.from, param.to, param.msg, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'loopStart':
|
case 'loopStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
exports.addSignal(undefined, undefined, param.loopText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -110,7 +110,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'optStart':
|
case 'optStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
exports.addSignal(undefined, undefined, param.optText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -118,7 +118,7 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
case 'altStart':
|
case 'altStart':
|
||||||
//console.log('Loop text: ',param.loopText);
|
//log.debug('Loop text: ',param.loopText);
|
||||||
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
exports.addSignal(undefined, undefined, param.altText, param.signalType);
|
||||||
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
//yy.addSignal(undefined, undefined, $2, yy.LINETYPE.LOOP_START);
|
||||||
break;
|
break;
|
||||||
|
@ -129,7 +129,5 @@ exports.apply = function(param){
|
||||||
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
exports.addSignal(undefined, undefined, undefined, param.signalType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('xxx',param);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -2,7 +2,7 @@
|
||||||
* Created by knut on 14-11-18.
|
* Created by knut on 14-11-18.
|
||||||
*/
|
*/
|
||||||
var proxyquire = require('proxyquire');
|
var proxyquire = require('proxyquire');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var sq = require('./parser/sequenceDiagram').parser;
|
var sq = require('./parser/sequenceDiagram').parser;
|
||||||
var newD3;
|
var newD3;
|
||||||
|
@ -22,8 +22,8 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
sq.yy.clear();
|
sq.yy.clear();
|
||||||
parseError = function(err, hash) {
|
parseError = function(err, hash) {
|
||||||
console.log('Syntax error:' + err);
|
log.debug('Syntax error:' + err);
|
||||||
console.log(hash);
|
log.debug(hash);
|
||||||
};
|
};
|
||||||
sq.yy.parseError = parseError;
|
sq.yy.parseError = parseError;
|
||||||
});
|
});
|
||||||
|
@ -69,7 +69,7 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
|
|
||||||
sq.parse(str);
|
sq.parse(str);
|
||||||
var actors = sq.yy.getActors();
|
var actors = sq.yy.getActors();
|
||||||
//console.log(actors);
|
//log.debug(actors);
|
||||||
expect(actors.Alice.description).toBe('Alice');
|
expect(actors.Alice.description).toBe('Alice');
|
||||||
expect(actors.Bob.description).toBe('Bob');
|
expect(actors.Bob.description).toBe('Bob');
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
|
|
||||||
sq.parse(str);
|
sq.parse(str);
|
||||||
var actors = sq.yy.getActors();
|
var actors = sq.yy.getActors();
|
||||||
//console.log(actors);
|
//log.debug(actors);
|
||||||
expect(actors.Alice.description).toBe('Alice');
|
expect(actors.Alice.description).toBe('Alice');
|
||||||
expect(actors.Bob.description).toBe('Bob');
|
expect(actors.Bob.description).toBe('Bob');
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
expect(actors.Bob.description).toBe('Bob');
|
expect(actors.Bob.description).toBe('Bob');
|
||||||
|
|
||||||
var messages = sq.yy.getMessages();
|
var messages = sq.yy.getMessages();
|
||||||
//console.log(messages);
|
//log.debug(messages);
|
||||||
|
|
||||||
|
|
||||||
expect(messages.length).toBe(1);
|
expect(messages.length).toBe(1);
|
||||||
|
@ -124,7 +124,7 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
expect(actors.Bob.description).toBe('Bob');
|
expect(actors.Bob.description).toBe('Bob');
|
||||||
|
|
||||||
var messages = sq.yy.getMessages();
|
var messages = sq.yy.getMessages();
|
||||||
//console.log(messages);
|
//log.debug(messages);
|
||||||
|
|
||||||
|
|
||||||
expect(messages.length).toBe(1);
|
expect(messages.length).toBe(1);
|
||||||
|
@ -246,12 +246,12 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
|
|
||||||
sq.parse(str);
|
sq.parse(str);
|
||||||
var actors = sq.yy.getActors();
|
var actors = sq.yy.getActors();
|
||||||
//console.log(actors);
|
//log.debug(actors);
|
||||||
expect(actors.Alice.description).toBe('Alice');
|
expect(actors.Alice.description).toBe('Alice');
|
||||||
actors.Bob.description = 'Bob';
|
actors.Bob.description = 'Bob';
|
||||||
|
|
||||||
var messages = sq.yy.getMessages();
|
var messages = sq.yy.getMessages();
|
||||||
//console.log(messages);
|
//log.debug(messages);
|
||||||
|
|
||||||
expect(messages.length).toBe(5);
|
expect(messages.length).toBe(5);
|
||||||
expect(messages[0].from).toBe('Alice');
|
expect(messages[0].from).toBe('Alice');
|
||||||
|
@ -271,12 +271,12 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
|
|
||||||
sq.parse(str);
|
sq.parse(str);
|
||||||
var actors = sq.yy.getActors();
|
var actors = sq.yy.getActors();
|
||||||
//console.log(actors);
|
//log.debug(actors);
|
||||||
expect(actors.Alice.description).toBe('Alice');
|
expect(actors.Alice.description).toBe('Alice');
|
||||||
actors.Bob.description = 'Bob';
|
actors.Bob.description = 'Bob';
|
||||||
|
|
||||||
var messages = sq.yy.getMessages();
|
var messages = sq.yy.getMessages();
|
||||||
//console.log(messages);
|
//log.debug(messages);
|
||||||
|
|
||||||
expect(messages.length).toBe(5);
|
expect(messages.length).toBe(5);
|
||||||
expect(messages[0].from).toBe('Alice');
|
expect(messages[0].from).toBe('Alice');
|
||||||
|
@ -289,12 +289,12 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
|
|
||||||
sq.parse(str);
|
sq.parse(str);
|
||||||
var actors = sq.yy.getActors();
|
var actors = sq.yy.getActors();
|
||||||
//console.log(actors);
|
//log.debug(actors);
|
||||||
expect(actors.Alice.description).toBe('Alice');
|
expect(actors.Alice.description).toBe('Alice');
|
||||||
actors.Bob.description = 'Bob';
|
actors.Bob.description = 'Bob';
|
||||||
|
|
||||||
var messages = sq.yy.getMessages();
|
var messages = sq.yy.getMessages();
|
||||||
//console.log(messages);
|
//log.debug(messages);
|
||||||
|
|
||||||
expect(messages.length).toBe(4);
|
expect(messages.length).toBe(4);
|
||||||
expect(messages[0].from).toBe('Alice');
|
expect(messages[0].from).toBe('Alice');
|
||||||
|
@ -322,7 +322,7 @@ describe('when parsing a sequenceDiagram',function() {
|
||||||
actors.Bob.description = 'Bob';
|
actors.Bob.description = 'Bob';
|
||||||
|
|
||||||
var messages = sq.yy.getMessages();
|
var messages = sq.yy.getMessages();
|
||||||
//console.log(messages);
|
//log.debug(messages);
|
||||||
|
|
||||||
expect(messages.length).toBe(7);
|
expect(messages.length).toBe(7);
|
||||||
expect(messages[0].from).toBe('Alice');
|
expect(messages[0].from).toBe('Alice');
|
||||||
|
@ -337,8 +337,8 @@ describe('when checking the bounds in a sequenceDiagram',function() {
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
sq.yy.clear();
|
sq.yy.clear();
|
||||||
parseError = function(err, hash) {
|
parseError = function(err, hash) {
|
||||||
console.log('Syntax error:' + err);
|
log.debug('Syntax error:' + err);
|
||||||
console.log(hash);
|
log.debug(hash);
|
||||||
};
|
};
|
||||||
sq.yy.parseError = parseError;
|
sq.yy.parseError = parseError;
|
||||||
|
|
||||||
|
@ -487,8 +487,8 @@ describe('when rendering a sequenceDiagram',function() {
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
sq.yy.clear();
|
sq.yy.clear();
|
||||||
parseError = function(err, hash) {
|
parseError = function(err, hash) {
|
||||||
console.log('Syntax error:' + err);
|
log.debug('Syntax error:' + err);
|
||||||
console.log(hash);
|
log.debug(hash);
|
||||||
};
|
};
|
||||||
sq.yy.parseError = parseError;
|
sq.yy.parseError = parseError;
|
||||||
|
|
||||||
|
@ -682,8 +682,8 @@ describe('when rendering a sequenceDiagram with actor mirror activated',function
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
sq.yy.clear();
|
sq.yy.clear();
|
||||||
parseError = function(err, hash) {
|
parseError = function(err, hash) {
|
||||||
console.log('Syntax error:' + err);
|
log.debug('Syntax error:' + err);
|
||||||
console.log(hash);
|
log.debug(hash);
|
||||||
};
|
};
|
||||||
sq.yy.parseError = parseError;
|
sq.yy.parseError = parseError;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ var sq = require('./parser/sequenceDiagram').parser;
|
||||||
sq.yy = require('./sequenceDb');
|
sq.yy = require('./sequenceDb');
|
||||||
var svgDraw = require('./svgDraw');
|
var svgDraw = require('./svgDraw');
|
||||||
var d3 = require('../../d3');
|
var d3 = require('../../d3');
|
||||||
|
var log = require('../../logger').create();
|
||||||
|
|
||||||
var conf = {
|
var conf = {
|
||||||
|
|
||||||
diagramMarginX:50,
|
diagramMarginX:50,
|
||||||
|
@ -380,7 +382,7 @@ module.exports.draw = function (text, id) {
|
||||||
if(conf.useMaxWidth) {
|
if(conf.useMaxWidth) {
|
||||||
diagram.attr("height", '100%');
|
diagram.attr("height", '100%');
|
||||||
diagram.attr("width", '100%');
|
diagram.attr("width", '100%');
|
||||||
diagram.attr('style', 'max-width:' + (width) + 'px;')
|
diagram.attr('style', 'max-width:' + (width) + 'px;');
|
||||||
}else{
|
}else{
|
||||||
diagram.attr("height",height);
|
diagram.attr("height",height);
|
||||||
diagram.attr("width", width );
|
diagram.attr("width", width );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-12-20.
|
* Created by knut on 14-12-20.
|
||||||
*/
|
*/
|
||||||
|
var log = require('../../logger').create();
|
||||||
exports.drawRect = function(elem , rectData){
|
exports.drawRect = function(elem , rectData){
|
||||||
var rectElem = elem.append("rect");
|
var rectElem = elem.append("rect");
|
||||||
rectElem.attr("x", rectData.x);
|
rectElem.attr("x", rectData.x);
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/**
|
||||||
|
* #logger
|
||||||
|
* logger = require('logger').create()
|
||||||
|
* logger.info("blah")
|
||||||
|
* => [2011-3-3T20:24:4.810 info (5021)] blah
|
||||||
|
* logger.debug("boom")
|
||||||
|
* =>
|
||||||
|
* logger.level = Logger.levels.debug
|
||||||
|
* logger.debug(function() { return "booom" })
|
||||||
|
* => [2011-3-3T20:24:4.810 error (5021)] booom
|
||||||
|
*/
|
||||||
|
var Logger;
|
||||||
|
|
||||||
|
Logger = (function() {
|
||||||
|
function Logger(options) {
|
||||||
|
var level, num, ref;
|
||||||
|
this.options = options || {};
|
||||||
|
this.level = this.options.level || Logger.levels.default;
|
||||||
|
ref = Logger.levels;
|
||||||
|
for (level in ref) {
|
||||||
|
num = ref[level];
|
||||||
|
Logger.define(this, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.add = function(level, message, callback) {
|
||||||
|
if (this.level > (Logger.levels[level] || 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
message = callback();
|
||||||
|
} else if (typeof message === 'function') {
|
||||||
|
message = message();
|
||||||
|
}
|
||||||
|
return this.write({
|
||||||
|
timestamp: new Date,
|
||||||
|
severity: level,
|
||||||
|
message: message,
|
||||||
|
pid: process.pid
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function formatTime(timestamp){
|
||||||
|
var hh = timestamp.getUTCHours();
|
||||||
|
var mm = timestamp.getUTCMinutes();
|
||||||
|
var ss = timestamp.getSeconds();
|
||||||
|
var ms = timestamp.getMilliseconds();
|
||||||
|
// If you were building a timestamp instead of a duration, you would uncomment the following line to get 12-hour (not 24) time
|
||||||
|
// if (hh > 12) {hh = hh % 12;}
|
||||||
|
// These lines ensure you have two-digits
|
||||||
|
if (hh < 10) {hh = "0"+hh;}
|
||||||
|
if (mm < 10) {mm = "0"+mm;}
|
||||||
|
if (ss < 10) {ss = "0"+ss;}
|
||||||
|
if (ms < 100){ms = "0"+ms;}
|
||||||
|
if (ms < 10) {ms = "00"+ms;}
|
||||||
|
// This formats your string to HH:MM:SS
|
||||||
|
var t = hh+":"+mm+":"+ss +' ('+ms+')';
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.prototype.write = function(options) {
|
||||||
|
if(typeof console !== 'undefined'){
|
||||||
|
if(typeof log.debug !== 'undefined'){
|
||||||
|
return log.debug(this.build_message(options));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.prototype.build_message = function(options) {
|
||||||
|
return "[" + formatTime(options.timestamp) + "] " + options.message;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Logger;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
Logger.define = function(logger, level) {
|
||||||
|
return logger[level] = function(message, callback) {
|
||||||
|
return this.add(level, message, callback);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.levels = {
|
||||||
|
debug: 1,
|
||||||
|
info: 2,
|
||||||
|
warn: 3,
|
||||||
|
error: 4,
|
||||||
|
fatal: 5,
|
||||||
|
default:3
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.create = function(type, options) {
|
||||||
|
return new Logger(options);
|
||||||
|
};
|
27
src/main.js
27
src/main.js
|
@ -16,6 +16,7 @@ var ganttParser = require('./diagrams/gantt/parser/gantt');
|
||||||
var ganttDb = require('./diagrams/gantt/ganttDb');
|
var ganttDb = require('./diagrams/gantt/ganttDb');
|
||||||
var d3 = require('./d3');
|
var d3 = require('./d3');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -102,7 +103,7 @@ var init = function () {
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
|
|
||||||
console.log('Found ',nodes.length,' nodes');
|
log.debug('Found ',nodes.length,' nodes');
|
||||||
for (i = 0; i < nodes.length; i++) {
|
for (i = 0; i < nodes.length; i++) {
|
||||||
var element = nodes[i];
|
var element = nodes[i];
|
||||||
|
|
||||||
|
@ -210,7 +211,7 @@ var render = function(id, txt,cb){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log(d3.select('#d'+id).node().innerHTML);
|
log.debug(d3.select('#d'+id).node().innerHTML);
|
||||||
var element = d3.select('#d'+id).node();
|
var element = d3.select('#d'+id).node();
|
||||||
var graphType = utils.detectType(txt);
|
var graphType = utils.detectType(txt);
|
||||||
var classes = {};
|
var classes = {};
|
||||||
|
@ -250,7 +251,7 @@ var render = function(id, txt,cb){
|
||||||
utils.cloneCssStyles(element.firstChild, []);
|
utils.cloneCssStyles(element.firstChild, []);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//console.log(document.body.innerHTML);
|
//log.debug(document.body.innerHTML);
|
||||||
cb(d3.select('#d'+id).node().innerHTML);
|
cb(d3.select('#d'+id).node().innerHTML);
|
||||||
|
|
||||||
d3.select('#d'+id).node().remove();
|
d3.select('#d'+id).node().remove();
|
||||||
|
@ -260,12 +261,12 @@ var render = function(id, txt,cb){
|
||||||
exports.render = function(id, text){
|
exports.render = function(id, text){
|
||||||
|
|
||||||
var callback = function(svgText){
|
var callback = function(svgText){
|
||||||
console.log(svgText);
|
log.debug(svgText);
|
||||||
};
|
};
|
||||||
|
|
||||||
if(typeof document === 'undefined'){
|
if(typeof document === 'undefined'){
|
||||||
//jsdom = require('jsdom').jsdom;
|
//jsdom = require('jsdom').jsdom;
|
||||||
//console.log(jsdom);
|
//log.debug(jsdom);
|
||||||
|
|
||||||
//htmlStub = '<html><head></head><body><div class="mermaid">'+text+'</div><script src="dist/mermaid.full.js"></script><script>var mermaid_config = {startOnLoad:true}</script></body></html>';
|
//htmlStub = '<html><head></head><body><div class="mermaid">'+text+'</div><script src="dist/mermaid.full.js"></script><script>var mermaid_config = {startOnLoad:true}</script></body></html>';
|
||||||
htmlStub = '<html><head></head><body></body></html>';
|
htmlStub = '<html><head></head><body></body></html>';
|
||||||
|
@ -279,7 +280,7 @@ exports.render = function(id, text){
|
||||||
// process the html document, like if we were at client side
|
// process the html document, like if we were at client side
|
||||||
// code to generate the dataviz and process the resulting html file to be added here
|
// code to generate the dataviz and process the resulting html file to be added here
|
||||||
//var d3 = require('d3');
|
//var d3 = require('d3');
|
||||||
//console.log('Here we go: '+JSON.stringify(d3));
|
//log.debug('Here we go: '+JSON.stringify(d3));
|
||||||
|
|
||||||
global.document = win.document;
|
global.document = win.document;
|
||||||
global.window = win;
|
global.window = win;
|
||||||
|
@ -287,9 +288,9 @@ exports.render = function(id, text){
|
||||||
var element = win.document.createElement('div');
|
var element = win.document.createElement('div');
|
||||||
element.setAttribute('id','did');
|
element.setAttribute('id','did');
|
||||||
//document.
|
//document.
|
||||||
console.log(document.body.innerHTML);
|
log.debug(document.body.innerHTML);
|
||||||
//console.log('Element:',element);
|
//log.debug('Element:',element);
|
||||||
//console.log(win);
|
//log.debug(win);
|
||||||
//mermaid.init();
|
//mermaid.init();
|
||||||
//render(win.document, 'myId', text, callback);
|
//render(win.document, 'myId', text, callback);
|
||||||
|
|
||||||
|
@ -330,8 +331,8 @@ global.mermaid = {
|
||||||
return parse(text);
|
return parse(text);
|
||||||
},
|
},
|
||||||
parseError: function(err, hash) {
|
parseError: function(err, hash) {
|
||||||
console.log('Mermaid Syntax error:');
|
log.debug('Mermaid Syntax error:');
|
||||||
console.log(err);
|
log.debug(err);
|
||||||
},
|
},
|
||||||
render:function(id, text){
|
render:function(id, text){
|
||||||
return exports.render(id, text);
|
return exports.render(id, text);
|
||||||
|
@ -340,8 +341,8 @@ global.mermaid = {
|
||||||
|
|
||||||
exports.contentLoaded = function(){
|
exports.contentLoaded = function(){
|
||||||
// Check state of start config mermaid namespace
|
// Check state of start config mermaid namespace
|
||||||
//console.log('global.mermaid.startOnLoad',global.mermaid.startOnLoad);
|
//log.debug('global.mermaid.startOnLoad',global.mermaid.startOnLoad);
|
||||||
//console.log('mermaid_config',mermaid_config);
|
//log.debug('mermaid_config',mermaid_config);
|
||||||
if (typeof mermaid_config !== 'undefined') {
|
if (typeof mermaid_config !== 'undefined') {
|
||||||
if (equals(false, mermaid_config.htmlLabels)) {
|
if (equals(false, mermaid_config.htmlLabels)) {
|
||||||
global.mermaid.htmlLabels = false;
|
global.mermaid.htmlLabels = false;
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
|
/**
|
||||||
|
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
|
||||||
|
* the diagrams to svg code.
|
||||||
|
*/
|
||||||
var he = require('he');
|
var he = require('he');
|
||||||
var mermaidAPI = require('./mermaidAPI');
|
var mermaidAPI = require('./mermaidAPI');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
module.exports.mermaidAPI = mermaidAPI;
|
module.exports.mermaidAPI = mermaidAPI;
|
||||||
/**
|
/**
|
||||||
|
* ## init
|
||||||
* Function that goes through the document to find the chart definitions in there and render them.
|
* Function that goes through the document to find the chart definitions in there and render them.
|
||||||
*
|
*
|
||||||
* The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
* The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
||||||
|
@ -14,21 +20,19 @@ module.exports.mermaidAPI = mermaidAPI;
|
||||||
* - an array of DOM nodes (as would come from a jQuery selector)
|
* - an array of DOM nodes (as would come from a jQuery selector)
|
||||||
* - a W3C selector, a la `.mermaid`
|
* - a W3C selector, a la `.mermaid`
|
||||||
*
|
*
|
||||||
* ```
|
* ```mermaid
|
||||||
* graph LR;
|
* graph LR;
|
||||||
* a(Find elements)-->b{Processed};
|
* a(Find elements)-->b{Processed}
|
||||||
* b-->|Yes|c(Leave element);
|
* b-->|Yes|c(Leave element)
|
||||||
* c-->|No |d(Transform);
|
* b-->|No |d(Transform)
|
||||||
* ```
|
* ```
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Renders the mermaid diagrams
|
* Renders the mermaid diagrams
|
||||||
* @* param nodes- a css selector or an array of nodes
|
* @param nodes a css selector or an array of nodes
|
||||||
*/
|
*/
|
||||||
var init = function () {
|
var init = function () {
|
||||||
var nodes;
|
var nodes;
|
||||||
if(arguments.length === 2){
|
if(arguments.length === 2){
|
||||||
// sequence config was passed as #1
|
/*! sequence config was passed as #1 */
|
||||||
if(typeof arguments[0] !== 'undefined'){
|
if(typeof arguments[0] !== 'undefined'){
|
||||||
mermaid.sequenceConfig = arguments[0];
|
mermaid.sequenceConfig = arguments[0];
|
||||||
}
|
}
|
||||||
|
@ -42,7 +46,7 @@ var init = function () {
|
||||||
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
||||||
: typeof nodes === "string" ? document.querySelectorAll(nodes)
|
: typeof nodes === "string" ? document.querySelectorAll(nodes)
|
||||||
: nodes instanceof Node ? [nodes]
|
: nodes instanceof Node ? [nodes]
|
||||||
// Last case - sequence config was passed pick next
|
/*! Last case - sequence config was passed pick next */
|
||||||
: nodes;
|
: nodes;
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
|
@ -51,7 +55,15 @@ var init = function () {
|
||||||
mermaidAPI.initialize(mermaid_config);
|
mermaidAPI.initialize(mermaid_config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug('STar On Load (0): '+mermaid.startOnLoad);
|
||||||
|
if(typeof mermaid.startOnLoad !== 'undefined'){
|
||||||
|
log.debug('STar On Load: '+mermaid.startOnLoad);
|
||||||
|
mermaidAPI.initialize({startOnLoad:mermaid.startOnLoad});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(typeof mermaid.ganttConfig !== 'undefined'){
|
if(typeof mermaid.ganttConfig !== 'undefined'){
|
||||||
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
|
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
|
||||||
}
|
}
|
||||||
|
@ -63,7 +75,7 @@ var init = function () {
|
||||||
for (i = 0; i < nodes.length; i++) {
|
for (i = 0; i < nodes.length; i++) {
|
||||||
var element = nodes[i];
|
var element = nodes[i];
|
||||||
|
|
||||||
// Check if previously processed
|
/*! Check if previously processed */
|
||||||
if(!element.getAttribute("data-processed")) {
|
if(!element.getAttribute("data-processed")) {
|
||||||
element.setAttribute("data-processed", true);
|
element.setAttribute("data-processed", true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -83,11 +95,10 @@ var init = function () {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.tester = function(){};
|
|
||||||
|
|
||||||
exports.init = init;
|
exports.init = init;
|
||||||
|
exports.parse = mermaidAPI.parse;
|
||||||
/**
|
/**
|
||||||
|
* ## version
|
||||||
* Function returning version information
|
* Function returning version information
|
||||||
* @returns {string} A string containing the version info
|
* @returns {string} A string containing the version info
|
||||||
*/
|
*/
|
||||||
|
@ -95,10 +106,16 @@ exports.version = function(){
|
||||||
return 'v'+require('../package.json').version;
|
return 'v'+require('../package.json').version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## initialize
|
||||||
|
* This function overrides the default configuration.
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
exports.initialize = function(config){
|
exports.initialize = function(config){
|
||||||
mermaidAPI.initialize(config);
|
mermaidAPI.initialize(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var equals = function (val, variable){
|
var equals = function (val, variable){
|
||||||
if(typeof variable === 'undefined'){
|
if(typeof variable === 'undefined'){
|
||||||
return false;
|
return false;
|
||||||
|
@ -108,6 +125,15 @@ var equals = function (val, variable){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global mermaid object. Contains the functions:
|
||||||
|
* * init
|
||||||
|
* * initialize
|
||||||
|
* * version
|
||||||
|
* * parse
|
||||||
|
* * parseError
|
||||||
|
* * render
|
||||||
|
*/
|
||||||
global.mermaid = {
|
global.mermaid = {
|
||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
htmlLabels: true,
|
htmlLabels: true,
|
||||||
|
@ -125,14 +151,26 @@ global.mermaid = {
|
||||||
return mermaidAPI.parse(text);
|
return mermaidAPI.parse(text);
|
||||||
},
|
},
|
||||||
parseError: function(err, hash) {
|
parseError: function(err, hash) {
|
||||||
console.log('Mermaid Syntax error:');
|
log.debug('Mermaid Syntax error:');
|
||||||
console.log(err);
|
log.debug(err);
|
||||||
},
|
},
|
||||||
render:function(id, text,callback, element){
|
render:function(id, text,callback, element){
|
||||||
return mermaidAPI.render(id, text,callback, element);
|
return mermaidAPI.render(id, text,callback, element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## parseError
|
||||||
|
* This function overrides the default configuration.
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
|
exports.parseError = global.mermaid.parseError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ##contentLoaded
|
||||||
|
* Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
|
||||||
|
* calls init for rendering the mermaid diagrams on the page.
|
||||||
|
*/
|
||||||
exports.contentLoaded = function(){
|
exports.contentLoaded = function(){
|
||||||
var config;
|
var config;
|
||||||
// Check state of start config mermaid namespace
|
// Check state of start config mermaid namespace
|
||||||
|
@ -143,7 +181,6 @@ exports.contentLoaded = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(global.mermaid.startOnLoad) {
|
if(global.mermaid.startOnLoad) {
|
||||||
|
|
||||||
// For backwards compatability reasons also check mermaid_config variable
|
// For backwards compatability reasons also check mermaid_config variable
|
||||||
if (typeof mermaid_config !== 'undefined') {
|
if (typeof mermaid_config !== 'undefined') {
|
||||||
// Check if property startOnLoad is set
|
// Check if property startOnLoad is set
|
||||||
|
@ -152,6 +189,7 @@ exports.contentLoaded = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
mermaidAPI.initialize({startOnLoad:global.mermaid.startOnLoad});
|
||||||
// No config found, do check API config
|
// No config found, do check API config
|
||||||
config = mermaidAPI.getConfig();
|
config = mermaidAPI.getConfig();
|
||||||
if(config.startOnLoad){
|
if(config.startOnLoad){
|
||||||
|
@ -171,7 +209,7 @@ exports.contentLoaded = function(){
|
||||||
|
|
||||||
|
|
||||||
if(typeof document !== 'undefined'){
|
if(typeof document !== 'undefined'){
|
||||||
/**
|
/*!
|
||||||
* Wait for document loaded before starting the execution
|
* Wait for document loaded before starting the execution
|
||||||
*/
|
*/
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
document.addEventListener('DOMContentLoaded', function(){
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
*/
|
*/
|
||||||
var rewire = require("rewire");
|
var rewire = require("rewire");
|
||||||
var utils = require("./utils");
|
var utils = require("./utils");
|
||||||
var main = require("./main");
|
var mermaid = require("./mermaid");
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
describe('when using main and ',function() {
|
describe('when using mermaid and ',function() {
|
||||||
describe('when detecting chart type ',function() {
|
describe('when detecting chart type ',function() {
|
||||||
//var main;
|
//var mermaid;
|
||||||
//var document;
|
//var document;
|
||||||
//var window;
|
//var window;
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
@ -25,58 +26,58 @@ describe('when using main and ',function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not start rendering with mermaid_config.startOnLoad set to false', function () {
|
it('should not start rendering with mermaid_config.startOnLoad set to false', function () {
|
||||||
main = rewire('./main');
|
mermaid = rewire('./mermaid');
|
||||||
mermaid_config ={startOnLoad : false};
|
mermaid_config ={startOnLoad : false};
|
||||||
|
|
||||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
||||||
spyOn(global.mermaid,'init');
|
spyOn(global.mermaid,'init');
|
||||||
//console.log(main);
|
//log.debug(mermaid);
|
||||||
main.contentLoaded();
|
mermaid.contentLoaded();
|
||||||
expect(global.mermaid.init).not.toHaveBeenCalled();
|
expect(global.mermaid.init).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not start rendering with mermaid.startOnLoad set to false', function () {
|
it('should not start rendering with mermaid.startOnLoad set to false', function () {
|
||||||
main = rewire('./main');
|
mermaid = rewire('./mermaid');
|
||||||
mermaid.startOnLoad = false;
|
global.mermaid.startOnLoad = false;
|
||||||
mermaid_config ={startOnLoad : true};
|
mermaid_config ={startOnLoad : true};
|
||||||
|
|
||||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
||||||
spyOn(global.mermaid,'init');
|
spyOn(global.mermaid,'init');
|
||||||
main.contentLoaded();
|
mermaid.contentLoaded();
|
||||||
expect(global.mermaid.init).not.toHaveBeenCalled();
|
expect(global.mermaid.init).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should start rendering with both startOnLoad set', function () {
|
it('should start rendering with both startOnLoad set', function () {
|
||||||
main = rewire('./main');
|
mermaid = rewire('./mermaid');
|
||||||
mermaid.startOnLoad = true;
|
global.mermaid.startOnLoad = true;
|
||||||
mermaid_config ={startOnLoad : true};
|
mermaid_config ={startOnLoad : true};
|
||||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
||||||
spyOn(global.mermaid,'init');
|
spyOn(global.mermaid,'init');
|
||||||
main.contentLoaded();
|
mermaid.contentLoaded();
|
||||||
expect(global.mermaid.init).toHaveBeenCalled();
|
expect(global.mermaid.init).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should start rendering with mermaid.startOnLoad set and no mermaid_config defined', function () {
|
it('should start rendering with mermaid.startOnLoad set and no mermaid_config defined', function () {
|
||||||
main = rewire('./main');
|
mermaid = rewire('./mermaid');
|
||||||
mermaid.startOnLoad = true;
|
global.mermaid.startOnLoad = true;
|
||||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
||||||
spyOn(global.mermaid,'init');
|
spyOn(global.mermaid,'init');
|
||||||
main.contentLoaded();
|
mermaid.contentLoaded();
|
||||||
expect(global.mermaid.init).toHaveBeenCalled();
|
expect(global.mermaid.init).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should start rendering as a default with no changes performed', function () {
|
it('should start rendering as a default with no changes performed', function () {
|
||||||
main = rewire('./main');
|
mermaid = rewire('./mermaid');
|
||||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>';
|
||||||
spyOn(global.mermaid,'init');
|
spyOn(global.mermaid,'init');
|
||||||
main.contentLoaded();
|
mermaid.contentLoaded();
|
||||||
expect(global.mermaid.init).toHaveBeenCalled();
|
expect(global.mermaid.init).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when calling addEdges ',function() {
|
describe('when calling addEdges ',function() {
|
||||||
var main;
|
var mermaid;
|
||||||
var graph = require('./diagrams/flowchart/graphDb');
|
var graph = require('./diagrams/flowchart/graphDb');
|
||||||
var flow = require('./diagrams/flowchart/parser/flow');
|
var flow = require('./diagrams/flowchart/parser/flow');
|
||||||
var flowRend = require('./diagrams/flowchart/flowRenderer');
|
var flowRend = require('./diagrams/flowchart/flowRenderer');
|
||||||
|
@ -88,7 +89,7 @@ describe('when using main and ',function() {
|
||||||
flow.parser.yy =graph;
|
flow.parser.yy =graph;
|
||||||
graph.clear();
|
graph.clear();
|
||||||
document = mock.getDocument();
|
document = mock.getDocument();
|
||||||
main = rewire('./main');
|
mermaid = rewire('./mermaid');
|
||||||
});
|
});
|
||||||
it('it should handle edges with text', function () {
|
it('it should handle edges with text', function () {
|
||||||
var res = flow.parser.parse('graph TD;A-->|text ex|B;');
|
var res = flow.parser.parse('graph TD;A-->|text ex|B;');
|
||||||
|
@ -177,30 +178,30 @@ describe('when using main and ',function() {
|
||||||
|
|
||||||
describe('checking validity of input ', function(){
|
describe('checking validity of input ', function(){
|
||||||
it('it should return false for an invalid definiton',function(){
|
it('it should return false for an invalid definiton',function(){
|
||||||
spyOn(mermaid,'parseError');
|
spyOn(global.mermaid,'parseError');
|
||||||
var res = mermaid.parse('this is not a mermaid diagram definition');
|
var res = mermaid.parse('this is not a mermaid diagram definition');
|
||||||
|
|
||||||
expect(res).toBe(false);
|
expect(res).toBe(false);
|
||||||
expect(mermaid.parseError).toHaveBeenCalled();
|
expect(global.mermaid.parseError).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it should return true for a valid flow definition',function(){
|
it('it should return true for a valid flow definition',function(){
|
||||||
spyOn(mermaid,'parseError');
|
spyOn(global.mermaid,'parseError');
|
||||||
var res = mermaid.parse('graph TD;A--x|text including URL space|B;');
|
var res = mermaid.parse('graph TD;A--x|text including URL space|B;');
|
||||||
|
|
||||||
expect(res).toBe(true);
|
expect(res).toBe(true);
|
||||||
expect(mermaid.parseError).not.toHaveBeenCalled();
|
expect(global.mermaid.parseError).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
it('it should return false for an invalid flow definition',function(){
|
it('it should return false for an invalid flow definition',function(){
|
||||||
spyOn(mermaid,'parseError');
|
spyOn(global.mermaid,'parseError');
|
||||||
var res = mermaid.parse('graph TQ;A--x|text including URL space|B;');
|
var res = mermaid.parse('graph TQ;A--x|text including URL space|B;');
|
||||||
|
|
||||||
expect(res).toBe(false);
|
expect(res).toBe(false);
|
||||||
expect(mermaid.parseError).toHaveBeenCalled();
|
expect(global.mermaid.parseError).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it should return true for a valid sequenceDiagram definition',function(){
|
it('it should return true for a valid sequenceDiagram definition',function(){
|
||||||
spyOn(mermaid,'parseError');
|
spyOn(global.mermaid,'parseError');
|
||||||
var str = 'sequenceDiagram\n' +
|
var str = 'sequenceDiagram\n' +
|
||||||
'Alice->Bob: Hello Bob, how are you?\n\n' +
|
'Alice->Bob: Hello Bob, how are you?\n\n' +
|
||||||
'%% Comment\n' +
|
'%% Comment\n' +
|
||||||
|
@ -213,11 +214,11 @@ describe('when using main and ',function() {
|
||||||
var res = mermaid.parse(str);
|
var res = mermaid.parse(str);
|
||||||
|
|
||||||
expect(res).toBe(true);
|
expect(res).toBe(true);
|
||||||
expect(mermaid.parseError).not.toHaveBeenCalled();
|
expect(global.mermaid.parseError).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it should return false for an invalid sequenceDiagram definition',function(){
|
it('it should return false for an invalid sequenceDiagram definition',function(){
|
||||||
spyOn(mermaid,'parseError');
|
spyOn(global.mermaid,'parseError');
|
||||||
var str = 'sequenceDiagram\n' +
|
var str = 'sequenceDiagram\n' +
|
||||||
'Alice:->Bob: Hello Bob, how are you?\n\n' +
|
'Alice:->Bob: Hello Bob, how are you?\n\n' +
|
||||||
'%% Comment\n' +
|
'%% Comment\n' +
|
||||||
|
@ -230,11 +231,11 @@ describe('when using main and ',function() {
|
||||||
var res = mermaid.parse(str);
|
var res = mermaid.parse(str);
|
||||||
|
|
||||||
expect(res).toBe(false);
|
expect(res).toBe(false);
|
||||||
expect(mermaid.parseError).toHaveBeenCalled();
|
expect(global.mermaid.parseError).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it should return true for a valid dot definition',function(){
|
it('it should return true for a valid dot definition',function(){
|
||||||
spyOn(mermaid,'parseError');
|
spyOn(global.mermaid,'parseError');
|
||||||
var res = mermaid.parse('digraph\n' +
|
var res = mermaid.parse('digraph\n' +
|
||||||
'{\n' +
|
'{\n' +
|
||||||
' a -> b -> c -- d -> e;\n' +
|
' a -> b -> c -- d -> e;\n' +
|
||||||
|
@ -242,10 +243,10 @@ describe('when using main and ',function() {
|
||||||
'}');
|
'}');
|
||||||
|
|
||||||
expect(res).toBe(true);
|
expect(res).toBe(true);
|
||||||
expect(mermaid.parseError).not.toHaveBeenCalled();
|
expect(global.mermaid.parseError).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
it('it should return false for an invalid dot definition',function(){
|
it('it should return false for an invalid dot definition',function(){
|
||||||
spyOn(mermaid,'parseError');
|
spyOn(global.mermaid,'parseError');
|
||||||
var res = mermaid.parse('digraph\n' +
|
var res = mermaid.parse('digraph\n' +
|
||||||
'{\n' +
|
'{\n' +
|
||||||
'a -:> b -> c -- d -> e;\n' +
|
'a -:> b -> c -- d -> e;\n' +
|
||||||
|
@ -253,7 +254,7 @@ describe('when using main and ',function() {
|
||||||
'}');
|
'}');
|
||||||
|
|
||||||
expect(res).toBe(false);
|
expect(res).toBe(false);
|
||||||
expect(mermaid.parseError).toHaveBeenCalled();
|
expect(global.mermaid.parseError).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,6 +15,7 @@ var ganttParser = require('./diagrams/gantt/parser/gantt');
|
||||||
var ganttDb = require('./diagrams/gantt/ganttDb');
|
var ganttDb = require('./diagrams/gantt/ganttDb');
|
||||||
var d3 = require('./d3');
|
var d3 = require('./d3');
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
// Default options, can be overridden at initialization time
|
// Default options, can be overridden at initialization time
|
||||||
/**
|
/**
|
||||||
|
@ -234,7 +235,7 @@ var setConf = function(cnf){
|
||||||
|
|
||||||
var j;
|
var j;
|
||||||
for(j=0;j<lvl2Keys.length;j++) {
|
for(j=0;j<lvl2Keys.length;j++) {
|
||||||
//console.log('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
//log.debug('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
||||||
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
||||||
|
|
||||||
config[lvl1Keys[i]] = {};
|
config[lvl1Keys[i]] = {};
|
||||||
|
@ -256,9 +257,19 @@ exports.initialize = function(options){
|
||||||
exports.getConfig = function(){
|
exports.getConfig = function(){
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.parseError = function(err, hash) {
|
||||||
|
if(typeof mermaid !== 'undefined') {
|
||||||
|
mermaid.parseError(err,hash);
|
||||||
|
}else{
|
||||||
|
log.debug('Mermaid Syntax error:');
|
||||||
|
log.debug(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
global.mermaidAPI = {
|
global.mermaidAPI = {
|
||||||
render : exports.render,
|
render : exports.render,
|
||||||
parse : exports.parse,
|
parse : exports.parse,
|
||||||
initialize : exports.initialize,
|
initialize : exports.initialize,
|
||||||
detectType : utils.detectType
|
detectType : utils.detectType,
|
||||||
|
parseError : exports.parseError
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
var api = require('./mermaidAPI.js');
|
var api = require('./mermaidAPI.js');
|
||||||
|
var log = require('./logger').create();
|
||||||
|
|
||||||
describe('when using mermaidAPI and ',function() {
|
describe('when using mermaidAPI and ',function() {
|
||||||
describe('doing initialize ',function() {
|
describe('doing initialize ',function() {
|
||||||
|
@ -52,4 +53,20 @@ describe('when using mermaidAPI and ',function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
describe('checking validity of input ', function(){
|
||||||
|
it('it should return false for an invalid definiton',function(){
|
||||||
|
spyOn(global.mermaidAPI,'parseError');
|
||||||
|
var res = api.parse('this is not a mermaid diagram definition');
|
||||||
|
|
||||||
|
expect(res).toBe(false);
|
||||||
|
expect(global.mermaidAPI.parseError).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
it('it should return true for a valid definiton',function(){
|
||||||
|
spyOn(global.mermaidAPI,'parseError');
|
||||||
|
var res = mermaid.parse('graph TD;A--x|text including URL space|B;');
|
||||||
|
|
||||||
|
expect(res).toBe(true);
|
||||||
|
expect(global.mermaidAPI.parseError).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
26
src/utils.js
26
src/utils.js
|
@ -1,8 +1,21 @@
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
var log = require('./logger').create();
|
||||||
/**
|
/**
|
||||||
|
* @function detectType
|
||||||
* Detects the type of the graph text.
|
* Detects the type of the graph text.
|
||||||
|
* ```mermaid
|
||||||
|
* graph LR
|
||||||
|
* a-->b
|
||||||
|
* b-->c
|
||||||
|
* c-->d
|
||||||
|
* d-->e
|
||||||
|
* e-->f
|
||||||
|
* f-->g
|
||||||
|
* g-->h
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @param {string} text The text defining the graph
|
* @param {string} text The text defining the graph
|
||||||
* @param {string} text The second text defining the graph
|
* @param {string} text The second text defining the graph
|
||||||
* @returns {string} A graph definition key
|
* @returns {string} A graph definition key
|
||||||
|
@ -13,22 +26,27 @@ module.exports.detectType = function(text,a){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*sequence/)){
|
if(text.match(/^\s*sequence/)){
|
||||||
//console.log('Detected sequence syntax');
|
/* ```mermaid
|
||||||
|
graph TB
|
||||||
|
a-->b
|
||||||
|
b-->c
|
||||||
|
```
|
||||||
|
*/
|
||||||
return "sequence";
|
return "sequence";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*digraph/)) {
|
if(text.match(/^\s*digraph/)) {
|
||||||
//console.log('Detected dot syntax');
|
//log.debug('Detected dot syntax');
|
||||||
return "dotGraph";
|
return "dotGraph";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*info/)) {
|
if(text.match(/^\s*info/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "info";
|
return "info";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.match(/^\s*gantt/)) {
|
if(text.match(/^\s*gantt/)) {
|
||||||
//console.log('Detected info syntax');
|
//log.debug('Detected info syntax');
|
||||||
return "gantt";
|
return "gantt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Created by knut on 14-11-23.
|
* Created by knut on 14-11-23.
|
||||||
*/
|
*/
|
||||||
|
var log = require('./logger').create();
|
||||||
describe('when detecting chart type ',function() {
|
describe('when detecting chart type ',function() {
|
||||||
var utils = require('./utils');
|
var utils = require('./utils');
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
|
Loading…
Reference in New Issue