restore noise to html content
7063
function restore_noise($text) {
        while(($pos=strpos($text, '___noise___'))!==false) {
            $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13];
            if (isset($this->noise[$key]))
                $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+14);
        }
        return $text;
    }
95270
function _clearHTMLComments(html) {
        var cStart = '<!--',
            cEnd = '-->',
            beg = html.indexOf(cStart),
            end = 0;

        while (beg !== -1) {
            end = html.indexOf(cEnd, beg + 4);

            if (end === -1) {
                break;
            }

            var comment = html.substring(beg, end + 3);

            if (comment.indexOf("[if") !== -1 || comment.indexOf("![endif]") !== -1) { // skip
                beg = html.indexOf(cStart, end + 3);
                continue;
            }

            html = html.replace(comment, "");
            beg = html.indexOf(cStart, end + 3);
        }

        return html;
    }
339145
def clean():
    """"""
    d = ['build', 'dist', 'scikits.audiolab.egg-info', HTML_DESTDIR,
            PDF_DESTDIR]
    for i in d:
        paver.path.path(i).rmtree()

    (paver.path.path('docs') / options.sphinx.builddir).rmtree()
199989
function replaceHtml(ele, html) {
        var _this = this;

        if (ele.classList.contains('raw-text')) {
            return;
        }
        ele.innerHTML = withEscape( // eslint-disable-line no-undef
        function (html) {
            return function (reg, rep) {
                return _this.htmlSugars.reduce(function (html, _ref) {
                    var _ref2 = _slicedToArray(_ref, 2),
                        regExp = _ref2[0],
                        replace = _ref2[1];

                    return html.replace(regExp, replace);
                }, html).replace(reg, rep);
            };
        })(html);
    }
12109
private function cleanupHtml(): string {
        $topNode = $this->article()->getTopNode();

        if (empty($topNode)) {
            return '';
        }

        $this->removeParagraphsWithFewWords($topNode);

        $html = $this->convertToHtml($topNode);

        return str_replace(['<p></p>', '<p>&nbsp;</p>'], '', $html);
    }
490896
def remove_unnecessary_whitespace(css):
    """"""

    def pseudoclasscolon(css):

        """
        Prevents 'p :link' from becoming 'p:link'.

        Translates 'p :link' into 'p ___PSEUDOCLASSCOLON___link'; this is
        translated back again later.
        """

        regex = re.compile(r"(^|\})(([^\{\:])+\:)+([^\{]*\{)")
        match = regex.search(css)
        while match:
            css = ''.join([
                css[:match.start()],
                match.group().replace(":", "___PSEUDOCLASSCOLON___"),
                css[match.end():]])
            match = regex.search(css)
        return css

    css = pseudoclasscolon(css)
    # Remove spaces from before things.
    css = re.sub(r"\s+([!{};:>+\(\)\],])", r"\1", css)

    # If there is a `@charset`, then only allow one, and move to the beginning.
    css = re.sub(r"^(.*)(@charset \"[^\"]*\";)", r"\2\1", css)
    css = re.sub(r"^(\s*@charset [^;]+;\s*)+", r"\1", css)

    # Put the space back in for a few cases, such as `@media screen` and
    # `(-webkit-min-device-pixel-ratio:0)`.
    css = re.sub(r"\band\(", "and (", css)

    # Put the colons back.
    css = css.replace('___PSEUDOCLASSCOLON___', ':')

    # Remove spaces from after things.
    css = re.sub(r"([!{}:;>+\(\[,])\s+", r"\1", css)

    return css
1225098
function unescapeHTML(html, nestingDepth) {
  var div = document.createElement('div');
  for (var i = 0; i < nestingDepth; i++) {
    div.innerHTML = `<iframe srcdoc="${html}"></iframe>`;
    html = div.childNodes[0].attributes.srcdoc.value;
  }
  return html;
}
911511
def fix_html(x:str) -> str:
    ""
    re1 = re.compile(r'  +')
    x = x.replace('#39;', "'").replace('amp;', '&').replace('#146;', "'").replace(
        'nbsp;', ' ').replace('#36;', '$').replace('\\n', "\n").replace('quot;', "'").replace(
        '<br />', "\n").replace('\\"', '"').replace('<unk>',UNK).replace(' @.@ ','.').replace(
        ' @-@ ','-').replace(' @,@ ',',').replace('\\', ' \\ ')
    return re1.sub(' ', html.unescape(x))
170777
def html(content, **kwargs):
    """"""
    if hasattr(content, 'read'):
        return content
    elif hasattr(content, 'render'):
        return content.render().encode('utf8')

    return str(content).encode('utf8')
1178021
function modifyHTML(page, operations) {
    var html = page.getContent();
    var $ = cheerio.load(html);

    return Promise.forEach(operations, function(op) {
        return op($);
    })
    .then(function() {
        var resultHTML = $.html();
        return page.set('content', resultHTML);
    });
}
256239
function(content) {
    var replaceRegex = /(\r\n|\r|\n)/g;
    if (typeof content === "string" && _globalConfig.fixLineEndings === true) {
      if (_isWindows()) {
        if (/((^|[^\r])\n|\r([^\n]|$))/.test(content)) {
          content = content.replace(replaceRegex, "\r\n");
        }
      } else if (/\r/.test(content)) {
        content = content.replace(replaceRegex, "\n");
      }
    }
    return content;
  }
1142877
function restore() {
    if (isPrevented) {
        const { body } = document;
        if (previousStyles) {
            body.setAttribute('style', previousStyles);
        } else {
            body.removeAttribute('style');
        }

        window.scrollTo(...previousPosition);
        resizeUtil.removeEventListener('', recalculate);
        isPrevented = false;
    }
}
402366
def prettyhtml(value, autoescape=None):
	''
	value = html_cleaner(value)
	return escape(value) if autoescape\
		and not isinstance(value, SafeData) else mark_safe(value)
728697
def _blackbox_partial_noise(blackbox, system):
        """"""
        # Noise inputs from non-output elements hidden in other boxes
        node_tpms = []
        for node in system.nodes:
            node_tpm = node.tpm_on
            for input_node in node.inputs:
                if blackbox.hidden_from(input_node, node.index):
                    node_tpm = marginalize_out([input_node], node_tpm)

            node_tpms.append(node_tpm)

        tpm = rebuild_system_tpm(node_tpms)

        return system._replace(tpm=tpm)
132988
private String unescapeHtml(Object content) {
        return content != null ? content.toString().replace("&lt;", "<").replace("&gt;", ">") : "";
    }
542405
function htmlBeautify(content) {
    const htmlBeautifyOptions = {
        // wrap_line_length: '80',
        indent_size: 2,
        preserve_newlines: false,
        max_preserve_newlines: 0,
        e4x: true,
        unformatted: [
            'a',
            'span',
            'img',
            'code',
            'pre',
            'sub',
            'sup',
            'em',
            'strong',
            'b',
            'i',
            'u',
            'strike',
            'big',
            'small',
            'pre',
            'h1',
            'h2',
            'h3',
            'h4',
            'h5',
            'h6'
        ]
    };

    // if (isProduction) {
    //     return content;
    // }
    return jsBeautify.html(content, htmlBeautifyOptions);
}
1043356
public function minifyHTML(){
        $buffer = $this->response->getContent();
        if(strpos($buffer,'<pre>') !== false)
        {
            $replace = array(
                '/<!--[^\[](.*?)[^\]]-->/s' => '',
                "/<\?php/"                  => '<?php ',
                "/\r/"                      => '',
                "/>\n</"                    => '><',
                "/>\s+\n</"    				=> '><',
                "/>\n\s+</"					=> '><',
            );
        }
        else
        {
            $replace = array(
                '/<!--[^\[](.*?)[^\]]-->/s' => '',
                "/<\?php/"                  => '<?php ',
                "/\n([\S])/"                => '$1',
                "/\r/"                      => '',
                "/\n/"                      => '',
                "/\t/"                      => '',
                "/ +/"                      => ' ',
                '#^\s*//.+$#m'              => '', // remove single comment in JS
            );
        }
        $buffer = preg_replace(array_keys($replace), array_values($replace), $buffer);
        $this->response->setContent($buffer);
    }