Allow sequenceDiagram participant aliasing

Fixes gh-263
This commit is contained in:
Richard Gibson
2015-12-06 05:53:08 -05:00
parent 69ce29841d
commit b42939796c
2 changed files with 23 additions and 13 deletions

View File

@@ -2,7 +2,6 @@
* Created by knut on 14-11-19.
*/
var actors = {};
var actorKeys = [];
var messages = [];
var notes = [];
var Logger = require('../../logger');
@@ -11,8 +10,14 @@ var log = new Logger.Log();
exports.addActor = function(id,name,description){
// Don't allow description nulling
var old = actors[id];
if ( old && name === old.name && description == null ) return;
// Don't allow null descriptions, either
if ( description == null ) description = name;
actors[id] = {name:name, description:description};
actorKeys.push(id);
};
exports.addMessage = function(idFrom, idTo, message, answer){
@@ -98,7 +103,7 @@ exports.apply = function(param){
// log.debug(param);
switch(param.type){
case 'addActor':
exports.addActor(param.actor, param.actor, param.actor);
exports.addActor(param.actor, param.actor, param.description);
break;
case 'addNote':
exports.addNote(param.actor,param.placement, param.text);