<commit_before>package air

import (
	"io"

	"github.com/tdewolff/minify"
	"github.com/tdewolff/minify/css"
	"github.com/tdewolff/minify/html"
	"github.com/tdewolff/minify/js"
	"github.com/tdewolff/minify/json"
	"github.com/tdewolff/minify/svg"
	"github.com/tdewolff/minify/xml"
)

type (
	// Minifier is used to provide a `Minify()` method for an `Air` instance for minifies a
	// content by a MIME type.
	Minifier interface {
		// Init initializes the `Minifier`. It will be called in the `Air#Serve()`.
		Init() error

		// Minify minifies the r into the w by the MIMEType.
		Minify(MIMEType string, w io.Writer, r io.Reader) error
	}

	// minifier implements the `Minifier` by using the "github.com/tdewolff/minify".
	minifier struct {
		*minify.M
	}
)

// newMinifier returns a pointer of a new instance of the `minifier`.
func newMinifier() *minifier {
	return &minifier{
		M: minify.New(),
	}
}

// Init implements the `Minifier#Init()` by using the "github.com/tdewolff/minify".
func (m *minifier) Init() error {
	m.Add(MIMETextHTML, &html.Minifier{
		KeepDefaultAttrVals: true,
		KeepDocumentTags:    true,
		KeepWhitespace:      true,<commit_msg>refactor: increase the compression ratio of "text/html"<commit_after>package air

import (
	"io"

	"github.com/tdewolff/minify"
	"github.com/tdewolff/minify/css"
	"github.com/tdewolff/minify/html"
	"github.com/tdewolff/minify/js"
	"github.com/tdewolff/minify/json"
	"github.com/tdewolff/minify/svg"
	"github.com/tdewolff/minify/xml"
)

type (
	// Minifier is used to provide a `Minify()` method for an `Air` instance for minifies a
	// content by a MIME type.
	Minifier interface {
		// Init initializes the `Minifier`. It will be called in the `Air#Serve()`.
		Init() error

		// Minify minifies the r into the w by the MIMEType.
		Minify(MIMEType string, w io.Writer, r io.Reader) error
	}

	// minifier implements the `Minifier` by using the "github.com/tdewolff/minify".
	minifier struct {
		*minify.M
	}
)

// newMinifier returns a pointer of a new instance of the `minifier`.
func newMinifier() *minifier {
	return &minifier{
		M: minify.New(),
	}
}

// Init implements the `Minifier#Init()` by using the "github.com/tdewolff/minify".
func (m *minifier) Init() error {
	m.Add(MIMETextHTML, &html.Minifier{
		KeepWhitespace: true,
{'fraction_non_alphanumeric': 0.12920122217372326, 'fraction_numerical': 0.0, 'mean_word_length': 3.794979079497908, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '45402', 'n_tokens_mistral': 907, 'n_tokens_neox': 886, 'n_words': 229}