<commit_before>/* jshint node: true */
'use strict';

var fs = require('fs')
  , path = require('path')
  , through = require('through')
  , jade = require('jade')
  , tmp = require('tmp')
  , childProcess = require('child_process')
  , duplexer = require('duplexer');

tmp.setGracefulCleanup();

function jadepdf(options) {
  options = options || {};
  options.phantomPath = options.phantomPath || require('phantomjs').path;
  options.cssPath = options.cssPath || __dirname + '/../pdf.css';
  options.paperFormat = options.paperFormat || 'A4';
  options.paperOrientation = options.paperOrientation || 'portrait';
  options.paperBorder = options.paperBorder || '1cm';
  options.renderDelay = options.renderDelay || 500;

  var jadeStr = '';
  var jadeToHtml = through(
    function write(data) {
      jadeStr += data;
    }
  , function end() {
      var html = jade.compile(jadeStr)();
      this.queue(html);
      this.queue(null);
    }
  );

  var inputStream = through()
    , outputStream = through();

  inputStream.pause(); // until we are ready to read
<commit_msg>added locals support<commit_after>/* jshint node: true */
'use strict';

var fs = require('fs')
  , path = require('path')
  , through = require('through')
  , jade = require('jade')
  , tmp = require('tmp')
  , childProcess = require('child_process')
  , duplexer = require('duplexer');

tmp.setGracefulCleanup();

function jadepdf(options) {
  options = options || {};
  options.phantomPath = options.phantomPath || require('phantomjs').path;
  options.cssPath = options.cssPath || __dirname + '/../pdf.css';
  options.paperFormat = options.paperFormat || 'A4';
  options.paperOrientation = options.paperOrientation || 'portrait';
  options.paperBorder = options.paperBorder || '1cm';
  options.renderDelay = options.renderDelay || 500;
  options.locals = options.locals || {};

  var jadeStr = '';
  var jadeToHtml = through(
    function write(data) {
      jadeStr += data;
    }
  , function end() {
      var fn = jade.compile(jadeStr);
      var html = fn(options.locals);
      this.queue(html);
      this.queue(null);
    }
  );

  var inputStream = through()
    , outputStream = through();

  inputStream.pause(); // until we are ready to read

{'fraction_non_alphanumeric': 0.15718763994626064, 'fraction_numerical': 0.0044782803403493054, 'mean_word_length': 3.6252587991718426, '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': '7004083', 'n_tokens_mistral': 721, 'n_tokens_neox': 696, 'n_words': 153}