{"size": 616, "ext": "js", "max_stars_repo_path": "_/08/todo/templates/layout.js", "max_stars_repo_name": "paullewallencom/node-978-1-7821-6052-6", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "_/08/todo/templates/layout.js", "max_issues_repo_name": "paullewallencom/node-978-1-7821-6052-6", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "_/08/todo/templates/layout.js", "max_forks_repo_name": "paullewallencom/node-978-1-7821-6052-6", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.0, "max_line_length": 85, "alphanum_fraction": 0.6006493506}
var Plates = require('plates'),
    fs     = require('fs');

var templates = {
  layout : fs.readFileSync(__dirname + '/layout.html', 'utf8'),
  alert  : fs.readFileSync(__dirname + '/alert.html', 'utf8')
};

module.exports = function(main, title, options) {

  if (! options) {
    options = {};
  }

  var data = {
    "main-body": main,
    "title": title,
    'messages': ''
  };

  ['error', 'info'].forEach(function(messageType) {
    if (options[messageType]) {
      data.messages += Plates.bind(templates.alert, {message: options[messageType]});
    }
  });

  return Plates.bind(templates.layout, data);
};