<commit_before>var Template = require('..');
var template = new Template();


/**
 * This example shows how to create a new template type, `includes`.
 *
 * This template type will allow you to load partials/includes the way
 * you would expect, so that any loaded templates can be used in other
 * templates as _includes_.
 *
 * Also note the callback function, this is a middleware that will be
 * executed every time a template is loaded using the `.include()` and
 * `.includes()` methods.
 */

template.create('include', function (value, key, next) {
  console.log(arguments);
  next();
});


/**
 * Example usage
 */


template.include('sidebar', {content: '<nav>This is a lame sidebar!</nav>'});
template.include('alert', {content: '<nav>This is a lame sidebar!</nav>'});

console.log(template.get('includes'))<commit_msg>usage example<commit_after>var Template = require('..');
var template = new Template();


/**
 * This example shows how to create a new template type, `includes`.
 *
 * This template type will allow you to load partials/includes the way
 * you would expect, so that any loaded templates can be used in other
 * templates as _includes_.
 *
 * Also note the callback function, this is a middleware that will be
 * executed every time a template is loaded using the `.include()` and
 * `.includes()` methods.
 */

template.create('include', { isPartial: true, isLayout: true }, function (value, key, next) {
  console.log(arguments);
  next(null, value, key);
});


/**
 * Example usage
 */

template.include('block', {content: '<bar>{% body %}</bar>'}); // useless example wrapper
template.include('alert', {content: '<baz class="alert">Heads up!</baz>', layout: 'block'});
template.include('sidebar', {content: '<nav>This is a lame sidebar!</nav>'});
// console.log(template.get('includes'));


template.page('home.md', {content: '<foo><%= include("alert") %></foo>'});
template.render('home.md', function (err, res) {
  console.log(res)
})

{'fraction_non_alphanumeric': 0.16201117318435754, 'fraction_numerical': 0.0, 'mean_word_length': 4.518207282913165, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '2439537', 'n_tokens_mistral': 571, 'n_tokens_neox': 552, 'n_words': 212}