<commit_before>/*!
 * Pop - HTML processing helpers.
 * Copyright 2011 <NAME>
 * MIT Licensed
 */

/**
 * Module dependencies and local variables.
 */
var jade = require('jade')
  , fs = require('fs')
  , path = require('path')
  , cache = {}
  , _date = require('underscore.date')
  , helpers;

helpers = {
  /**
   * Renders a Jade template
   *
   * @param {String} A Jade template
   * @param {Object} Options passed to Jade
   * @return {String}
   */
  render: function(template, options) {
    var fn = jade.compile(template, options);
    return fn(options.locals);
  },

  /**
   * Pagination links.
   *
   * @param {Object} Paginator object
   * @return {String}
   */
  paginate: function(paginator) {
    var template = '';
    template += '.pages\n';
    template += '  - if (paginator.previousPage)\n';
    template += '    span.prev_next\n';
    template += '      - if (paginator.previousPage === 1)\n';
    template += '        span &larr;\n';
    template += '        a.previous(href="/") Previous\n';
    template += '      - else\n';
    template += '        span &larr;\n';
    template += '        a.previous(href="/page" + paginator.previousPage + "/") Previous\n';
    template += '  - if (paginator.pages > 1)\n';
    template += '    span.prev_next\n';
    template += '      - for (var i = 1; i <= paginator.pages; i++)\n';
    template += '        - if (i === paginator.page)\n';
    template += '          strong.page #{i}\n';
    template += '        - else if (i !== 1)\n';
    template += '          a.page(href="/page" + i + "/") #{i}\n';
    template += '        - else\n';
    template += '          a.page(href="/") 1\n';
    template += '      - if (paginator.nextPage <= paginator.pages)\n';
    template += '        a.next(href="/page" + paginator.nextPage + "/") Next\n';
    template += '        span &rarr;\n';
    return helpers.render(template, { locals: { paginator: paginator } });
  },

  /**
   * Generates paginated blog posts, suitable for use on an index page.
   *
   * @return {String}
   */
  paginatedPosts: function() {
    var template
      , site = this;

    template = ''
      + '- for (var i = 0; i < paginator.items.length; i++)\n'
      + '  !{hNews(paginator.items[i], true)}\n';
    return helpers.render(template, { locals: site.applyHelpers({ paginator: site.paginator }) });
  },

  /**
   * Atom Jade template.
   *
   * @param {String} Feed URL
   * @param {Integer} Number of paragraphs to summarise
   *
   * @return {String}
   */
  atom: function(feed, summarise) {
    var template = ''
      , url = this.config.url
      , title = this.config.title
      , perPage = this.config.perPage
      , posts = this.posts.slice(-perPage)
      , site = this;

    summarise = typeof summarise === 'boolean' && summarise ? 3 : summarise;
    perPage = site.posts.length < perPage ? site.posts.length : perPage;

    template += '!!!xml\n';
    template += 'feed(xmlns="http://www.w3.org/2005/Atom")\n';
    template += '  title #{title}\n';
    template += '  link(href=feed, rel="self")\n';
    template += '  link(href=url)\n';

    if (posts.length > 0)
      template += '  updated #{dx(posts[0].date)}\n';

    template += '  id #{url}\n';
    template += '  author\n';<commit_msg>Updated atom feeds as well<commit_after>/*!
 * Pop - HTML processing helpers.
 * Copyright 2011 <NAME>
 * MIT Licensed
 */

/**
 * Module dependencies and local variables.
 */
var jade = require('jade')
  , fs = require('fs')
  , path = require('path')
  , cache = {}
  , _date = require('underscore.date')
  , helpers;

helpers = {
  /**
   * Renders a Jade template
   *
   * @param {String} A Jade template
   * @param {Object} Options passed to Jade
   * @return {String}
   */
  render: function(template, options) {
    var fn = jade.compile(template, options);
    return fn(options.locals);
  },

  /**
   * Pagination links.
   *
   * @param {Object} Paginator object
   * @return {String}
   */
  paginate: function(paginator) {
    var template = '';
    template += '.pages\n';
    template += '  - if (paginator.previousPage)\n';
    template += '    span.prev_next\n';
    template += '      - if (paginator.previousPage === 1)\n';
    template += '        span &larr;\n';
    template += '        a.previous(href="/") Previous\n';
    template += '      - else\n';
    template += '        span &larr;\n';
    template += '        a.previous(href="/page" + paginator.previousPage + "/") Previous\n';
    template += '  - if (paginator.pages > 1)\n';
    template += '    span.prev_next\n';
    template += '      - for (var i = 1; i <= paginator.pages; i++)\n';
    template += '        - if (i === paginator.page)\n';
    template += '          strong.page #{i}\n';
    template += '        - else if (i !== 1)\n';
    template += '          a.page(href="/page" + i + "/") #{i}\n';
    template += '        - else\n';
    template += '          a.page(href="/") 1\n';
    template += '      - if (paginator.nextPage <= paginator.pages)\n';
    template += '        a.next(href="/page" + paginator.nextPage + "/") Next\n';
    template += '        span &rarr;\n';
    return helpers.render(template, { locals: { paginator: paginator } });
  },

  /**
   * Generates paginated blog posts, suitable for use on an index page.
   *
   * @return {String}
   */
  paginatedPosts: function() {
    var template
      , site = this;

    template = ''
      + '- for (var i = 0; i < paginator.items.length; i++)\n'
      + '  !{hNews(paginator.items[i], true)}\n';
    return helpers.render(template, { locals: site.applyHelpers({ paginator: site.paginator }) });
  },

  /**
   * Atom Jade template.
   *
   * @param {String} Feed URL
   * @param {Integer} Number of paragraphs to summarise
   *
   * @return {String}
   */
  atom: function(feed, summarise) {
    var template = ''
      , url = this.config.url
      , title = this.config.title
      , perPage = this.config.perPage
      , posts = this.posts.slice(0, perPage)
      , site = this;

    summarise = typeof summarise === 'boolean' && summarise ? 3 : summarise;
    perPage = site.posts.length < perPage ? site.posts.length : perPage;

    template += '!!!xml\n';
    template += 'feed(xmlns="http://www.w3.org/2005/Atom")\n';
    template += '  title #{title}\n';
    template += '  link(href=feed, rel="self")\n';
    template += '  link(href=url)\n';

    if (posts.length > 0)
      template += '  updated #{dx(posts[0].date)}\n';

    template += '  id #{url}\n';
    template += '  author\n';
{'fraction_non_alphanumeric': 0.18410170010721397, 'fraction_numerical': 0.005667024046561495, 'mean_word_length': 2.313039066463724, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '4688807', 'n_tokens_mistral': 2196, 'n_tokens_neox': 2138, 'n_words': 490}