generate HTML div
972274
def buildcontainer(self):
        """"""
        if self.container:
            return
        # Create HTML div with style
        if self.options['chart'].width:
            if str(self.options['chart'].width)[-1] != '%':
                self.div_style += 'width:%spx;' % self.options['chart'].width
            else:
                self.div_style += 'width:%s;' % self.options['chart'].width
        if self.options['chart'].height:
            if str(self.options['chart'].height)[-1] != '%':
                self.div_style += 'height:%spx;' % self.options['chart'].height
            else:
                self.div_style += 'height:%s;' % self.options['chart'].height

        self.div_name = self.options['chart'].__dict__['renderTo'] # recheck div name
        self.container = self.containerheader + \
            '<div id="%s" style="%s">%s</div>\n' % (self.div_name, self.div_style, self.loading)
56255
function renderPongListDivHTMLsub( contentItems, divId, divs, r, cx ) {
  log( "PoNG-List", 'div row='+r+'/'+cx );
  for ( var c = 0; c < divs.length; c ++ ) {
    log( "PoNG-List", 'div '+cx+'/'+c );
    if ( divs[c].cellType == 'div' ) {
      log( "PoNG-List", 'div-x '+divs[c].id );
      contentItems.push( '<div class="pongListCell pongListCell'+divs[c].id.replace(/\./g,'')+'" id="'+divId+'R'+r+'X'+cx+'C'+c+'">' );
      if ( divs[c].divs ) {
        renderPongListDivHTMLsub( contentItems, divId, divs[c].divs, r, cx+c ); 
      }      
      contentItems.push( '</div>'  );
    } else if ( ( divs[c].cellType != 'tooltip' ) && 
                ( divs[c].cellType != 'largeimg' ) && 
                ( divs[c].cellType != 'cssClass' ) && 
                ( divs[c].cellType != 'textLink' ) && 
                ( divs[c].cellType != 'linkFor' ) ) {
      log( "PoNG-List", 'div-n '+divs[c].id );
      contentItems.push( '<div class="pongListCell pongListValCell pongListCell'+divs[c].id.replace(/\./g,'')
          +'" id="'+divId+'R'+r+'X'+cx+'C'+c+'"></div>'  );
      log( "PoNG-List", 'div end' );
    } else if (divs[c].cellType == 'cssClass' ) {
      contentItems.push( '<div id="'+divId+'R'+r+'X'+cx+'C'+c+'" style="display:none;"/>' );
    }
  }
}
1320508
function wrap(xhtml, tag) {
  var e = document.createElement('div');
  e.innerHTML = xhtml;
  return e;
}
13192
def generate_html_files(*args):
    '''
    
    '''
    _ = args

    for tag_key, tag_list in SWITCH_DICS.items():
        if tag_key.startswith('dic_'):
            __write_view_tmpl(tag_list)

    __write_filter_tmpl(TPL_LIST)
    __write_list_tmpl(TPL_LISTINFO)
1261637
function renderHtml(fragment, opts) {
    var html = (!fragment || !u.trim(fragment._txt)) ?
      '&nbsp;' : // show space for empty/missing to allow selection/editing
      renderMarkdown(fragment._txt, opts);
    // use opts.noWrap to avoid breaking CSS nested selectors like li > ul in menus
    if (opts && opts.noWrap) return html;
    var href = (fragment && esc(fragment._href)) || '';
    return '<div data-render-html="' + href + '">' + html + '</div>';
  }
203852
function toHtml() {
        global $CFG, $PAGE;

        $this->_generateId();
        $elementid = $this->getAttribute('id');
        $mainhtml = html_writer::tag('div', $this->items[$this->getValue()]->mainhtml,
                array('id' => $elementid . '_items_main', 'class' => 'formlistingmain'));

        // Add the main div containing the selected item (+ the caption: "More items").
        $html = html_writer::tag('div', $mainhtml .
                    html_writer::tag('div', $this->showall,
                        array('id' => $elementid . '_items_caption', 'class' => 'formlistingmore')),
                    array('id' => $elementid . '_items', 'class' => 'formlisting hide'));

        // Add collapsible region: all the items.
        $itemrows = '';
        $html .= html_writer::tag('div', $itemrows,
                array('id' => $elementid . '_items_all', 'class' => 'formlistingall'));

        // Add radio buttons for non javascript support.
        $radiobuttons = '';
        foreach ($this->items as $itemid => $item) {
            $radioparams = array('name' => $this->getName(), 'value' => $itemid,
                    'id' => 'id_'.$itemid, 'class' => 'formlistinginputradio', 'type' => 'radio');
            if ($itemid == $this->getValue()) {
                $radioparams['checked'] = 'checked';
            }
            $radiobuttons .= html_writer::tag('div', html_writer::tag('input',
                html_writer::tag('div', $item->rowhtml, array('class' => 'formlistingradiocontent')), $radioparams),
                array('class' => 'formlistingradio'));
        }

        // Container for the hidden hidden input which will contain the selected item.
        $html .= html_writer::tag('div', $radiobuttons,
                array('id' => 'formlistinginputcontainer_' . $elementid, 'class' => 'formlistinginputcontainer'));

        $module = array('name'=>'form_listing', 'fullpath'=>'/lib/form/yui/listing/listing.js',
            'requires'=>array('node', 'event', 'transition', 'escape'));

        $PAGE->requires->js_init_call('M.form_listing.init',
                 array(array(
                'elementid' => $elementid.'_items',
                'hideall' => $this->hideall,
                'showall' => $this->showall,
                'hiddeninputid' => $this->getAttribute('id'),
                'items' => $this->items,
                'inputname' => $elementid,
                'currentvalue' => $this->getValue())), true, $module);

        return $html;
    }
646923
function createHTML(htmlStr) {
        var frag = document.createDocumentFragment(),
            temp = document.createElement('div');
        temp.innerHTML = htmlStr;
        while (temp.firstChild) {
            frag.appendChild(temp.firstChild);
        }
        return frag;
    }
1006812
def _generate_content(self):
        """"""
        # concat into a dict
        dic = self.config
        dic['mode'] = self.language
        if self.theme:
            dic['theme'] = self.theme
        # dumps with json
        return json.dumps(dic, indent=8, separators=(',', ': '))
144338
def html(self, text=TEXT):
        
        self.logger.debug("Generating the HTML report{}..."
                          .format(["", " (text only)"][text]))
        html = []
        for piece in self._pieces:
            if isinstance(piece, string_types):
                html.append(markdown2.markdown(piece, extras=["tables"]))
            elif isinstance(piece, Element):
                html.append(piece.html())
        return "\n\n".join(html)
755009
def make_html(self):
        
        html = None
        if self.function == 'total':
            html = u'<table border="0" width="100%" rules="cols" cellpadding="2">\n'\
                   '<tr><th colspan="2" align="left"><h3><font color="{1}">'\
                   '{0}</font></h3></th></tr>\n'\
                   .format(htmlsafe(self.title.strip()), self.color)

            for res in self.results:
                html = u'{0}<tr><td valign="top" align="right">{1}</td>'\
                       '<td valign="top" width="90%">{2}</td></tr>'\
                       .format(html, res[0], res[1])

        elif self.function == 'top':
            html = u'<table border="0" width="100%" rules="cols" cellpadding="2">\n'\
                   '<tr><th colspan="2" align="left"><h3><font color="{1}">'\
                   '{0}</font></h3></th></tr>\n'\
                   .format(htmlsafe(self.title.strip()), self.color)

            if self.results[0] is not None:
                for res in self.results:
                    if res is not None:
                        html = u'{0}<tr><td valign="top" align="right">{1}</td>'\
                               '<td valign="top" width="90%">{2}</td></tr>'\
                               .format(html, res[0], ', '.join(res[1]))
            else:
                html = u'{0}<tr><td valign="top" align="left">{1}</td>'\
                       .format(html, "None")
                
        elif self.function == 'table':
            html = u'<h3><font color="{1}">{0}</font></h3>'\
                   '<table width="100%" rules="cols" cellpadding="2">\n'\
                   '<tr bgcolor="#aaaaaa">'\
                   .format(htmlsafe(self.title.strip()), self.color)
            
            headers = re.split('\s*,\s*', self.headers)
            for i in range(len(headers)):
                html = '{0}<th align="center" colspan="1">'\
                       '<font color="black">{1}</font></th>'\
                       .format(html, headers[i].strip('"'))

            html = u'{0}</tr>\n'.format(html)
            
            oddflag = False
            lastval = ""            
            for res in sorted(self.results, key=lambda x: x[0]):
                if lastval != res[0]:
                    oddflag = not oddflag
                    if oddflag:
                        html = u'{0}<tr bgcolor="#dddddd">'.format(html)
                    else:
                        html = u'{0}<tr>'.format(html)

                    html = u'{0}<td valign="top" width="15%">{1}</td>'\
                           .format(html, res[0])
                else:
                    if oddflag:
                        html = u'{0}<tr bgcolor="#dddddd">'.format(html)
                    else:
                        html = u'{0}<tr>'.format(html)

                    html = u'{0}<td valign="top" width="15%">&nbsp;</td>'.format(html)
                lastval = res[0]
                
                for i in range(1, len(headers)-1):
                    html = u'{0}<td valign="top" width="15%">{1}</td>'.format(html, res[i])
                lastcol = get_fmt_results(res[-1], limit=10, fmt=u'<font color="darkred">{0}</font>')

                if lastcol[-1].find(u" more skipped]") > -1:
                    html = u'{0}<td valign="top" width="{1}%">{2} {3}</td></tr>\n'\
                           .format(html, 100-15*(len(headers)-1),
                                   u', '.join(lastcol[:-1]), lastcol[-1])
                else:
                    html = u'{0}<td valign="top" width="{1}%">{2}</td></tr>\n'\
                           .format(html, 100-15*(len(headers)-1), u', '.join(lastcol))

        self.html = u'{0}</table>\n<p>\n'.format(html)
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('');
}
1036360
function toHTML()
    {

        // get the options of the select control
        $attributes = $this->get_attributes(array('options', 'value', 'multiple', 'other'));

        // if select box is not "multi-select" and the "other" attribute is set
        if (!isset($attributes['multiple']) && isset($attributes['other']))

            // add an extra options to the already existing ones
            $attributes['options'] += array('other' => $this->form_properties['language']['other']);

        // if the default value, as added when instantiating the object is still there
        // or if no options were specified
        if (($key = array_search('#replace-with-language#', $attributes['options'])) !== false || empty($attributes['options']))

            // put the label from the language file
            $attributes['options'][$key] = $this->form_properties['language']['select'];

        // use a private, recursive method to generate the select's content
        $optContent = $this->_generate($attributes['options'], $attributes['value']);

        // return generated HTML
        return '<select '. $this->_render_attributes() . '>' . $optContent . '</select>';

    }
1166375
function generateHTML(testResults) {
        var stepsHtml = '',
            header = '',
            isPassed = false,
            passedScenarios = 0,
            passedSteps = 0,
            stepsNumber = 0,
            scenariosNumber = 0,
            scenariosNumberInFeature = 0,
            passedScenariosNumberInFeature = 0,
            stepsNumberInFeature = 0,
            passedStepsInFeature = 0,
            scenariosHtml = '',
            element,
            step,
            stepDuration = 0;

        html = '';
        for (var i = 0; i < testResults.length; i++) {

            scenariosNumberInFeature = 0;
            passedScenariosNumberInFeature = 0;
            stepsNumberInFeature = 0;
            passedStepsInFeature = 0;
            scenariosHtml = '';
            if (testResults[i].elements) {
                for (var j = 0; j < testResults[i].elements.length; j++) {
                    element = testResults[i].elements[j];
                    if (element.type === 'scenario') {
                        scenariosNumber++;
                        scenariosNumberInFeature++;
                        stepsHtml = '';
                        isPassed = true;
                        for (var k = 0; k < testResults[i].elements[j].steps.length; k++) {
                            step = testResults[i].elements[j].steps[k];

                            if (isEmptyAfterStep(step) || isEmptyBeforeStep(step)) {
                                continue;
                            }

                            if (isAfterStepWithScreenshot(step)) {
                                stepsHtml += getAfterScreenshotStep(step);
                            } else {
                                stepsHtml += getStep(step);
                                stepDuration += (step.result.duration ? step.result.duration : 0);
                                stepsNumber++;
                                stepsNumberInFeature++;
                                if (step.result.status !== statuses.PASSED) {
                                    isPassed = false;
                                } else if (step.result.status === statuses.PASSED) {
                                    passedSteps++;
                                    passedStepsInFeature++;
                                }
                            }
                        }

                        if (isPassed) {
                            passedScenarios++;
                            passedScenariosNumberInFeature++;
                        }
                        scenariosHtml += getScenarioContainer(getScenario(element, isPassed, stepsHtml));
                    }
                }
            }
            html += getFeatureWithScenarios(getFeature(testResults[i], scenariosNumberInFeature, passedScenariosNumberInFeature, stepsNumberInFeature, passedStepsInFeature) + scenariosHtml);
        }
        header = getHeader(scenariosNumber, passedScenarios, stepsNumber, passedSteps, calculateDuration(stepDuration));
        return header + html;
    }
635155
function _generate_element(ctype){

	var UID = id_base + bbop.core.randomness();
	var div_text = '<div id="' + UID + '"></div>';

	jQuery("body").append(jQuery(div_text).hide());
	var elt = jQuery('#' + UID);

	elt.addClass("org_bbop_amigo_ui_widget_base");
	elt.addClass("org_bbop_amigo_ui_widget_for_" + ctype);

	return elt;
    }
866496
public function generate()
    {
        $this->fill();
        $content = [];
        foreach ($this->_cells as $item) {
            $content[] = $item->generate();
        }
        //return implode('', $content);
        return Html::tag('div', implode('', $content), $this->htmlOptions);
    }
52422
def as_html(self, table_class='code-difftable', line_class='line',
                new_lineno_class='lineno old', old_lineno_class='lineno new',
                code_class='code'):
        
        def _link_to_if(condition, label, url):
            """
            Generates a link if condition is meet or just the label if not.
            """

            if condition:
                return '''<a href="%(url)s">%(label)s</a>''' % {'url': url,
                                                                'label': label}
            else:
                return label
        diff_lines = self.prepare()
        _html_empty = True
        _html = []
        _html.append('''<table class="%(table_class)s">\n''' \
                                            % {'table_class': table_class})
        for diff in diff_lines:
            for line in diff['chunks']:
                _html_empty = False
                for change in line:
                    _html.append('''<tr class="%(line_class)s %(action)s">\n''' \
                        % {'line_class': line_class,
                           'action': change['action']})
                    anchor_old_id = ''
                    anchor_new_id = ''
                    anchor_old = "%(filename)s_o%(oldline_no)s" % \
                                {'filename': self._safe_id(diff['filename']),
                                 'oldline_no': change['old_lineno']}
                    anchor_new = "%(filename)s_n%(oldline_no)s" % \
                                {'filename': self._safe_id(diff['filename']),
                                 'oldline_no': change['new_lineno']}
                    cond_old = change['old_lineno'] != '...' and \
                                                        change['old_lineno']
                    cond_new = change['new_lineno'] != '...' and \
                                                        change['new_lineno']
                    if cond_old:
                        anchor_old_id = 'id="%s"' % anchor_old
                    if cond_new:
                        anchor_new_id = 'id="%s"' % anchor_new
                    ###########################################################
                    # OLD LINE NUMBER
                    ###########################################################
                    _html.append('''\t<td %(a_id)s class="%(old_lineno_cls)s">''' \
                                    % {'a_id': anchor_old_id,
                                       'old_lineno_cls': old_lineno_class})

                    _html.append('''<pre>%(link)s</pre>''' \
                        % {'link':
                        _link_to_if(cond_old, change['old_lineno'], '#%s' \
                                                                % anchor_old)})
                    _html.append('''</td>\n''')
                    ###########################################################
                    # NEW LINE NUMBER
                    ###########################################################

                    _html.append('''\t<td %(a_id)s class="%(new_lineno_cls)s">''' \
                                    % {'a_id': anchor_new_id,
                                       'new_lineno_cls': new_lineno_class})

                    _html.append('''<pre>%(link)s</pre>''' \
                        % {'link':
                        _link_to_if(cond_new, change['new_lineno'], '#%s' \
                                                                % anchor_new)})
                    _html.append('''</td>\n''')
                    ###########################################################
                    # CODE
                    ###########################################################
                    _html.append('''\t<td class="%(code_class)s">''' \
                                                % {'code_class': code_class})
                    _html.append('''\n\t\t<pre>%(code)s</pre>\n''' \
                                                % {'code': change['line']})
                    _html.append('''\t</td>''')
                    _html.append('''\n</tr>\n''')
        _html.append('''</table>''')
        if _html_empty:
            return None
        return ''.join(_html)
531751
function (dom) {
            var html = '';
            dom.forEach(function (node) {
                if (node.type === 'tag') {
                    var tag = node.name;
                    html += '<' + tag;
                    Object.keys(node.attribs).forEach(function (attr) {
                        html += ' ' + attr + '=' + this.generateAttribute(node.attribs[attr]);
                    }, this);
                    html += (voidTags[tag] ? '/>' : '>');
                    if (!voidTags[tag]) {
                        html += this.vdomToHtml(node.children);
                        html += '</' + tag + '>';
                    }
                } else if (node.type === 'text') {
                    var text = node.data || '';
                    html += this.htmlEncode(text); //escape <,> and &.
                } else if (node.type === 'comment') {
                    html += '<!-- ' + node.data.trim() + ' -->';
                } else if (node.type === 'script' || node.type === 'style') {
                    //No need to escape text inside script or style tag.
                    html += '<' + node.name;
                    Object.keys(node.attribs).forEach(function (attr) {
                        html += ' ' + attr + '=' + this.generateAttribute(node.attribs[attr]);
                    }, this);
                    html += '>' + ((node.children[0] || {}).data || '') + '</' + node.name + '>';
                } else if (node.type === 'directive') {
                    html += '<' + node.data + '>';
                }
            }, this);
            return html;
        }