Skip to content

Commit

Permalink
Fix for issue #259
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Nov 22, 2015
1 parent 989ff03 commit a9f4f8e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 54 deletions.
28 changes: 16 additions & 12 deletions dist/mermaidAPI.slim.js
Original file line number Diff line number Diff line change
Expand Up @@ -29798,7 +29798,8 @@ var config = {
return d.getMonth();
}]]
},
classDiagram: {}
classDiagram: {},
info: {}
};

Logger.setLogLevel(config.logLevel);
Expand Down Expand Up @@ -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) {
Expand Down
29 changes: 17 additions & 12 deletions src/mermaidAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ var config = {
}]
]
},
classDiagram:{}
classDiagram:{},
info:{}
};

Logger.setLogLevel(config.logLevel);
Expand Down Expand Up @@ -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);
}
};

Expand Down
3 changes: 3 additions & 0 deletions test/examples/simpleBasteTag.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
A-->B;
B-->C;
</div>
<div class="mermaid">
info
</div>
<div class="mermaid">
sequenceDiagram
Merchant->>Customer: foo
Expand Down
43 changes: 13 additions & 30 deletions test/web.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../dist/mermaid.forest.css"/>
<script src="../dist/mermaid.min.js"></script>
<script src="../dist/mermaid.js"></script>
<script>
var config = {
startOnLoad:true,
Expand Down Expand Up @@ -47,7 +47,7 @@ <h1>Issue 141!!!</h1>
click A coolAction
B --> D{Rhombus}
C --> D
A("test(vcc) a a ") --> B;
A("test(vcc) a a ") --> B
snda

</div>
Expand Down Expand Up @@ -156,8 +156,9 @@ <h1>Sub graphs</h1>
c1-->a2

</div>
<div class="mermaid" >graph TB
subgraph
<div class="mermaid">
graph TB
subgraph Tjo
sq[Square shape] -.-> ci((Circle shape))
od>Odd shape]-. Two line<br>edge comment .-> ro
di{Diamond with <br/> line break} ==> ro(Rounded<br>square<br>shape)
Expand All @@ -183,12 +184,11 @@ <h1>Sub graphs</h1>
sq[Square shape]-->ci((Circle shape))
od>Odd shape]---|Two line<br>edge comment|ro
end
subgraph
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape]
di{Diamond is broken}-->ro(Rounded squar shape);
di-->ro2(Rounded square shape)
end

subgraph dfdg
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape]
di{Diamond is broken}-->ro(Rounded squar shape)
di-->ro2(Rounded square shape)
end
</div>
<div class="mermaid">
graph LR;
Expand All @@ -201,30 +201,13 @@ <h1>Sub graphs</h1>
C-->|XYZ Router|D;
</div>

<h1>Sequence diagrams (experimental)</h1>
<pre>
sequenceDiagram
participant John the Long
Alice->Bob: Hello Bob, how are you?
Note left of Bob: Bob thinks
Bob-->Alice: I am good thanks!
Bob-->John the Long: How about you John?
Note left of John the Long: Bob thinks
Bob-->Alice: Checking with John...

loop Multiple status checks
loog Naging
Alice->John the Long: Yes... John, how are you?
end
John the Long-->Alice: Better then you!
end
</pre>
<div class="mermaid2">
<h1>Sequence diagrams </h1>
<div class="mermaid">
sequenceDiagram
participant Alice
Note left of Alice: Bob thinks about <br/> things <br/> to think about
</div>
<div class="mermaid2">
<div class="mermaid">
sequenceDiagram
participant Alice
participant Bob
Expand Down

0 comments on commit a9f4f8e

Please sign in to comment.