Beispiel #1
0
module.exports = exports = function(options) {

  options = options || {};

  var compiler = new Rho(options);

  return function(files, metalsmith, done) {
    setImmediate(done);

    Object.keys(files).forEach(function(file) {
      if (!isRhoFile(file))
        return;
      var dir = path.dirname(file)
        , data = files[file]
        , basename = path.basename(file, path.extname(file))
        , target = path.join(dir, basename + '.html');
      debug('processing file: %s', file);
      var html = compiler.toHtml(data.contents.toString());
      data.contents = new Buffer(html);
      delete files[file];
      files[target] = data;
    });
  }

};
Beispiel #2
0
 Object.keys(files).forEach(function(file) {
   if (!isRhoFile(file))
     return;
   var dir = path.dirname(file)
     , data = files[file]
     , basename = path.basename(file, path.extname(file))
     , target = path.join(dir, basename + '.html');
   debug('processing file: %s', file);
   var html = compiler.toHtml(data.contents.toString());
   data.contents = new Buffer(html);
   delete files[file];
   files[target] = data;
 });
Beispiel #3
0
 var BlockCompiler = function(opts) { rho.BlockCompiler.call(this, opts); };