src/mustache_core.js
function(template){

		// Finds mustache tags with space around them or no space around them.
		return template.replace( mustacheLineBreakRegExp,
			function(whole,
				returnBefore,
				spaceBefore,
				special,
				expression,
				spaceAfter,
				returnAfter,
				// A mustache magic tag that has no space around it.
				spaceLessSpecial,
				spaceLessExpression,
				matchIndex){

			// IE 8 will provide undefined
			spaceAfter = (spaceAfter || "");
			returnBefore = (returnBefore || "");
			spaceBefore = (spaceBefore || "");

			var modeAndExpression = splitModeFromExpression(expression || spaceLessExpression,{});

			// If it's a partial or tripple stache, leave in place.
			if(spaceLessSpecial || ">{".indexOf( modeAndExpression.mode) >= 0) {
				return whole;
			}  else if( "^#!/".indexOf(  modeAndExpression.mode ) >= 0 ) {
				// Return the magic tag and a trailing linebreak if this did not
				// start a new line and there was an end line.
				// Add a normalized leading space, if there was any leading space, in case this abuts a tag name
				spaceBefore = (returnBefore + spaceBefore) && " ";
				return spaceBefore+special+( matchIndex !== 0 && returnAfter.length ? returnBefore+"\n" :"");


			} else {
				// There is no mode, return special with spaces around it.
				return spaceBefore+special+spaceAfter+(spaceBefore.length || matchIndex !== 0 ? returnBefore+"\n" : "");
			}

		});
	}
function(template){

		// Finds mustache tags with space around them or no space around them.
		return template.replace( mustacheLineBreakRegExp,
			function(whole,
				returnBefore,
				spaceBefore,
				special,
				expression,
				spaceAfter,
				returnAfter,
				// A mustache magic tag that has no space around it.
				spaceLessSpecial,
				spaceLessExpression,
				matchIndex){

			// IE 8 will provide undefined
			spaceAfter = (spaceAfter || "");
			returnBefore = (returnBefore || "");
			spaceBefore = (spaceBefore || "");

			var modeAndExpression = splitModeFromExpression(expression || spaceLessExpression,{});

			// If it's a partial or tripple stache, leave in place.
			if(spaceLessSpecial || ">{".indexOf( modeAndExpression.mode) >= 0) {
				return whole;
			}  else if( "^#!/".indexOf(  modeAndExpression.mode ) >= 0 ) {
				// Return the magic tag and a trailing linebreak if this did not
				// start a new line and there was an end line.
				// Add a normalized leading space, if there was any leading space, in case this abuts a tag name
				spaceBefore = (returnBefore + spaceBefore) && " ";
				return spaceBefore+special+( matchIndex !== 0 && returnAfter.length ? returnBefore+"\n" :"");


			} else {
				// There is no mode, return special with spaces around it.
				return spaceBefore+special+spaceAfter+(spaceBefore.length || matchIndex !== 0 ? returnBefore+"\n" : "");
			}

		});
	}
function ( template ) { // Finds mustache tags with space around them or no space around them. return template . replace ( mustacheLineBreakRegExp , function ( whole , returnBefore , spaceBefore , special , expression , spaceAfter , returnAfter , // A mustache magic tag that has no space around it. spaceLessSpecial , spaceLessExpression , matchIndex ) { // IE 8 will provide undefined spaceAfter = ( spaceAfter || "" ) ; returnBefore = ( returnBefore || "" ) ; spaceBefore = ( spaceBefore || "" ) ; var modeAndExpression = splitModeFromExpression ( expression || spaceLessExpression , { } ) ; // If it's a partial or tripple stache, leave in place. if ( spaceLessSpecial || ">{" . indexOf ( modeAndExpression . mode ) >= 0 ) { return whole ; } else if ( "^#!/" . indexOf ( modeAndExpression . mode ) >= 0 ) { // Return the magic tag and a trailing linebreak if this did not // start a new line and there was an end line. // Add a normalized leading space, if there was any leading space, in case this abuts a tag name spaceBefore = ( returnBefore + spaceBefore ) && " " ; return spaceBefore + special + ( matchIndex !== 0 && returnAfter . length ? returnBefore + "\n" : "" ) ; } else { // There is no mode, return special with spaces around it. return spaceBefore + special + spaceAfter + ( spaceBefore . length || matchIndex !== 0 ? returnBefore + "\n" : "" ) ; } } ) ; }
## mustacheCore.cleanLineEndings Removes line breaks accoding to the mustache specification. 
@hide
Prunes line breaks accoding to the mustache specification.
@param {String} template
@return {String}
## mustacheCore . cleanLineEndings Removes line breaks accoding to the mustache specification .