<commit_before>var sourceHandler = function (compileStep) {

  // XXX Code copied from
  // packages/templating/plugin/compile-template.js:6
  if (! compileStep.arch.match(/^browser(\.|$)/))
    return;

  // Parse and compile the content
  var content = compileStep.read().toString('utf8');
  var parser  = new Parser(content, compileStep.inputPath, { lexer: Lexer });
  var results = new Compiler(parser.parse()).compile();

  // Head
  if (results.head !== null) {
    compileStep.appendDocument({
      section: "head",
      data: HTML.toHTML(results.head)
    });
  }

  // Generate the final js file
  // XXX generate a source map
  var content = "";

  // Body
  if (results.body !== null) {
    content += "\nUI.body.contentParts.push(UI.Component.extend({";
    content += "render: " + Spacebars.codeGen(results.body, { isBody: true });
    content += "}));\n";
    content += "\nMeteor.startup(function () { if (! UI.body.INSTANTIATED) {\n";
    content += "  UI.body.INSTANTIATED = true; UI.materialize(UI.body, document.body);\n";
    content += "}});\n";
  }

  // Templates
  _.forEach(results.templates, function (tree, tplName) {
    content += "\nTemplate.__define__(\"" + tplName +"\", ";
    content += Spacebars.codeGen(tree, { isTemplate: true });
    content += ");\n";
  });

  if (content !== "") {
    compileStep.addJavaScript({
      path: compileStep.inputPath + '.js',
      sourcePath: compileStep.inputPath,
      data: content
    });
  }
}

Plugin.registerSourceHandler("jade", sourceHandler);

// XXX This is related to the following Meteor hack:
// https://github.com/meteor/meteor/blob/ae67643a3f2de0dd9fb8db7f7bd8e1c6fe2ba285/tools/files.js#L42
Plugin.registerSourceHandler("jade.html", sourceHandler);<commit_msg>Add the new `isTemplate` flag to the jade handler see https://github.com/meteor/meteor/commit/f36abc946e6623881274e90769e8ff8ef953e52e<commit_after>var sourceHandler = function (compileStep) {

  // XXX Code copied from
  // packages/templating/plugin/compile-template.js:6
  if (! compileStep.arch.match(/^browser(\.|$)/))
    return;

  // Parse and compile the content
  var content = compileStep.read().toString('utf8');
  var parser  = new Parser(content, compileStep.inputPath, { lexer: Lexer });
  var results = new Compiler(parser.parse()).compile();

  // Head
  if (results.head !== null) {
    compileStep.appendDocument({
      section: "head",
      data: HTML.toHTML(results.head)
    });
  }

  // Generate the final js file
  // XXX generate a source map
  var content = "";

  // Body
  if (results.body !== null) {
    content += "\nUI.body.contentParts.push(UI.Component.extend({";
    content += "render: " + Spacebars.codeGen(results.body, { isBody: true });
    content += "}));\n";
    content += "\nMeteor.startup(function () { if (! UI.body.INSTANTIATED) {\n";
    content += "  UI.body.INSTANTIATED = true; UI.materialize(UI.body, document.body);\n";
    content += "}});\n";
  }

  // Templates
  _.forEach(results.templates, function (tree, tplName) {
    content += "\nTemplate.__define__(\"" + tplName +"\", ";
    content += Spacebars.codeGen(tree, { isTemplate: true });
    content += ");\n";
  });

  if (content !== "") {
    compileStep.addJavaScript({
      path: compileStep.inputPath + '.js',
      sourcePath: compileStep.inputPath,
      data: content
    });
  }
}

Plugin.registerSourceHandler("jade", { isTemplate: true }, sourceHandler);

// Backward compatibility with Meteor <= 0.8
// XXX This is related to the following Meteor hack:
// https://github.com/meteor/meteor/blob/ae67643a3f2de0dd9fb8db7f7bd8e1c6fe2ba285/tools/files.js#L42
Plugin.registerSourceHandler("jade.html", sourceHandler);
{'fraction_non_alphanumeric': 0.16765980498374863, 'fraction_numerical': 0.020314192849404118, 'mean_word_length': 3.4493975903614458, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 3, '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': '2801255', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1194, 'n_words': 246}