text: // Generated by CoffeeScript 1.9.2
  var _, path;
  
  _ = require("lodash");
  path = require("path");
  
  module.exports = function rewritePostFilenames(pattern) {
    return function(files, m, done) {
      var adding;
      adding = {};
      _.each(files, function(file, filename) {
        if (file.slug) {
          delete files[filename];
          filename = filename.replace(/^(.*)\/([^\/]+)(\.[^\/]+)$/, function(fullMatch, dirname, basename, extname) {
            var fileObj;
            fileObj = {
              dirname: dirname,
              extname: extname,
              basename: basename
            };
            pattern(fileObj, file);
            return path.join(fileObj.dirname, "" + fileObj.basename + fileObj.extname);
          });
          return adding[filename] = file;
        }
      });
      _.extend(files, adding);
      return done();
    };
  };
  