From a9f4f8e06cd1c0d9562593247b7c8aa329e069ee Mon Sep 17 00:00:00 2001 From: knsv Date: Sun, 22 Nov 2015 18:53:09 +0100 Subject: [PATCH] Fix for issue #259 --- dist/mermaidAPI.slim.js | 28 +++++++++++--------- src/mermaidAPI.js | 29 ++++++++++++--------- test/examples/simpleBasteTag.html | 3 +++ test/web.html | 43 ++++++++++--------------------- 4 files changed, 49 insertions(+), 54 deletions(-) diff --git a/dist/mermaidAPI.slim.js b/dist/mermaidAPI.slim.js index e479cb2990..44f5d358a8 100644 --- a/dist/mermaidAPI.slim.js +++ b/dist/mermaidAPI.slim.js @@ -29798,7 +29798,8 @@ var config = { return d.getMonth(); }]] }, - classDiagram: {} + classDiagram: {}, + info: {} }; Logger.setLogLevel(config.logLevel); @@ -30023,18 +30024,21 @@ var render = function render(id, txt, cb, container) { }; exports.render = function (id, text, cb, containerElement) { - log.info('APA'); - if (arguments.length === 1) { - text = id; - id = 'mermaidId0'; - } - - if (typeof document === 'undefined') { - // Todo handle rendering serverside using phantomjs - } else { - // In browser - return render(id, text, cb, containerElement); + try { + if (arguments.length === 1) { + text = id; + id = 'mermaidId0'; } + + if (typeof document === 'undefined') { + // Todo handle rendering serverside using phantomjs + } else { + // In browser + return render(id, text, cb, containerElement); + } + } catch (e) { + log.warn(e); + } }; var setConf = function setConf(cnf) { diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 590839a539..8719acd01f 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -232,7 +232,8 @@ var config = { }] ] }, - classDiagram:{} + classDiagram:{}, + info:{} }; Logger.setLogLevel(config.logLevel); @@ -475,18 +476,22 @@ var render = function(id, txt, cb, container){ }; exports.render = function (id, text, cb, containerElement) { - log.info('APA'); - if(arguments.length === 1){ - text = id; - id = 'mermaidId0'; - } + try{ + if(arguments.length === 1){ + text = id; + id = 'mermaidId0'; + } - if (typeof document === 'undefined') { - // Todo handle rendering serverside using phantomjs - } - else { - // In browser - return render(id, text, cb, containerElement); + if (typeof document === 'undefined') { + // Todo handle rendering serverside using phantomjs + } + else { + // In browser + return render(id, text, cb, containerElement); + } + + }catch(e){ + log.warn(e); } }; diff --git a/test/examples/simpleBasteTag.html b/test/examples/simpleBasteTag.html index 83ec3b7b76..3efabe2647 100644 --- a/test/examples/simpleBasteTag.html +++ b/test/examples/simpleBasteTag.html @@ -19,6 +19,9 @@ A-->B; B-->C; +
+ info +
sequenceDiagram Merchant->>Customer: foo diff --git a/test/web.html b/test/web.html index fdfeb4a941..1ea5bc5654 100644 --- a/test/web.html +++ b/test/web.html @@ -3,7 +3,7 @@ - +