<commit_before>'use strict'

var async = require('async')
var sizlate = require('sizlate')
var getFile = require('./read-file')

var speclate = require('speclate')
console.log('spec', speclate);
var doSizlate = speclate.page.doSizlate
var loadComponents = speclate.components.load

/**
 * used for client side render.
 */
module.exports = function (page, options, callback) {
  async.parallel({
    pageLayout: function (next) {
      var pageLayoutPath = '/pages/' + page.page + '/' + page.page + '.html'
      getFile(pageLayoutPath, next)
    },
    components: function (next) {
      if (page.spec) {
        loadComponents(page.spec, next)
      } else {
        next()
      }
    }
  }, function (err, data) {

    if (err) {
      return callback(err)
    }
    options.before();

    sizlate.render($('html'), {
      '#container': data.pageLayout
    })

    var markup = doSizlate(page, $('html'), data.components)
    options.after();
    callback(null, markup)
  })
}<commit_msg>callback is not a required param<commit_after>'use strict'

var async = require('async')
var sizlate = require('sizlate')
var getFile = require('./read-file')

var speclate = require('speclate')
console.log('spec', speclate);
var doSizlate = speclate.page.doSizlate
var loadComponents = speclate.components.load

/**
 * used for client side render.
 */
module.exports = function (page, options, callback) {
  async.parallel({
    pageLayout: function (next) {
      var pageLayoutPath = '/pages/' + page.page + '/' + page.page + '.html'
      getFile(pageLayoutPath, next)
    },
    components: function (next) {
      if (page.spec) {
        loadComponents(page.spec, next)
      } else {
        next()
      }
    }
  }, function (err, data) {

    if (err) {
      return callback(err)
    }
    options.before();

    sizlate.render($('html'), {
      '#container': data.pageLayout
    })

    var markup = doSizlate(page, $('html'), data.components)
    options.after();
    callback && callback(null, markup)
  })
}
{'fraction_non_alphanumeric': 0.15468517600396628, 'fraction_numerical': 0.0, 'mean_word_length': 2.9568627450980394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3657056', 'n_tokens_mistral': 654, 'n_tokens_neox': 642, 'n_words': 150}