produce final html tag representation
352421
function tagOutput(descriptor, innerDescriptor, name) {
	var out = '<' + name + innerDescriptor.attributes;
	if (innerDescriptor.style)
		out += ' style="' + innerDescriptor.style + '"';
	if (innerDescriptor.classes)
		out += ' class="' + innerDescriptor.classes + '"';
	if (innerDescriptor.children)
		descriptor.children += out + '>' + innerDescriptor.children + '</' + name + '>';
	else if (openTags.test(name))
		descriptor.children += out + '>';
	else if (strictTags.test(name))
		descriptor.children += out + '></' + name + '>';
	else
		descriptor.children += out + '/>';
}
968521
def to_html(options = {})
      html = []
      html << hidden_field_tag("DESCRIPTION",     self.description)     unless self.description.blank?
      html << hidden_field_tag("MATNR",           self.matnr)           unless self.matnr.blank?
      html << hidden_field_tag("QUANTITY",        "%015.3f" % self.quantity)
      html << hidden_field_tag("UNIT",            self.unit)            unless self.unit.blank?
      html << hidden_field_tag("PRICE",           "%015.3f" % self.price)
      html << hidden_field_tag("CURRENCY",        self.currency)        unless self.currency.blank?
      html << hidden_field_tag("PRICEUNIT",       self.priceunit.to_i)  if self.priceunit.to_i > 0
      html << hidden_field_tag("LEADTIME",        "%05d" % self.leadtime) if self.leadtime.to_i > 0
      html << hidden_field_tag("VENDOR",          self.vendor)          unless self.vendor.blank?
      html << hidden_field_tag("VENDORMAT",       self.vendormat)       unless self.vendormat.blank?
      html << hidden_field_tag("MANUFACTCODE",    self.manufactcode)    unless self.manufactcode.blank?
      html << hidden_field_tag("MANUFACTMAT",     self.manufactmat)     unless self.manufactmat.blank?
      html << hidden_field_tag("MATGROUP",        self.matgroup)        unless self.matgroup.blank?
      html << hidden_field_tag("SERVICE",         "X")                  if     self.service?
      html << hidden_field_tag("CONTRACT",        self.contract)        unless self.contract.blank?
      html << hidden_field_tag("CONTRACT_ITEM",   self.contract_item)   unless self.contract_item.blank?
      html << hidden_field_tag("EXT_QUOTE_ID",    self.ext_quote_id)    unless self.ext_quote_id.blank?
      html << hidden_field_tag("EXT_QUOTE_ITEM",  self.ext_quote_item)  unless self.ext_quote_item.blank?
      html << hidden_field_tag("EXT_PRODUCT_ID",  self.ext_product_id)  unless self.ext_product_id.blank?
      html << hidden_field_tag("ATTACHMENT",      self.attachment)      unless self.attachment.blank?
      html << hidden_field_tag("ATTACHMENT_TITLE", self.attachment_title) unless self.attachment_title.blank?
      html << hidden_field_tag("ATTACHMENT_PURPOSE", self.attachment_purpose) unless self.attachment_purpose.blank?
      html << hidden_field_tag("EXT_SCHEMA_TYPE", self.ext_schema_type) unless self.ext_schema_type.blank?
      html << hidden_field_tag("EXT_CATEGORY_ID", self.ext_category_id) unless self.ext_category_id.blank?
      html << hidden_field_tag("EXT_CATEGORY",    self.ext_category)    unless self.ext_category.blank?
      html << hidden_field_tag("SLD_SYS_NAME",    self.sld_sys_name)    unless self.sld_sys_name.blank?
      html << hidden_field_tag("MPS_SAGE_NUMBER",   self.mps_sage_number)    unless self.mps_sage_number.blank?
      html << hidden_field_tag("MPS_SAGE_CONTRACT", self.mps_sage_contract)  unless self.mps_sage_contract.blank?
      html << hidden_field_tag("TAX_RATE",        "%.5f" % self.tax_rate)  if self.tax_rate.to_f > 0
      html << hidden_field_tag("TAX_CODE",        self.tax_code)        unless self.tax_code.blank?
      html << hidden_field_tag("SOLD_BY",         self.sold_by)         unless self.sold_by.blank?
      html << hidden_field_tag("FULFILLED_BY",    self.fulfilled_by)    unless self.fulfilled_by.blank?
      html << hidden_field_tag("CUST_FIELD1",     self.cust_field1)     unless self.cust_field1.blank?
      html << hidden_field_tag("CUST_FIELD2",     self.cust_field2)     unless self.cust_field2.blank?
      html << hidden_field_tag("CUST_FIELD3",     self.cust_field3)     unless self.cust_field3.blank?
      html << hidden_field_tag("CUST_FIELD4",     self.cust_field4)     unless self.cust_field4.blank?
      html << hidden_field_tag("CUST_FIELD5",     self.cust_field5)     unless self.cust_field5.blank?
      html << hidden_field_tag("CUST_FIELD6",     self.cust_field6)     unless self.cust_field6.blank?
      html << hidden_field_tag("CUST_FIELD7",     self.cust_field7)     unless self.cust_field7.blank?
      html << hidden_field_tag("CUST_FIELD8",     self.cust_field8)     unless self.cust_field8.blank?
      html << hidden_field_tag("CUST_FIELD9",     self.cust_field9)     unless self.cust_field9.blank?
      html << hidden_field_tag("CUST_FIELD10",    self.cust_field10)    unless self.cust_field10.blank?
      html << hidden_field_tag("CUST_FIELD11",    self.cust_field11)    unless self.cust_field11.blank?
      html << hidden_field_tag("CUST_FIELD12",    self.cust_field12)    unless self.cust_field12.blank?
      html << hidden_field_tag("CUST_FIELD13",    self.cust_field13)    unless self.cust_field13.blank?
      html << hidden_field_tag("CUST_FIELD14",    self.cust_field14)    unless self.cust_field14.blank?
      html << hidden_field_tag("CUST_FIELD15",    self.cust_field15)    unless self.cust_field15.blank?
      html << hidden_field_tag("CUST_FIELD16",    self.cust_field16)    unless self.cust_field16.blank?
      html << hidden_field_tag("CUST_FIELD17",    self.cust_field17)    unless self.cust_field17.blank?
      html << hidden_field_tag("CUST_FIELD18",    self.cust_field18)    unless self.cust_field18.blank?
      html << hidden_field_tag("CUST_FIELD19",    self.cust_field19)    unless self.cust_field19.blank?
      html << hidden_field_tag("CUST_FIELD20",    self.cust_field20)    unless self.cust_field20.blank?
      html << hidden_field_tag("CUST_FIELD21",    self.cust_field21)    unless self.cust_field21.blank?
      html << hidden_field_tag("CUST_FIELD22",    self.cust_field22)    unless self.cust_field22.blank?
      html << hidden_field_tag("CUST_FIELD23",    self.cust_field23)    unless self.cust_field23.blank?
      html << hidden_field_tag("CUST_FIELD24",    self.cust_field24)    unless self.cust_field24.blank?
      html << hidden_field_tag("CUST_FIELD25",    self.cust_field25)    unless self.cust_field25.blank?
      html << hidden_field_tag("CUST_FIELD26",    self.cust_field26)    unless self.cust_field26.blank?
      html << hidden_field_tag("CUST_FIELD27",    self.cust_field27)    unless self.cust_field27.blank?
      html << hidden_field_tag("CUST_FIELD28",    self.cust_field28)    unless self.cust_field28.blank?
      html << hidden_field_tag("CUST_FIELD29",    self.cust_field29)    unless self.cust_field29.blank?
      html << hidden_field_tag("CUST_FIELD30",    self.cust_field30)    unless self.cust_field30.blank?
      html << "<input type=\"hidden\" name=\"NEW_ITEM-LONGTEXT_#{index + 1}:132[]\" value=\"#{escape_html(self.longtext)}\" />" unless self.longtext.blank?
      html.join
    end
970415
def clone(self):
        '''
        
        '''
        return HtmlElement(self.tag, self.prefix, self.suffix, self.display,
                           self.margin_before, self.margin_after, self.padding,
                           self.whitespace)
58247
def tag_to_dict(html):
    """"""

    element = document_fromstring(html).xpath("//html/body/child::*")[0]
    attributes = dict(element.attrib)
    attributes["text"] = element.text_content()
    return attributes
488466
function finalizeHtml($html, needHtmlText) {
  let returnValue;

  if (needHtmlText) {
    returnValue = $html[0].innerHTML;
  } else {
    const frag = document.createDocumentFragment();
    const childNodes = util.toArray($html[0].childNodes);
    const {length} = childNodes;

    for (let i = 0; i < length; i += 1) {
      frag.appendChild(childNodes[i]);
    }
    returnValue = frag;
  }

  return returnValue;
}
1315369
def to_html(self):
        
        row = '<tr%s>\n' % self.html_attributes()
        for cell in self.cells:
            row += cell.to_html()
        row += '</tr>\n'

        return row
674067
def to_html(self):
        
        if self.text is None:
            return

        level = self.level
        if level > 6:
            level = 6
        return '<h%s%s><a id="%s"></a>%s%s</h%s>' % (
            level,
            self.html_attributes(),
            self.element_id,
            self.html_icon(),
            self.text.to_html(),
            level)
177689
function outputHTMLString(messages) {
  var rootIndex = 0;
  for (var i = 1; i < messages.length; i++) {
    rootIndex = messages[i].frameIndex === '0' ? i : rootIndex;
  }
  fillRemainingHolesAndMinimizeStyles(messages, rootIndex);
  return messages[rootIndex].html.join('');
}
1200993
def format(self, soup):
        
        # Remove all the newline characters before a closing tag.
        for node in soup.findAll(text=True):
            if node.rstrip(" ").endswith("\n"):
                node.replaceWith(node.rstrip(" ").rstrip("\n"))
        # Join the block elements lines into a single long line
        for tag in ['p', 'li']:
            for node in soup.findAll(tag):
                text = unicode(node)
                lines = [x.strip() for x in text.splitlines()]
                text = ' '.join(lines)
                node.replaceWith(BeautifulSoup.BeautifulSoup(text))
        soup = BeautifulSoup.BeautifulSoup(unicode(soup))
        # replace all <br/> tag by newline character
        for node in soup.findAll('br'):
            node.replaceWith("\n")
        soup = BeautifulSoup.BeautifulSoup(unicode(soup))
        return soup
1112510
def _render_after(self, element):
        ''''''
        if element.inline_content:
            return "</%s>%s" % (element.tag, self.render_newlines())
        elif element.self_close:
            return self.render_newlines()
        elif self.children:
            return "%s</%s>\n" % (self.spaces, element.tag)
        else:
            return "</%s>\n" % (element.tag)
216709
def _tag(val, tag):
        """"""
        if isinstance(val, str):
            val = bytes(val, 'utf-8')
        return (bytes('<' + tag + '>', 'utf-8') + val +
                bytes('</' + tag + '>', 'utf-8'))
594605
def tostring(element):
    """"""
    rv = []

    def serializeElement(element):
        if not hasattr(element, "tag"):
            if element.docinfo.internalDTD:
                if element.docinfo.doctype:
                    dtd_str = element.docinfo.doctype
                else:
                    dtd_str = "<!DOCTYPE %s>" % element.docinfo.root_name
                rv.append(dtd_str)
            serializeElement(element.getroot())

        elif element.tag == comment_type:
            rv.append("<!--%s-->" % (element.text,))

        else:
            # This is assumed to be an ordinary element
            if not element.attrib:
                rv.append("<%s>" % (element.tag,))
            else:
                attr = " ".join(["%s=\"%s\"" % (name, value)
                                 for name, value in element.attrib.items()])
                rv.append("<%s %s>" % (element.tag, attr))
            if element.text:
                rv.append(element.text)

            for child in element:
                serializeElement(child)

            rv.append("</%s>" % (element.tag,))

        if hasattr(element, "tail") and element.tail:
            rv.append(element.tail)

    serializeElement(element)

    return "".join(rv)
176338
def html(self):
        
        return """
        <div class="property"><i>{name}</i><br/>
        <pre>{value}</pre></div>
        """.format(name=tag.text(self.name), value=tag.text(self.value))
235666
def htmlFormat(output, pathParts = (), statDict = None, query = None):
  """"""
  statDict = statDict or scales.getStats()
  if query:
    statDict = runQuery(statDict, query)
  _htmlRenderDict(pathParts, statDict, output)
893089
function htmlTagObjectToString (tagDefinition, xhtml) {
  const attributes = Object.keys(tagDefinition.attributes || {})
    .filter(function (attributeName) {
      return tagDefinition.attributes[attributeName] !== false;
    })
    .map(function (attributeName) {
      if (tagDefinition.attributes[attributeName] === true) {
        return xhtml ? attributeName + '="' + attributeName + '"' : attributeName;
      }
      return attributeName + '="' + tagDefinition.attributes[attributeName] + '"';
    });
  return '<' + [tagDefinition.tagName].concat(attributes).join(' ') + (tagDefinition.voidTag && xhtml ? '/' : '') + '>' +
    (tagDefinition.innerHTML || '') +
    (tagDefinition.voidTag ? '' : '</' + tagDefinition.tagName + '>');
}
1292805
def prettify(self, depth=0, separator="  ", last=True, pre=False,
                 inline=False):
        
        output = ""

        if self.getTagName() != "" and self.tagToString().strip() == "":
            return ""

        # if not inside <pre> and not inline, shift tag to the right
        if not pre and not inline:
            output += (depth * separator)

        # for <pre> set 'pre' flag
        if self.getTagName().lower() == "pre" and self.isOpeningTag():
            pre = True
            separator = ""

        output += self.tagToString()

        # detect if inline - is_inline shows if inline was set by detection, or
        # as parameter
        is_inline = inline
        for c in self.childs:
            if not (c.isTag() or c.isComment()):
                if len(c.tagToString().strip()) != 0:
                    inline = True

        # don't shift if inside container (containers have blank tagname)
        original_depth = depth
        if self.getTagName() != "":
            if not pre and not inline:  # inside <pre> doesn't shift tags
                depth += 1
                if self.tagToString().strip() != "":
                    output += "\n"

        # prettify childs
        for e in self.childs:
            if not e.isEndTag():
                output += e.prettify(
                    depth,
                    last=False,
                    pre=pre,
                    inline=inline
                )

        # endtag
        if self.endtag is not None:
            if not pre and not inline:
                output += ((original_depth) * separator)

            output += self.endtag.tagToString().strip()

            if not is_inline:
                output += "\n"

        return output
766541
function renderElement(tag, attrs, content, indentStr, indentLevel) {
    let indent = indentStr.repeat(indentLevel);
    content = renderFalsey(content);
    content = isNested(content) ? ('\n' + jxh(content, indentStr, ++indentLevel) + indent) : content;
    return Tag.render(indent, tag, attrs, content);
}