Telegram Web, preconfigured for usage in I2P. http://web.telegram.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
758 B

11 years ago
var util = require('util');
var TEMPLATE = '' +
'window.__html__ = window.__html__ || {};\n' +
'window.__html__[\'%s\'] = \'%s\'';
var escapeContent = function(content) {
return content.replace(/'/g, '\\\'').replace(/\r?\n/g, '\\n\' +\n \'');
};
var createHtml2JsPreprocessor = function(logger, basePath) {
var log = logger.create('preprocessor.html2js');
return function(content, file, done) {
log.debug('Processing "%s".', file.originalPath);
var htmlPath = file.originalPath.replace(basePath + '/', '');
file.path = file.path + '.js';
done(util.format(TEMPLATE, htmlPath, escapeContent(content)));
};
};
createHtml2JsPreprocessor.$inject = ['logger', 'config.basePath'];
module.exports = createHtml2JsPreprocessor;