<commit_before><?php namespace Fitztrev\LaravelHtmlMinify;

use Illuminate\View\Compilers\BladeCompiler;

class LaravelHtmlMinifyCompiler extends BladeCompiler {

	public function __construct($files, $cachePath) {
		parent::__construct($files, $cachePath);

		// Add Minify to the list of compilers
		$this->compilers[] = 'Minify';
	}

	/**
	* Compress the HTML output before saving it
	*
	* @param  string  $value
	* @return string
	*/
	protected function compileMinify($value)
	{
		// First, check to make sure there are no <pre> or <textarea> blocks inside the view.
		// If there are, we won't bother to compress this view.
		if ( !preg_match('/<(pre|textarea)/', $value) ) {
			// Remove whitespace characters
			$replace = array(
				"/\n/", // New lines
				"/\r/", // Carriage returns
				"/\t/", // Tabs
				"/ +/", // Multiple spaces
			);
			$value = preg_replace($replace, ' ', $value);
			// Trim any whitespace from the beginning + end of file
			$value = trim($value);
		}
		return $value;
	}

}<commit_msg>remove line breaks instead of replacing with blank space<commit_after><?php namespace Fitztrev\LaravelHtmlMinify;

use Illuminate\View\Compilers\BladeCompiler;

class LaravelHtmlMinifyCompiler extends BladeCompiler {

	public function __construct($files, $cachePath) {
		parent::__construct($files, $cachePath);

		// Add Minify to the list of compilers
		$this->compilers[] = 'Minify';
	}

	/**
	* Compress the HTML output before saving it
	*
	* @param  string  $value
	* @return string
	*/
	protected function compileMinify($value)
	{
		// First, check to make sure there are no <pre> or <textarea> blocks inside the view.
		// If there are, we won't bother to compress this view.
		if ( !preg_match('/<(pre|textarea)/', $value) ) {
			// Remove whitespace characters
			$replace = array(
				"/\n/" => '',  // New lines
				"/\r/" => '',  // Carriage returns
				"/\t/" => ' ', // Tabs
				"/ +/" => ' ', // Multiple spaces
			);
			$value = preg_replace(array_keys($replace), array_values($replace), $value);
		}
		return $value;
	}

}
{'fraction_non_alphanumeric': 0.14750121300339641, 'fraction_numerical': 0.0, 'mean_word_length': 3.2958333333333334, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '5561797', 'n_tokens_mistral': 733, 'n_tokens_neox': 657, 'n_words': 194}