lib/generate/load_items.js
function(file, file_done) {
    var item = {};
    item.file_path = path.join(nell_site[type_path_key], file);
    item.file_output = generateOutputDetails(nell_site, file, type);
    item.link = item.file_output.link_path;

    var processContent = concat(function(err, file_content_raw) {
      if (err) {
        return file_done(err);
      }
      item.file_content_raw = file_content_raw;
      item.file_metadata = mde.metadata(item.file_content_raw);
      item.file_content = mde.content(item.file_content_raw);

      async.series([
        function(callback) {
          processMarkdown(nell_site, item, callback);
        },
        function(callback) {
          nell_site[type_plural].push(item);
          callback();
        }
      ], file_done);
    });

    var fh = fs.createReadStream(item.file_path, {encoding: 'utf8'});
    fh.on('error', file_done);
    fh.pipe(processContent);
  }
function(file, file_done) {
    var item = {};
    item.file_path = path.join(nell_site[type_path_key], file);
    item.file_output = generateOutputDetails(nell_site, file, type);
    item.link = item.file_output.link_path;

    var processContent = concat(function(err, file_content_raw) {
      if (err) {
        return file_done(err);
      }
      item.file_content_raw = file_content_raw;
      item.file_metadata = mde.metadata(item.file_content_raw);
      item.file_content = mde.content(item.file_content_raw);

      async.series([
        function(callback) {
          processMarkdown(nell_site, item, callback);
        },
        function(callback) {
          nell_site[type_plural].push(item);
          callback();
        }
      ], file_done);
    });

    var fh = fs.createReadStream(item.file_path, {encoding: 'utf8'});
    fh.on('error', file_done);
    fh.pipe(processContent);
  }
function ( file , file_done ) { var item = { } ; item . file_path = path . join ( nell_site [ type_path_key ] , file ) ; item . file_output = generateOutputDetails ( nell_site , file , type ) ; item . link = item . file_output . link_path ; var processContent = concat ( function ( err , file_content_raw ) { if ( err ) { return file_done ( err ) ; } item . file_content_raw = file_content_raw ; item . file_metadata = mde . metadata ( item . file_content_raw ) ; item . file_content = mde . content ( item . file_content_raw ) ; async . series ( [ function ( callback ) { processMarkdown ( nell_site , item , callback ) ; } , function ( callback ) { nell_site [ type_plural ] . push ( item ) ; callback ( ) ; } ] , file_done ) ; } ) ; var fh = fs . createReadStream ( item . file_path , { encoding : 'utf8' } ) ; fh . on ( 'error' , file_done ) ; fh . pipe ( processContent ) ; }
Function to process each item
Function to process each item