Emits a javascript block inside a +script+ tag, wrapped in CDATA
 doohickeys like all the cool JS kids do.
13705
def javascript(value = nil, attributes = {})
      if value.is_a?(Hash)
        attributes = value
        value      = nil
      elsif block_given? && value
        raise ArgumentError, "You can't pass both a block and a value to javascript -- please choose one."
      end

      script(attributes.merge(:type => "text/javascript")) do
        # Shouldn't this be a "cdata" HtmlPart?
        # (maybe, but the syntax is specific to javascript; it isn't
        # really a generic XML CDATA section.  Specifically,
        # ]]> within value is not treated as ending the
        # CDATA section by Firefox2 when parsing text/html,
        # although I guess we could refuse to generate ]]>
        # there, for the benefit of XML/XHTML parsers).
        output << raw("\n// <![CDATA[\n")
        if block_given?
          yield
        else
          output << raw(value)
        end
        output << raw("\n// ]]>")
        output.append_newline # this forces a newline even if we're not in pretty mode
      end

      output << raw("\n")
    end
665821
function highlightBlock(block, tabReplace, useBR) {
    var text = blockText(block, useBR);
    var language = blockLanguage(block);
    if (language == 'no-highlight')
        return;
    if (language) {
      var result = highlight(language, text);
    } else {
      var result = highlightAuto(text);
      language = result.language;
    }
    var original = nodeStream(block);
    if (original.length) {
      var pre = document.createElement('pre');
      pre.innerHTML = result.value;
      result.value = mergeStreams(original, nodeStream(pre), text);
    }
    result.value = fixMarkup(result.value, tabReplace, useBR);

    var class_name = block.className;
    if (!class_name.match('(\\s|^)(language-)?' + language + '(\\s|$)')) {
      class_name = class_name ? (class_name + ' ' + language) : language;
    }
    if (/MSIE [678]/.test(navigator.userAgent) && block.tagName == 'CODE' && block.parentNode.tagName == 'PRE') {
      // This is for backwards compatibility only. IE needs this strange
      // hack becasue it cannot just cleanly replace <code> block contents.
      var pre = block.parentNode;
      var container = document.createElement('div');
      container.innerHTML = '<pre><code>' + result.value + '</code></pre>';
      block = container.firstChild.firstChild;
      container.firstChild.className = pre.className;
      pre.parentNode.replaceChild(container.firstChild, pre);
    } else {
      block.innerHTML = result.value;
    }
    block.className = class_name;
    block.result = {
      language: language,
      kw: result.keyword_count,
      re: result.relevance
    };
    if (result.second_best) {
      block.second_best = {
        language: result.second_best.language,
        kw: result.second_best.keyword_count,
        re: result.second_best.relevance
      };
    }
  }
893135
function scriptLoader(url, callback) {

			var doc         = document, s = doc.createElement("script")
			  , head        = doc.getElementsByTagName("head")[0]
			  , node
			  , done        = false;
			;

			// On success listener
			function onScriptLoad() {
				if ( !done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") )
				{
					done     = true;
					callback();
				}
			}

			// On failure listener (callback receive an error false)
			function onScriptError() {
				callback(new Error("Packet loading error for " + url));
			}

			// Create the script tag
			node         = document.createElement('script')
			node.type    = config.scriptType || 'text/javascript';
			node.charset = 'utf-8';
			node.async   = true;

			// Listen to the onload event
			if (node.attachEvent &&
					!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0)) {
				node.attachEvent('onreadystatechange', onScriptLoad);
			} else {
				node.addEventListener('load', onScriptLoad, false);
				node.addEventListener('error', onScriptError, false);
			}

			// Set the src value with the packed script url
			node.src = url;

			// Start loading by adding the script tag in the head
			head.appendChild(node);

		}
1243784
public function javascriptTag($contentOrOptionWithBlock, $htmlOptions = null)
    {
        if ($contentOrOptionWithBlock instanceof \Closure) {
            ob_start();
            $contentOrOptionWithBlock();
            $contents = ob_get_clean();
            $htmlOptions = [];
        } elseif ($htmlOptions instanceof \Closure) {
            ob_start();
            $htmlOptions();
            $contents = ob_get_clean();
            $htmlOptions = $contentOrOptionWithBlock;
        } elseif (is_string($contentOrOptionWithBlock)) {
            $contents = $contentOrOptionWithBlock;
            if (!is_array($htmlOptions)) {
                $htmlOptions = [];
            }
        }
        
        return $this->contentTag('script', $contents, $htmlOptions);
    }
543105
function runCodeBlock(codeBlock) {
  var dir = path.dirname(codeBlock.filename);
  return new Promise(function(fulfill, reject) {
    var filenameWithoutDir = codeBlock.filename.replace(dir + '/', '');
    var command = runner(codeBlock, filenameWithoutDir);
    if (command === null) {
      fulfill(codeBlock);
      return;
    }
    exec(command, {cwd: dir}, function(error, stdout, stderr) {
      if (error) {
        console.error(error);
        reject(error);
      } else {
        if (stdout) {
          console.log(stdout);
        }
        if (stderr) {
          console.error(stderr);
        }
        fulfill(codeBlock);
      }
    });
  });
}
856460
function _buildScriptContainer(){
        let parent = document.getElementById('ac__script');
        if (parent == null){
            parent = document.createElement('div');
            parent.id = 'ac__script';
            parent.appendChild(document.createElement('script'));
            document.body.appendChild(parent);
        }
    }
1354270
function _highlightCodeBlock(code_blocks, i, onComplete) {
        if (i < code_blocks.length) {
            var block = code_blocks[i],
                language = _getLanguageForBlock(block);

            if (!_hasClass(block, 'rainbow') && language) {
                language = language.toLowerCase();

                _addClass(block, 'rainbow');

                return _highlightBlockForLanguage(block.innerHTML, language, function(code) {
                    block.innerHTML = code;

                    // reset the replacement arrays
                    replacements = {};
                    replacement_positions = {};

                    // if you have a listener attached tell it that this block is now highlighted
                    if (onHighlight) {
                        onHighlight(block, language);
                    }

                    // process the next block
                    setTimeout(function() {
                        _highlightCodeBlock(code_blocks, ++i, onComplete);
                    }, 0);
                });
            }
            return _highlightCodeBlock(code_blocks, ++i, onComplete);
        }

        if (onComplete) {
            onComplete();
        }
    }
471993
function reRunBlock(block, index, callback){
  growing:
  for(var i=index; i<block.length; i++){ //iterate over the block [body, header, etck] *
    var code=block[i].substr(0,2);//                                            |      |
    if (code=== ">>") {//The only tag  by deffault                         |    |      |
      printBrand(block[i]);//                                              |    |      |
    /*  if(block[i].substr(2)==="default"){                                |    |      |
        if(callback) callback();// // fixes the bug of last element        |    |      |
        else recallback();//                                               |    v      |
      }//                                                                  |           |
   */ //                                                                   v           |
    }//                                                                                |
    for(var ii=0; ii<taggies.length;ii++){//                                           |
        //match user taggies and control if there are some seeds  so executes... *     |
        if(taggies[ii].code === code){//                                         |     |
          if (code[0]==="x") {//user lib needs all control-->callback-mode       |     |
            interf=true;//                                                       |     |
            interfPath="../"+taggies[ii].path+"/index.js";//                     |     |
            indexb=i+1;//                                                        |     |
            scionBlock=block;//                                                  |     |
            scionName= block[i];//                                               |     |
            break growing;//  BREAK THE TWO LOOPS                                |     |
          }//if there are no seeds then, executes next                    |      |     |
           var audreySeed= require("../"+taggies[ii].path+"/index.js");// |      |     |
           var seed= audreySeed();//                                      |      |     |
           var callbackname=block[i];//                                   |      |     |
           seed.grow(callbackname, terminal);//                           V      |     |
        }//                                                                      |     |
    }//                                                                          |     |
   //if it's the last element, callback                                          |     |
     if(i===block.length-1){ //                                    |             |     |
              if(callback) callback();//                           |             |     |
              else recallback();//if it's other                    v             |     |
        }//                                                                      v     |
  }//                                                                                  v
  if(interf){//if the element was a seed then executes interface
    interf=undefined;
    recallback= callback;
    runInterf(block);
  }

}
438962
public static function script(
        string $content, 
        array $attributes = ["type" => "text/javascript"],
        bool $addCdataTag = true
    ) : string
    {
        if ($addCdataTag) {
            $content = "\n//<![CDATA[\n" . $content ."\n//]]>\n";
        }
        return self::tag("script", $content, $attributes);
    }
60902
def nonced_javascript_include_tag(*args, &block)
      opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:script))

      javascript_include_tag(*args, opts, &block)
    end
577668
function injectScriptElement(targetWindow, doc) {
  var Node = targetWindow.Node;
  var HTMLDocument = targetWindow.HTMLDocument;
  var HTMLScriptElement = targetWindow.HTMLScriptElement;
  var proto = HTMLScriptElement.prototype;

  // Listen for sets on innerText.
  // Listen for sets on src.
  // Track when added to DOM via appendChild.

  // Replace appendChild/etc so that we can watch for script adds.
  var originalAppendChild = Node.prototype.appendChild;
  Node.prototype.appendChild = function appendChild(newChild) {
    if (newChild instanceof HTMLScriptElement && !newChild['__wtfi__']) {
      // appendChild(<script>)
      log('appendChild of script', newChild);
      var baseUrl = arguments.callee.caller ?
          arguments.callee.caller['__src'] : null;
      var processedChild = processScript(newChild, false, baseUrl);
      return originalAppendChild.call(this, processedChild);
    } else {
      return originalAppendChild.apply(this, arguments);
    }
  };
  var originalInsertBefore = Node.prototype.insertBefore;
  Node.prototype.insertBefore = function insertBefore(newChild, refChild) {
    if (newChild instanceof HTMLScriptElement && !newChild['__wtfi__']) {
      // insertBefore(<script>, ...)
      log('insertBefore of script', newChild);
      var baseUrl = arguments.callee.caller ?
          arguments.callee.caller['__src'] : null;
      var processedChild = processScript(newChild, false, baseUrl);
      return originalInsertBefore.call(this, processedChild, refChild);
    } else {
      return originalInsertBefore.apply(this, arguments);
    }
  };
  var originalReplaceChild = Node.prototype.replaceChild;
  Node.prototype.replaceChild = function replaceChild(
      newChild, oldChild) {
    if (newChild instanceof HTMLScriptElement && !newChild['__wtfi__']) {
      // replaceChild(<script>, ...)
      log('insertBefore of script', newChild);
      var baseUrl = arguments.callee.caller ?
          arguments.callee.caller['__src'] : null;
      var processedChild = processScript(newChild, false, baseUrl);
      return originalReplaceChild.call(this, processedChild, oldChild);
    } else {
      return originalReplaceChild.apply(this, arguments);
    }
  };

  // Replace document.createElement so we can hook new script elements.
  // var originalCreateElement = HTMLDocument.prototype.createElement;
  // HTMLDocument.prototype.createElement = function createElement(tagName) {
  //   if (tagName.toLowerCase() == 'script') {
  //     // <script>.
  //     var result = originalCreateElement.apply(this, arguments);
  //     log('could instrument <script>', result);
  //     return result;
  //   } else {
  //     return originalCreateElement.apply(this, arguments);
  //   }
  // };
}
626981
function emit(eventName, id, args) {
  var js = "function () { window.socket.emit(\"" + eventName + "\"";

  // we're assuming args is an array of function arguments
  // if not, wrap it
  if (!(args instanceof Array)) {
    args = [args];
  }

  if (id) {
    js += ", " + id + ", " + JSON.stringify(args);
  }

  js += ");}";

  controlPage.evaluate(js);
}
123225
def _emit_style_tag(self, tag, markup, body):
        """"""
        self._emit(tokens.TagOpenOpen(wiki_markup=markup))
        self._emit_text(tag)
        self._emit(tokens.TagCloseOpen())
        self._emit_all(body)
        self._emit(tokens.TagOpenClose())
        self._emit_text(tag)
        self._emit(tokens.TagCloseClose())
359182
function _highlight(node, onComplete) {

        // the first argument can be an Event or a DOM Element
        // I was originally checking instanceof Event but that makes it break
        // when using mootools
        //
        // @see https://github.com/ccampbell/rainbow/issues/32
        //
        node = node && typeof node.getElementsByTagName == 'function' ? node : document;

        var pre_blocks = node.getElementsByTagName('pre'),
            code_blocks = node.getElementsByTagName('code'),
            i,
            final_blocks = [];

        // @see http://stackoverflow.com/questions/2735067/how-to-convert-a-dom-node-list-to-an-array-in-javascript
        // we are going to process all <code> blocks
        for (i = 0; i < code_blocks.length; ++i) {
            final_blocks.push(code_blocks[i]);
        }

        // loop through the pre blocks to see which ones we should add
        for (i = 0; i < pre_blocks.length; ++i) {

            // if the pre block has no code blocks then process it directly
            if (!pre_blocks[i].getElementsByTagName('code').length) {
                final_blocks.push(pre_blocks[i]);
            }
        }

        _highlightCodeBlock(final_blocks, 0, onComplete);
    }
1093721
protected function highlightCodeBlock($codeblock)
	{
		if(($tag=$this->getHighlightTag($codeblock))!==null && ($highlighter=$this->createHighLighter($tag)))
		{
			$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
			$tagLen = strpos($codeblock, $tag)+strlen($tag);
			$codeblock = ltrim(substr($codeblock, $tagLen));
			$output=preg_replace('/<span\s+[^>]*>(\s*)<\/span>/', '\1', $highlighter->highlight($codeblock));
			return "<div class=\"{$this->highlightCssClass}\">".$output."</div>";
		}
		else
			return "<pre>".CHtml::encode($codeblock)."</pre>";
	}
338532
function writeAndRunCodeBlocks(codeBlocks) {
  var dir = '.runnable-markdown-' + rand.generateKey(7);
  return makeTempDir(dir)
  .then(function() {
    return new Promise(function(fulfill, reject) {
      async.mapSeries(codeBlocks, function(codeBlock, callback) {
        appendCodeBlockToFile(codeBlock, dir)
          .then(runCodeBlock)
          .then(function(codeBlock) {
            callback(null, codeBlock);
          })
          .catch(function(err) {
            callback(err, null);
          });
      }, convertAsyncResultToPromise(fulfill, reject));
    });
  })
  .then(function(codeBlocks) {
    return removeOldDir(dir)
      .then(function() {
        return codeBlocks;
      });
  });
}
1346358
function _tag_cdata( &$parser, $cdata ) {
		switch( $this->currentElement ) {
			// Table constraint
			case 'CONSTRAINT':
				if( isset( $this->current_field ) ) {
					$this->addFieldOpt( $this->current_field, $this->currentElement, $cdata );
				} else {
					$this->addTableOpt( $cdata );
				}
				break;
			// Table option
			case 'OPT':
				$this->addTableOpt( $cdata );
				break;
			default:

		}
	}