Skip to content

Commit 13f021c

Browse files
Port updated
1 parent 03a38ad commit 13f021c

File tree

11 files changed

+668
-9
lines changed

11 files changed

+668
-9
lines changed

controllers/plantuml.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
var plantuml = require('node-plantuml');
22
var plantumlEncoder = require('plantuml-encoder')
3+
var Entities = require('html-entities').XmlEntities;
4+
35

46
var fs = require('fs'),
57
request = require('request');
@@ -8,15 +10,11 @@ exports.generatePng = function(req, res) {
810
console.log("Trying to generate an UML image.")
911

1012
plantuml.useNailgun();
11-
13+
entities = new Entities();
1214
res.set('Content-Type', 'image/png');
1315
var text = req.body.text;
14-
text.replace("&","&");
15-
text.replace("&lt;","<");
16-
text.replace("&gt;",">");
17-
18-
console.log(unescape(encodeURIComponent(text)));
19-
var encoded = plantumlEncoder.encode(unescape(encodeURIComponent(text)));
16+
console.log(entities.decode(text));
17+
var encoded = plantumlEncoder.encode(text);
2018
console.log('http://www.plantuml.com/plantuml/img/'+encoded);
2119
res.status(200).jsonp({text: 'http://www.plantuml.com/plantuml/img/'+encoded})
2220
//request('http://www.plantuml.com/plantuml/img/'+encoded).pipe(res);

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ var Routes = require('./routes/all');
66
utils.getApp().use('/plant', Routes.getRoutes());
77

88
utils.getApp().listen((process.env.PORT || 5000), function() {
9-
console.log("Node server running on http://localhost:3000");
9+
console.log("Node server running on http://localhost:"+process.env.PORT);
1010
console.log("Connected to the database");
1111
});

node_modules/html-entities/LICENSE

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/html-entities/README.md

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/html-entities/index.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/html-entities/lib/html4-entities.js

+147
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/html-entities/lib/html5-entities.js

+190
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)