<commit_before>'use strict';

let fs = require('fs'),
    path = require('path');

class PugTheme {

  constructor(manager) {
    this.manager = manager;
    this.core = manager.core;
    this.cache = {};
  }

  register(res) {
    /**
     * This sets up the pug lexer and allows us to go through it before
     * the paths get used.
     */
    let self = this;
    res.locals.plugins = [{
      postLex: function(value, options) {
        self.postPugLexer(res, value, options);
        return value;
      }
    }];<commit_msg>make the pug plugins work nicely with other pug plugins<commit_after>'use strict';

let fs = require('fs'),
    path = require('path');

class PugTheme {

  constructor(manager) {
    this.manager = manager;
    this.core = manager.core;
    this.cache = {};
  }

  register(res) {
    /**
     * This sets up the pug lexer and allows us to go through it before
     * the paths get used.
     */
    let self = this;
    if (typeof res.locals.plugins !== 'undefined' && !Array.isArray(res.locals.plugins)) {
      throw new Error('res.locals.plugins is already in use - perhaps by a different node module');
    }
    if (typeof res.locals.plugins === 'undefined') {
      res.locals.plugins = [];
    }
    res.locals.plugins.push({
      postLex: function(value, options) {
        self.postPugLexer(res, value, options);
        return value;
      }
    });
{'fraction_non_alphanumeric': 0.1306532663316583, 'fraction_numerical': 0.0, 'mean_word_length': 2.4676616915422884, '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': '6757506', 'n_tokens_mistral': 441, 'n_tokens_neox': 431, 'n_words': 124}