Minifies the HTML page.

Replaces output buffer with minified HTML.
339562
public function minify()
    {
        if ($this->isHTML() && class_exists('Minify_HTML'))
        {
            $page = ob_get_contents();
            ob_clean();
            echo Minify_HTML::minify($page);
        }
    }
877570
function minimizeStyles(message) {
  var nestingDepth = message.frameIndex.split('.').length - 1;
  var iframe = document.createElement('iframe');
  document.body.appendChild(iframe);
  iframe.setAttribute(
      'style',
      `height: ${message.windowHeight}px;` + 
      `width: ${message.windowWidth}px;`);

  var html = message.html.join('');
  html = unescapeHTML(html, nestingDepth);
  iframe.contentDocument.documentElement.innerHTML = html;
  var doc = iframe.contentDocument;

  // Remove entry in |message.html| where extra style element was specified.
  message.html[message.pseudoElementTestingStyleIndex] = '';
  var finalPseudoElements = [];
  for (var selector in message.pseudoElementSelectorToCSSMap) {
    minimizePseudoElementStyle(message, doc, selector, finalPseudoElements);
  }

  if (finalPseudoElements.length > 0) {
    message.html[message.pseudoElementPlaceHolderIndex] =
        `<style>${finalPseudoElements.join(' ')}</style>`;
  }

  if (message.rootStyleIndex) {
    minimizeStyle(
        message,
        doc,
        doc.documentElement,
        message.rootId,
        message.rootStyleIndex);
  }

  for (var id in message.idToStyleIndex) {
    var index = message.idToStyleIndex[id];
    var element = doc.getElementById(id);
    if (element) {
      minimizeStyle(message, doc, element, id, index);
    }
  }
  iframe.remove();
}
601725
def minify(tokens, options):
    
    # Remove comments
    remove_comments(tokens)
    # Remove docstrings
    remove_docstrings(tokens)
    result = token_utils.untokenize(tokens)
    # Minify our input script
    result = multiline_indicator.sub('', result)
    result = fix_empty_methods(result)
    result = join_multiline_pairs(result)
    result = join_multiline_pairs(result, '[]')
    result = join_multiline_pairs(result, '{}')
    result = remove_blank_lines(result)
    result = reduce_operators(result)
    result = dedent(result, use_tabs=options.tabs)
    return result
723641
protected void html() {
        int p = bp;
        nextChar();
        if (isIdentifierStart(ch)) {
            String name = readIdentifier();
            checkHtmlTag(name);
            htmlAttrs();
            if (ch == '/') {
                nextChar();
            }
            if (ch == '>') {
                nextChar();
                return;
            }
        } else if (ch == '/') {
            nextChar();
            if (isIdentifierStart(ch)) {
                readIdentifier();
                skipWhitespace();
                if (ch == '>') {
                    nextChar();
                    return;
                }
            }
        } else if (ch == '!') {
            nextChar();
            if (ch == '-') {
                nextChar();
                if (ch == '-') {
                    nextChar();
                    while (bp < buflen) {
                        int dash = 0;
                        while (ch == '-') {
                            dash++;
                            nextChar();
                        }
                        // Strictly speaking, a comment should not contain "--"
                        // so dash > 2 is an error, dash == 2 implies ch == '>'
                        // See http://www.w3.org/TR/html-markup/syntax.html#syntax-comments
                        // for more details.
                        if (dash >= 2 && ch == '>') {
                            nextChar();
                            return;
                        }

                        nextChar();
                    }
                }
            }
        }

        bp = p + 1;
        ch = buf[bp];
    }
694860
public static function minify($buffer)
    {
        $search = [
            // Strip whitespaces after tags, except space
            '/\>[^\S]+/s',

            // Strip whitespaces before tags, except space
            '/[^\S]+\</s',

            // Shorten multiple whitespace sequences
            '/(\s)+/s',
        ];

        $replace = [
            '>',
            '<',
            '\\1',
        ];

        $buffer = preg_replace($search, $replace, $buffer);

        return $buffer;
    }
2192
function minify(src) {
       // remove comments
       src = src.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, "$1"); // Remove leading and trailing whitespace from lines

       src = src.replace(/(\\n\s+)|(\s+\\n)/g, ""); // Remove line breaks

       src = src.replace(/(\\r|\\n)+/g, ""); // Remove unnecessary whitespace

       src = src.replace(/\s*([;,[\](){}\\\/\-+*|^&!=<>?~%])\s*/g, "$1");
       return src;
     }
1307947
public void dumpTo(Page page, PrintWriter out)
    {
        if (produceHeader)
        {
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>");
            out.println("<title>" + page.getTitle() + "</title>");
            out.println("<meta charset=\"utf-8\">");
            out.println("<meta name=\"generator\" content=\"FITLayout - box tree dump\">");
            out.println("</head>");
            out.println("<body>");
        }
        recursiveDumpBoxes(page.getRoot(), 1, out);
        if (produceHeader)
        {
            out.println("</body>");
            out.println("</html>");
        }
    }
1040390
function onPage(output, page) {
    var options = output.getOptions();

    // Inline assets
    return Modifiers.modifyHTML(page, [
        Modifiers.inlineAssets(options.get('root'), page.getFile().getPath())
    ])

    // Write page using website generator
    .then(function(resultPage) {
        return WebsiteGenerator.onPage(output, resultPage);
    });
}
167490
def minify_file(self, target):
        
        html = open(target, 'rb').read()
        enc = chardet.detect(html)['encoding']
        with codecs.open(target, 'r+', enc) as f:
            result = htmlmin.minify(f.read(), **self.options)
            f.seek(0)
            f.write(result)
            f.truncate()
221607
function fillRemainingHolesAndMinimizeStyles(messages, i) {
  var html = messages[i].html;
  var frameHoles = messages[i].frameHoles;
  for (var index in frameHoles) {
    if (frameHoles.hasOwnProperty(index)) {
      var frameIndex = frameHoles[index];
      for (var j = 0; j < messages.length; j++) {
        if (messages[j].frameIndex == frameIndex) {
          fillRemainingHolesAndMinimizeStyles(messages, j);
          html[index] = messages[j].html.join('');
        }
      }
    }
  }
  minimizeStyles(messages[i]);
}
427802
public final void decreaseReadBufferSize() {
        if (deferDecreaseReadBuffer) {
            deferDecreaseReadBuffer = false;
            return;
        }

        if (AbstractIoSessionConfig.ENABLE_BUFFER_SIZE) {
            System.out.println("AbstractIoSession.decreaseReadBufferSize()");
            if (getConfig().getReadBufferSize() > getConfig().getMinReadBufferSize()) {
                getConfig().setReadBufferSize(getConfig().getReadBufferSize() >>> 1);
            }
        }

        deferDecreaseReadBuffer = true;
    }
610497
public static function compressPage()
    {
        register_shutdown_function(function () {
            $buffer = preg_replace(['/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'], ['>', '<', '\\1'], ob_get_contents());
            ob_end_clean();
            if (!((ini_get('zlib.output_compression') == 'On' ||
                        ini_get('zlib.output_compression_level') > 0) ||
                    ini_get('output_handler') == 'ob_gzhandler') &&
                !empty($_SERVER['HTTP_ACCEPT_ENCODING']) &&
                extension_loaded('zlib') &&
                strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false
            ) {
                ob_start('ob_gzhandler');
            }
            echo $buffer;
        });
    }
1201020
function _flattenBufferIn () {
  if (this._isStreamInput()) {
    this.options.input.buffer = Buffer.concat(this.options.input.buffer);
  }
}
180865
def render(self, parsed, page=False, minify=False):
        
        rendered = []
        for i, p in enumerate(parsed):
            if i == 0:
                settings = p.get("settings", {})
                self.direction = settings.get("direction", DEFAULT_DIR)
                self.lang = settings.get("lang", DEFAULT_LANG)
            rendered.append(self.render_ents(p["text"], p["ents"], p.get("title")))
        if page:
            docs = "".join([TPL_FIGURE.format(content=doc) for doc in rendered])
            markup = TPL_PAGE.format(content=docs, lang=self.lang, dir=self.direction)
        else:
            markup = "".join(rendered)
        if minify:
            return minify_html(markup)
        return markup
934779
public static function minify($input)
    {
        $input = self::merge($input);
        $input = str_replace(array("\r", "\n"), '', $input);
        $input = preg_replace('`([^*/])\/\*([^*]|[*](?!/)){5,}\*\/([^*/])`Us', '$1$3', $input);
        $input = preg_replace('`\s*({|}|,|:|;)\s*`', '$1', $input);
        $input = str_replace(';}', '}', $input);
        $input = preg_replace('`(?=|})[^{}]+{}`', '', $input);
        $input = preg_replace('`[\s]+`', ' ', $input);
        return $input;
    }
166641
def render(self, parsed, page=False, minify=False):
        
        # Create a random ID prefix to make sure parses don't receive the
        # same ID, even if they're identical
        id_prefix = uuid.uuid4().hex
        rendered = []
        for i, p in enumerate(parsed):
            if i == 0:
                settings = p.get("settings", {})
                self.direction = settings.get("direction", DEFAULT_DIR)
                self.lang = settings.get("lang", DEFAULT_LANG)
            render_id = "{}-{}".format(id_prefix, i)
            svg = self.render_svg(render_id, p["words"], p["arcs"])
            rendered.append(svg)
        if page:
            content = "".join([TPL_FIGURE.format(content=svg) for svg in rendered])
            markup = TPL_PAGE.format(
                content=content, lang=self.lang, dir=self.direction
            )
        else:
            markup = "".join(rendered)
        if minify:
            return minify_html(markup)
        return markup
1103752
function htmlSanitizer(html, needHtmlText) {
  const $html = $('<div />');

  html = html.replace(/<!--[\s\S]*?-->/g, '');

  $html.append(html);

  removeUnnecessaryTags($html);
  leaveOnlyWhitelistAttribute($html);

  return finalizeHtml($html, needHtmlText);
}