-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooks.js
44 lines (35 loc) · 1.52 KB
/
hooks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var eejs = require("ep_etherpad-lite/node/eejs/");
var exportTxt = require('ep_etherpad-lite/node/utils/ExportTxt');
var less = require('less');
exports.expressCreateServer = function(hook_name, args, cb) {
args.app.get('/p/:pad/:rev?/export/css', function(req, res, next) {
var padID = req.params.pad;
var revision = req.params.rev ? req.params.rev : null;
exportTxt.getPadTXTDocument(padID, revision, false, function(err, result) {
res.contentType('text/css');
res.send(result);
});
});
args.app.get('/p/:pad/:rev?/export/less', function(req, res, next) {
var padID = req.params.pad;
var revision = req.params.rev ? req.params.rev : null;
exportTxt.getPadTXTDocument(padID, revision, false, function(err, result) {
res.contentType('text/css');
less.render(result, function(e, css) {
res.send(css);
});
});
});
};
exports.eejsBlock_exportColumn = function(hook_name, args, cb) {
args.content = args.content + eejs.require("ep_export_less_and_css/templates/exportcolumn.html", {}, module);
return cb();
};
exports.eejsBlock_scripts = function(hook_name, args, cb) {
args.content = args.content + eejs.require("ep_export_less_and_css/templates/scripts.html", {}, module);
return cb();
};
exports.eejsBlock_styles = function(hook_name, args, cb) {
args.content = args.content + eejs.require("ep_export_less_and_css/templates/styles.html", {}, module);
return cb();
};