mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-23 09:20:03 +02:00
Initial fix for defect #162.
This commit is contained in:
@@ -18,7 +18,8 @@ var funs = [];
|
||||
* @param style
|
||||
*/
|
||||
exports.addVertex = function (id, text, type, style) {
|
||||
|
||||
var txt;
|
||||
|
||||
if(typeof id === 'undefined'){
|
||||
return;
|
||||
}
|
||||
@@ -30,7 +31,14 @@ exports.addVertex = function (id, text, type, style) {
|
||||
vertices[id] = {id: id, styles: [], classes:[]};
|
||||
}
|
||||
if (typeof text !== 'undefined') {
|
||||
vertices[id].text = text.trim();
|
||||
txt = text.trim();
|
||||
|
||||
// strip quotes if string starts and exnds with a quote
|
||||
if(txt[0] === '"' && txt[txt.length-1] === '"'){
|
||||
txt = txt.substring(1,txt.length-1);
|
||||
}
|
||||
|
||||
vertices[id].text = txt;
|
||||
}
|
||||
if (typeof type !== 'undefined') {
|
||||
vertices[id].type = type;
|
||||
@@ -61,6 +69,11 @@ exports.addLink = function (start, end, type, linktext) {
|
||||
|
||||
if (typeof linktext !== 'undefined') {
|
||||
edge.text = linktext.trim();
|
||||
|
||||
// strip quotes if string starts and exnds with a quote
|
||||
if(edge.text[0] === '"' && edge.text[edge.text.length-1] === '"'){
|
||||
edge.text = edge.text.substring(1,edge.text.length-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof type !== 'undefined') {
|
||||
|
Reference in New Issue
Block a user