lib/content_handler.js
function(basePath, output_extension, options, callback) {
		var self = this;
		var collected_contents = {};
		var content_options = {};
		var last_modified = null;

		// treat files with special output extensions
		if (output_extension !== ".html") {
			basePath = basePath + output_extension;
		}

		self.getContent(basePath, function(err, contents, modified_date) {
			if (!err) {
				collected_contents = _.extend(collected_contents, contents);
				last_modified = modified_date;

				var run_callback = function() {
					return callback(null, collected_contents, content_options, last_modified);
				};

				//fetch shared content
				self.getSharedContent(function(err, shared_content, shared_modified_date) {
					if (!err) {
						collected_contents = _.extend(shared_content, collected_contents);
						if (shared_modified_date > last_modified) {
							last_modified = shared_modified_date;
						}
					}

					return run_callback();
				});
			} else {
				return callback("[Error: Content for " + basePath + " not found]", null, null, {});
			}
		});
	}
function(basePath, output_extension, options, callback) {
		var self = this;
		var collected_contents = {};
		var content_options = {};
		var last_modified = null;

		// treat files with special output extensions
		if (output_extension !== ".html") {
			basePath = basePath + output_extension;
		}

		self.getContent(basePath, function(err, contents, modified_date) {
			if (!err) {
				collected_contents = _.extend(collected_contents, contents);
				last_modified = modified_date;

				var run_callback = function() {
					return callback(null, collected_contents, content_options, last_modified);
				};

				//fetch shared content
				self.getSharedContent(function(err, shared_content, shared_modified_date) {
					if (!err) {
						collected_contents = _.extend(shared_content, collected_contents);
						if (shared_modified_date > last_modified) {
							last_modified = shared_modified_date;
						}
					}

					return run_callback();
				});
			} else {
				return callback("[Error: Content for " + basePath + " not found]", null, null, {});
			}
		});
	}
function ( basePath , output_extension , options , callback ) { var self = this ; var collected_contents = { } ; var content_options = { } ; var last_modified = null ; // treat files with special output extensions if ( output_extension !== ".html" ) { basePath = basePath + output_extension ; } self . getContent ( basePath , function ( err , contents , modified_date ) { if ( ! err ) { collected_contents = _ . extend ( collected_contents , contents ) ; last_modified = modified_date ; var run_callback = function ( ) { return callback ( null , collected_contents , content_options , last_modified ) ; } ; //fetch shared content self . getSharedContent ( function ( err , shared_content , shared_modified_date ) { if ( ! err ) { collected_contents = _ . extend ( shared_content , collected_contents ) ; if ( shared_modified_date > last_modified ) { last_modified = shared_modified_date ; } } return run_callback ( ) ; } ) ; } else { return callback ( "[Error: Content for " + basePath + " not found]" , null , null , { } ) ; } } ) ; }
provide the best matching content for the given arguments
provide the best matching content for the given arguments