Take a jyt element and render it to an HTML string
@param element
@param opts
769874
function render(element, opts) {
    opts = opts || {};

    var prepend = opts.prepend;
    var model = opts.model || {};
    var indentLevel = opts.indentLevel || 0;
    var isPretty = opts.isPretty;
    var jtPrintIndent = isPretty ? '\t' : '';
    var jtPrintNewline = isPretty ? '\n' : '';
    var indent = '', i, len, prop;
    var p = [];  // p is going to be our concatenator for the HTML string

    // if no element, then no HTML so return empty string
    if (!element) { return ''; }

    // if already a string, just return it
    if (utils.isString(element)) { return element; }

    // if an array, wrap it
    if (utils.isArray(element)) { element = naked(element, null); }

    // set the indentation level to the current indent
    if (isPretty && indentLevel) {
        for (i = 0; i < indentLevel; i++) {
            indent += jtPrintIndent;
        }
    }

    // if we are prepending some string, add it first
    if (prepend) {
        p.push(indent, prepend, jtPrintNewline);
    }

    // starting tag open
    if (element.tag) {
        p.push(indent, '<', element.tag);
    }

    // all tag attributes
    if (element.attributes) {
        for (prop in element.attributes) {
            if (element.attributes.hasOwnProperty(prop)) {

                if (element.attributes[prop] === null) {
                    p.push(' ', prop);
                }
                else {
                    p.push(' ', prop, '="', element.attributes[prop], '"');
                }
            }
        }
    }

    // if no children or text, then close the tag
    if (element.tag && !element.children && (element.text === undefined || element.text === null)) {

        // for self closing we just close it, else we add the end tag
        if (selfClosing.indexOf(element.tag) > -1) {
            p.push('/>', jtPrintNewline);
        }
        else {
            p.push('></', element.tag, '>', jtPrintNewline);
        }
    }
    // else we need to add children or the inner text
    else {

        // if a tag (i.e. not just a string literal) put end bracket
        if (element.tag) { p.push('>'); }

        // if children, we will need to recurse
        if (element.children) {
            if (element.tag) { p.push(jtPrintNewline); }

            // recurse down for each child
            for (i = 0, len = element.children.length; i < len; ++i) {
                p.push(render(element.children[i], {
                    indentLevel:    element.tag ? indentLevel + 1 : indentLevel,
                    isPretty:       isPretty,
                    model:          model
                }));
            }

            if (element.tag) { p.push(indent); }
        }

        // if text, simply add it
        if (element.text !== null && element.text !== undefined) { p.push(element.text); }

        // finally if a tag, add close tag
        if (element.tag) {
            p.push('</', element.tag, '>', jtPrintNewline);
        }
    }

    return p.join('');
}
660052
@Override
    public void compile(JQElement element, JSON attrs) {
        String text = SafeHtmlUtils.htmlEscape(element.text());
        element.empty().append(prettifier.prettify(text));
    }
487894
function (opts, callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (this.readyState == 4 ) {
        if (this.status == 204){
          //success
          return callback(null);
        }else {
          return callback(this.statusText);
        }
      }
    };

    xhttp.open(opts.method, opts.host + '/' + opts.path, true);
    for (var header in opts.headers){
      var headerValue = opts.headers[header];
      xhttp.setRequestHeader(header, headerValue)
    }
    xhttp.send(opts.body);
  }
1108701
function(opt) {

        opt = opt || {};
        var highlighterDef = opt.highlighter;
        var paperOpt = this.options;

        /*
            Expecting opt.highlighter to have the following structure:
            {
                name: 'highlighter-name',
                options: {
                    some: 'value'
                }
            }
        */
        if (highlighterDef === undefined) {

            // check for built-in types
            var type = ['embedding', 'connecting', 'magnetAvailability', 'elementAvailability'].find(function(type) {
                return !!opt[type];
            });

            highlighterDef = (type && paperOpt.highlighting[type]) || paperOpt.highlighting['default'];
        }

        // Do nothing if opt.highlighter is falsey.
        // This allows the case to not highlight cell(s) in certain cases.
        // For example, if you want to NOT highlight when embedding elements.
        if (!highlighterDef) return false;

        // Allow specifying a highlighter by name.
        if (joint.util.isString(highlighterDef)) {
            highlighterDef = {
                name: highlighterDef
            };
        }

        var name = highlighterDef.name;
        var highlighter = paperOpt.highlighterNamespace[name];

        // Highlighter validation
        if (!highlighter) {
            throw new Error('Unknown highlighter ("' + name + '")');
        }
        if (typeof highlighter.highlight !== 'function') {
            throw new Error('Highlighter ("' + name + '") is missing required highlight() method');
        }
        if (typeof highlighter.unhighlight !== 'function') {
            throw new Error('Highlighter ("' + name + '") is missing required unhighlight() method');
        }

        return {
            highlighter: highlighter,
            options: highlighterDef.options || {},
            name: name
        };
    }
414600
function getHtml(uipart, options) {
    options = options || {};
    var me = this;

    // if any subviews, add them as dependencies
    var model = {
        isMobile: options.isMobile,
        appName: options.appName,
        pageCssId: options.appName + 'PageCssId'
    };
    var deps = _.extend({
        subviews: {},
        model: model,
        pageContent: options.pageContent || ' ',
        sideviewContent: options.sideviewContent || ' '
    }, this.getJangularDeps());

    _.each(uipart.subviews, function (subview, subviewName) {
        deps.subviews[subviewName] = me.pancakes.cook(subview, { dependencies: deps });
    });

    // cook the view; the result will be jeff objects
    var view = this.pancakes.cook(uipart.view, { dependencies: deps });

    // we can now generate HTML off the jyt objects (using jyt render so angular NOT interpreted)
    var html = jangular.jytRender(view);
    html = html.replace(/\'/g, '\\\'');     // need to protect all single quotes

    return html;
}
781106
function RenderTexture (opts) {
    RenderTexture.superclass.constructor.call(this, opts)

    var width = opts.width,
        height = opts.height

    evt.addPropertyListener(this, 'contentSize', 'change', this._resizeCanvas.bind(this))

    this.canvas = document.createElement('canvas')
    this.context = this.canvas.getContext('2d')

    var atlas = new TextureAtlas({canvas: this.canvas})
    this.sprite = new Sprite({textureAtlas: atlas, rect: {origin: ccp(0, 0), size: {width: width, height: height}}})

    this.contentSize = geo.sizeMake(width, height)
    this.addChild(this.sprite)
    this.anchorPoint = ccp(0, 0)
    this.sprite.anchorPoint = ccp(0, 0)

}
690723
function splitHtml(html, opts, pcex) {
  var _bp = pcex._bp

  // `brackets.split` is a heavy function, so don't call it if not necessary
  if (html && _bp[4].test(html)) {
    var
      jsfn = opts.expr && (opts.parser || opts.type) ? _compileJS : 0,
      list = brackets.split(html, 0, _bp),
      expr

    for (var i = 1; i < list.length; i += 2) {
      expr = list[i]
      if (expr[0] === '^')
        expr = expr.slice(1)
      else if (jsfn) {
        var israw = expr[0] === '='
        expr = jsfn(israw ? expr.slice(1) : expr, opts).trim()
        if (expr.slice(-1) === ';') expr = expr.slice(0, -1)
        if (israw) expr = '=' + expr
      }
      list[i] = '\u0001' + (pcex.push(expr.replace(/[\r\n]+/g, ' ').trim()) - 1) + _bp[1]
    }
    html = list.join('')
  }
  return html
}
170193
function serializeText (node, opts) {
  return encode(node.nodeValue, extend({
    named: true,
    special: { '<': true, '>': true, '&': true }
  }, opts));
}
520823
function htmlToComponent(str, tags, opts) {
  var keys = objectKeys(tags);
  var props = opts.props || {};
  var preserveAttributes = opts.preserveAttributes || [];
  var tagAttributes = [];
  var reactTags={};
  var reactKeys=[];
  var key;
  for(var i = 0; i<keys.length; i++) {
    key = "AB"+Math.random().toString(36).substring(2);
    if(typeof tags[keys[i]] !== "function") {
      if(typeof tags[keys[i]].slice !== "function") continue;
      tagAttributes = tags[keys[i]].slice(0,-1);
      reactTags[key] = tags[keys[i]].slice(-1)[0];
    }
    else
      reactTags[key] = tags[keys[i]];

    reactKeys.push(key);

    str = str
      .replace(new RegExp("(<\/?)"+keys[i]+"(?:[^>\"']|\".*\"|'.*')*>", "ig"), function(match, start){
        // find/replace spell-save attributes within tag to restore capitals
        if(start !== "</")
          for(var a=0; a<tagAttributes.length; a++)
            match = replaceAttribute(match, tagAttributes[a], tagAttributes[a]);

        // replace key
        return match
          .replace(new RegExp(start+keys[i]+"(\\s|>)", "i"), start+key+"$1");
      });
  }

  // remove/disable html comments
  str = str.replace(/<!--|-->/g,"")

  // find/replace global spell-save attributes to restore capitals
  var attributes = preserveReactAttributes.concat(preserveAttributes);
  for(var i=0; i<attributes.length; i++) 
    str = replaceAttribute(str, attributes[i], attributes[i]);
 
  var jsx = htmlToJsx(str);

  // replace props variables {key} with corrected variables {props['key']}
  for(var key in props) {
    jsx = jsx
      .replace(new RegExp("(\{"+key+"\})","g"),"{props['"+key+"']}");
  }
  
  var component = ReactTransform(jsx).code;
  
  // replace component variables (ComponentName) with corrected variables (tags['ComponentName'])
  for(var i=0; i<reactKeys.length; i++) {
    component = component
      .replace(new RegExp(reactKeys[i],"g"), "reactTags['"+reactKeys[i]+"']"); 
  }

  return eval(component);
}
337681
async function renderElements (elements, globals) {
  const { $ } = globals
  const elementMap = keyBy(elements, 'tagName')
  const metaTagNames = filter(elements, { parent: [ 'head' ] }).map(({ tagName }) => tagName)
  const nonMetaTagNames = difference(elements.map(({ tagName }) => tagName), metaTagNames)

  const $nodes = [
    ...$.findNodes(metaTagNames), /** Render the meta elements first to last */
    ...$.findNodes(nonMetaTagNames).reverse() /** Render the elements last to first/outside to inside */
  ]

  for (let $node of $nodes) {
    const element = elementMap[$node.prop('tagName').toLowerCase()]
    const contents = $node.html()
    const attrs = $node[0].attribs

    const renderedValue = await Promise.resolve(renderElement(element, attrs, contents))

    $node.replaceWith(renderedValue.trim())
  }
}
1094992
function (opt) {
    if (typeof opt !== "object" || opt === null) {
        opt = {};
    }
    if (typeof opt.tag !== "string") {
        opt.tag = null;
    }
    if (typeof opt.encoding !== "string") {
        opt.encoding = "utf8";
    }

    //Extends the readable stream
    stream.Readable.call(this, {encoding: opt.encoding});

    this._tag = (typeof opt.tag === "string") ? opt.tag.trim() : null;
    this._level = labels.length;
    this._disabled = false;

    //Default message format
    this._format = function (tag, label, text) {
        let list = [];
        if (tag) {
            //Add the tag if it is provided
            list.push("[" + tag + "]");
        }
        list.push("[" + timestamp("YYYY-MM-DD hh:mm:ss") + "]");
        list.push("[" + label.toUpperCase() + "]");
        list.push(text.trim());
        return list.join(" ");
    };

    return this;
}
1087352
function (group, opts) {
			if (!group) {
				return;
			}

			if (!$.isPlainObject(opts)) {
				opts = {};
			}

			// Close if already active
			if (false === F.close(true)) {
				return;
			}

			// Normalize group
			if (!$.isArray(group)) {
				group = isQuery(group) ? $(group).get() : [group];
			}

			// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
			$.each(group, function(i, element) {
				var obj = {},
					href,
					title,
					content,
					type,
					rez,
					hrefParts,
					selector;

				if ($.type(element) === "object") {
					// Check if is DOM element
					if (element.nodeType) {
						element = $(element);
					}

					if (isQuery(element)) {
						obj = {
							href    : element.data('fancybox-href') || element.attr('href'),
							title   : element.data('fancybox-title') || element.attr('title'),
							isDom   : true,
							element : element
						};

						if ($.metadata) {
							$.extend(true, obj, element.metadata());
						}

					} else {
						obj = element;
					}
				}

				href  = opts.href  || obj.href || (isString(element) ? element : null);
				title = opts.title !== undefined ? opts.title : obj.title || '';

				content = opts.content || obj.content;
				type    = content ? 'html' : (opts.type  || obj.type);

				if (!type && obj.isDom) {
					type = element.data('fancybox-type');

					if (!type) {
						rez  = element.prop('class').match(/fancybox\.(\w+)/);
						type = rez ? rez[1] : null;
					}
				}

				if (isString(href)) {
					// Try to guess the content type
					if (!type) {
						if (F.isImage(href)) {
							type = 'image';

						} else if (F.isSWF(href)) {
							type = 'swf';

						} else if (href.charAt(0) === '#') {
							type = 'inline';

						} else if (isString(element)) {
							type    = 'html';
							content = element;
						}
					}

					// Split url into two pieces with source url and content selector, e.g,
					// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
					if (type === 'ajax') {
						hrefParts = href.split(/\s+/, 2);
						href      = hrefParts.shift();
						selector  = hrefParts.shift();
					}
				}

				if (!content) {
					if (type === 'inline') {
						if (href) {
							content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7

						} else if (obj.isDom) {
							content = element;
						}

					} else if (type === 'html') {
						content = href;

					} else if (!type && !href && obj.isDom) {
						type    = 'inline';
						content = element;
					}
				}

				$.extend(obj, {
					href     : href,
					type     : type,
					content  : content,
					title    : title,
					selector : selector
				});

				group[ i ] = obj;
			});

			// Extend the defaults
			F.opts = $.extend(true, {}, F.defaults, opts);

			// All options are merged recursive except keys
			if (opts.keys !== undefined) {
				F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
			}

			F.group = group;

			return F._start(F.opts.index);
		}
891435
function (element, candidates, opts) {
    var typeAhead = this;
    opts = opts || {};

    typeAhead.element = element;

    typeAhead.candidates = candidates || [];

    typeAhead.list = new TypeAheadList(typeAhead);

    this.minLength = opts.hasOwnProperty('minLength') ? opts.minLength : 3;

    typeAhead.limit = opts.hasOwnProperty('limit') ? opts.limit : 5;

    typeAhead.onMouseDown = opts.hasOwnProperty('onMouseDown') ? opts.onMouseDown : function(){};

    typeAhead.onKeyDown = opts.hasOwnProperty('onKeyDown') ? opts.onKeyDown : function(){};

    typeAhead.fulltext = opts.hasOwnProperty('fulltext') ? opts.fulltext : false;

    typeAhead.scrollable = opts.hasOwnProperty('scrollable') ? opts.scrollable : false;

    typeAhead.callback = opts.hasOwnProperty('callback') ? opts.callback : function(){};

    typeAhead.query = '';

    typeAhead.selected = null;

    typeAhead.list.draw();

    typeAhead.element.addEventListener('keyup', function (event) {
        typeAhead.handleKeyUp.call(typeAhead, event.keyCode);
    }, false);

    typeAhead.element.addEventListener('keydown', function (event) {
        typeAhead.handleKeyDown.call(typeAhead, event.keyCode) && event.preventDefault();
    });

    typeAhead.element.addEventListener('focus', function () {
        typeAhead.handleFocus.call(typeAhead);
    });

    typeAhead.element.addEventListener('blur', function () {
        typeAhead.handleBlur.call(typeAhead);
    });

    typeAhead.update = function(candidates){
      this.candidates = candidates;
      typeAhead.handleKeyUp.call(typeAhead);
    }

    return typeAhead;
}
282844
function(el, template, context, opts) {
      opts = opts || {};
      if (_.isString(template)) {
        opts.newHTML = template;
      }
      templateRenderer.render(el, template, context, opts);
    }
599181
function element(node, options = {}) {
  const { namespace } = options;
  const { tagName, properties, children = [] } = node;
  const el = typeof namespace !== 'undefined'
    ? document.createElementNS(namespace, tagName)
    : document.createElement(tagName);

  // Add HTML attributes
  const props = Object.keys(properties);
  const { length } = props;
  for (let i = 0; i < length; i += 1) {
    const key = props[i];
    const {
      attribute,
      property,
      mustUseAttribute,
      mustUseProperty,
      boolean,
      booleanish,
      overloadedBoolean,
      // number,
      // defined,
      commaSeparated,
      spaceSeparated,
      // commaOrSpaceSeparated,
    } = info.find(info.html, key) || {
      attribute: key,
      property: key,
    };

    let value = properties[key];
    if (Array.isArray(value)) {
      if (commaSeparated) {
        value = value.join(', ');
      } else if (spaceSeparated) {
        value = value.join(' ');
      } else {
        value = value.join(' ');
      }
    }

    try {
      if (mustUseProperty) {
        el[property] = value;
      }
      if (boolean || (overloadedBoolean && typeof value === 'boolean')) {
        if (value) {
          el.setAttribute(attribute, '');
        } else {
          el.removeAttribute(attribute);
        }
      } else if (booleanish) {
        el.setAttribute(attribute, value);
      } else if (value === true) {
        el.setAttribute(attribute, '');
      } else if (value || value === 0 || value === '') {
        el.setAttribute(attribute, value);
      }
    } catch (e) {
      if (!mustUseAttribute && property) {
        el[property] = value;
      }
      // Otherwise silently ignore
    }
  }

  // Transform children
  const { length: childrenLength } = children;
  for (let i = 0; i < childrenLength; i += 1) {
    const childEl = transform(children[i], options);
    if (childEl) {
      el.appendChild(childEl);
    }
  }

  return el;
}
77086
function(opts)
    {
        var i, arr = [];
        for (i = 0; i < 7; i++) {
            arr.push('<th scope="col"><abbr title="' + renderDayName(opts, i) + '">' + renderDayName(opts, i, true) + '</abbr></th>');
        }
        return '<thead>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</thead>';
    }
539062
function PrintHtmlElement() {
    function printElement(element, opts) {
        var elementHtml = element.outerHTML;

        _print(elementHtml, opts);
    }

    function printHtml(html, opts) {
        _print(html, opts);
    }

    function _print(html, opts) {
        opts = opts || {};
        opts = {
            printMode: opts.printMode || '',
            pageTitle: opts.pageTitle || '',
            templateString: opts.templateString || '',
            popupProperties: opts.popupProperties || '',
            stylesheets: opts.stylesheets || null,
            styles: opts.styles || null
        };

        // Get markup to be printed
        var markup = _getMarkup(html, opts),
            printWindow,
            printIframe,
            printDocument,
            printElementID;

        if (opts.printMode.toLowerCase() === 'popup') {
            printWindow = window.open('about:blank', 'printElementWindow', opts.popupProperties);
            printDocument = printWindow.document;
        } else {
            //The random ID is to overcome a safari bug
            // http://www.cjboco.com.sharedcopy.com/post.cfm/442dc92cd1c0ca10a5c35210b8166882.html
            printElementID = 'printElement_' + (Math.round(Math.random() * 99999)).toString();

            printIframe = document.createElement('iframe');
            printIframe.setAttribute('id', printElementID);
            printIframe.setAttribute('src', 'about:blank');
            printIframe.setAttribute('frameBorder', '0');
            printIframe.setAttribute('scrolling', 'no');
            printIframe.setAttribute('style', 'position:fixed;bottom:100%;right:100%;');

            document.body.appendChild(printIframe);

            printDocument = (printIframe.contentWindow || printIframe.contentDocument);
            if (printDocument.document) {
                printDocument = printDocument.document;
            }

            printIframe = document.frames ? document.frames[printElementID] : document.getElementById(printElementID);
            printWindow = printIframe.contentWindow || printIframe;
        }

        focus();
        printDocument.open();

        // SetTimeout fixes Issue #9 (iframe printMode does not work in firefox)
        setTimeout(function() {
          printDocument.write(markup);
          printDocument.close();
        });

        _callPrint(printWindow, printIframe);
    }

    function _callPrint(printWindow, iframe) {
        if (printWindow && printWindow.printPage) {
            printWindow.printPage();

            if (iframe) {
                // Remove iframe after printing
                document.body.removeChild(iframe);
            }
        } else {
            setTimeout(function() {
                _callPrint(printWindow, iframe);
            }, 50);
        }
    }

    function _getBaseHref() {
        var port = (window.location.port) ? ':' + window.location.port : '';
        return window.location.protocol + '//' + window.location.hostname + port + window.location.pathname;
    }

    function _getMarkup(elementHtml, opts) {
        var template = opts.templateString,
            templateRegex = new RegExp(/{{\s*printBody\s*}}/gi),
            stylesheets,
            styles,
            html = [];

        if(template && templateRegex.test(template)) {
            elementHtml = template.replace(templateRegex, elementHtml);
        }

        html.push('<html><head><title>' + (opts.pageTitle || '') + '</title>');

        // If stylesheet URL's or list of stylesheet URL's are specified, override page stylesheets
        if (opts.stylesheets) {
            stylesheets = Array.isArray(opts.stylesheets) ? opts.stylesheets : [opts.stylesheets];
        } else {
            stylesheets = Array.prototype.slice
                .call(document.getElementsByTagName('link'))
                .map(function(link) {
                    return link.href;
                });
        }

        stylesheets.forEach(function(href) {
            html.push('<link rel="stylesheet" href="' + href + '">');
        });

        // If inline styles or list of inline styles are specified, override inline styles
        if (opts.styles) {
            styles = Array.isArray(opts.styles) ? opts.styles : [opts.styles];
        } else {
            styles = Array.prototype.slice
                .call(document.getElementsByTagName('style'))
                .map(function(style) {
                    return style.innerHTML;
                });
        }
 
        styles.forEach(function (style) {
            html.push('<style type="text/css">' + style + '</style>');
        });

        // Ensure that relative links work
        html.push('<base href="' + _getBaseHref() + '" />');
        html.push('</head><body class="pe-body">');
        html.push(elementHtml);
        html.push('<script type="text/javascript">function printPage(){focus();print();' + ((opts.printMode.toLowerCase() == 'popup') ? 'close();' : '') + '}</script>');
        html.push('</body></html>');

        return html.join('');
    }

    return {
        printElement: printElement,
        printHtml: printHtml
    };
}