This method is not needed if `to_html` generates the same code. Here
 `to_html` generates the code with `onload`, so there is need of
 `high_chart_iruby` which doesn't use `onload` in chart script.
973963
def to_html_iruby(placeholder=random_canvas_id)
      # TODO : placeholder pass, in plot#div
      @div_id = placeholder
      load_dependencies('iruby')
      chart_hash_must_be_present
      script = high_chart_css(placeholder)
      script << high_chart_iruby(extract_chart_class, placeholder, self)
      script
    end
761109
protected function write_html_data() {
        global $PAGE, $SITE, $USER, $CFG;

        // Do this first before adding more files to $this->files.
        list($tree, $treekey, $allfiles) = $this->prepare_for_export();
        // Add more detail to the tree such as contexts.
        $richtree = $this->make_tree_object($tree, $treekey);
        // Now that we have more detail we can use that to sort it.
        $this->sort_my_list($richtree);

        // Copy over the JavaScript required to display the html page.
        $jspath = ['privacy', 'export_files', 'general.js'];
        $targetpath = ['js', 'general.js'];
        $this->copy_data($jspath, $targetpath);

        $jquery = ['lib', 'jquery', 'jquery-3.2.1.min.js'];
        $jquerydestination = ['js', 'jquery-3.2.1.min.js'];
        $this->copy_data($jquery, $jquerydestination);

        $requirecurrentpath = ['lib', 'requirejs', 'require.min.js'];
        $destination = ['js', 'require.min.js'];
        $this->copy_data($requirecurrentpath, $destination);

        $treepath = ['lib', 'amd', 'build', 'tree.min.js'];
        $destination = ['js', 'tree.min.js'];
        $this->copy_data($treepath, $destination);

        // Icons to be used.
        $expandediconpath = ['pix', 't', 'expanded.svg'];
        $this->copy_data($expandediconpath, ['pix', 'expanded.svg']);
        $collapsediconpath = ['pix', 't', 'collapsed.svg'];
        $this->copy_data($collapsediconpath, ['pix', 'collapsed.svg']);
        $naviconpath = ['pix', 'i', 'navigationitem.svg'];
        $this->copy_data($naviconpath, ['pix', 'navigationitem.svg']);
        $moodleimgpath = ['pix', 'moodlelogo.svg'];
        $this->copy_data($moodleimgpath, ['pix', 'moodlelogo.svg']);

        // Additional required css.
        $csspath = ['theme', 'boost', 'style', 'moodle.css'];
        $destination = ['moodle.css'];
        $this->copy_data($csspath, $destination);

        $csspath = ['privacy', 'export_files', 'general.css'];
        $destination = ['general.css'];
        $this->copy_data($csspath, $destination);

        // Create an index file that lists all, to be newly created, js files.
        $encoded = json_encode($allfiles,  JSON_PRETTY_PRINT);
        $encoded = 'var user_data_index = ' . $encoded;

        $path = 'js' . DIRECTORY_SEPARATOR . 'data_index.js';
        $this->write_data($path, $encoded);

        $output = $PAGE->get_renderer('core_privacy');
        $navigationpage = new \core_privacy\output\exported_navigation_page(current($richtree));
        $navigationhtml = $output->render_navigation($navigationpage);

        $systemname = $SITE->fullname;
        $fullusername = fullname($USER);
        $siteurl = $CFG->wwwroot;

        // Create custom index.html file.
        $rtl = right_to_left();
        $htmlpage = new \core_privacy\output\exported_html_page($navigationhtml, $systemname, $fullusername, $rtl, $siteurl);
        $outputpage = $output->render_html_page($htmlpage);
        $this->write_data('index.html', $outputpage);
    }
816373
function (data, option, callback) {
            var html = '';
            var self = this;
            var fn = self.fn;
            if (typeof option === 'function') {
                callback = option;
                option = null;
            }
            option = option || {};
            callback = callback || function (error, ret) {
                if (error) {
                    if (!(error instanceof Error)) {
                        error = new Error(error);
                    }
                    throw error;
                }
                html = ret;
            };
            var name = self.config.name;
            if (!name && fn.TPL_NAME) {
                name = fn.TPL_NAME;
            }
            var scope = new Scope(data), buffer = new LinkedBuffer(callback).head;
            renderTpl({
                name: name,
                fn: fn,
                runtime: { commands: option.commands },
                root: self
            }, scope, buffer);
            return html;
        }
942107
def render(self, total=False, transpose=False, style=False):
        
        self.chart.setup()
        ln = self.chart._len
        html = HTML()
        attrs = {}

        if style:
            attrs['id'] = 'table-%s' % uuid.uuid4()

        table = []

        _ = lambda x: x if x is not None else ''

        if self.chart.x_labels:
            labels = [None] + list(self.chart.x_labels)
            if len(labels) < ln:
                labels += [None] * (ln + 1 - len(labels))
            if len(labels) > ln + 1:
                labels = labels[:ln + 1]
            table.append(labels)

        if total:
            if len(table):
                table[0].append('Total')
            else:
                table.append([None] * (ln + 1) + ['Total'])
            acc = [0] * (ln + 1)

        for i, serie in enumerate(self.chart.all_series):
            row = [serie.title]
            if total:
                sum_ = 0
            for j, value in enumerate(serie.values):
                if total:
                    v = value or 0
                    acc[j] += v
                    sum_ += v
                row.append(self.chart._format(serie, j))
            if total:
                acc[-1] += sum_
                row.append(self.chart._serie_format(serie, sum_))
            table.append(row)

        width = ln + 1
        if total:
            width += 1
            table.append(['Total'])
            for val in acc:
                table[-1].append(self.chart._serie_format(serie, val))

        # Align values
        len_ = max([len(r) for r in table] or [0])

        for i, row in enumerate(table[:]):
            len_ = len(row)
            if len_ < width:
                table[i] = row + [None] * (width - len_)

        if not transpose:
            table = list(zip(*table))

        thead = []
        tbody = []
        tfoot = []

        if not transpose or self.chart.x_labels:
            # There's always series title but not always x_labels
            thead = [table[0]]
            tbody = table[1:]
        else:
            tbody = table

        if total:
            tfoot = [tbody[-1]]
            tbody = tbody[:-1]

        parts = []
        if thead:
            parts.append(
                html.thead(
                    *[html.tr(*[html.th(_(col)) for col in r]) for r in thead]
                )
            )
        if tbody:
            parts.append(
                html.tbody(
                    *[html.tr(*[html.td(_(col)) for col in r]) for r in tbody]
                )
            )
        if tfoot:
            parts.append(
                html.tfoot(
                    *[html.tr(*[html.th(_(col)) for col in r]) for r in tfoot]
                )
            )

        table = tostring(html.table(*parts, **attrs))
        if style:
            if style is True:
                css = '''
                #{{ id }} {
                    border-collapse: collapse;
                    border-spacing: 0;
                    empty-cells: show;
                    border: 1px solid #cbcbcb;
                }
                #{{ id }} td, #{{ id }} th {
                    border-left: 1px solid #cbcbcb;
                    border-width: 0 0 0 1px;
                    margin: 0;
                    padding: 0.5em 1em;
                }
                #{{ id }} td:first-child, #{{ id }} th:first-child {
                    border-left-width: 0;
                }
                #{{ id }} thead, #{{ id }} tfoot {
                    color: #000;
                    text-align: left;
                    vertical-align: bottom;
                }
                #{{ id }} thead {
                    background: #e0e0e0;
                }
                #{{ id }} tfoot {
                    background: #ededed;
                }
                #{{ id }} tr:nth-child(2n-1) td {
                    background-color: #f2f2f2;
                }
                '''
            else:
                css = style
            table = tostring(
                html.style(template(css, **attrs), scoped='scoped')
            ) + table
        table = table.decode('utf-8')
        self.chart.teardown()
        return table
1036374
def render(self, name=None, value=None, attrs=None):
        
        attrs = {} or attrs
        self.attrs = attrs
        self.name = name
        self.value = value

        id_ = self.attrs.get('id')
        output = []
        for i, choice in enumerate(self.choices):
            choice_value, choice_label = choice
            if isinstance(choice_label, (tuple, list)):
                attrs_plus = self.attrs.copy()
                if id_:
                    attrs_plus['id'] += '_{}'.format(i)
                sub_ul_renderer = self.__class__(
                    attrs=attrs_plus,
                    choices=choice_label,
                )
                sub_ul_renderer.choice_input_class = self.choice_input_class
                output.append(html.format_html(
                    self.inner_html, choice_value=choice_value,
                    sub_widgets=sub_ul_renderer.render(),
                ))
            else:
                w = self.choice_input_class(
                    self.name, self.value, self.attrs.copy(), choice, i)
                output.append(html.format_html(
                    self.inner_html,
                    choice_value=force_text(w),
                    sub_widgets=''))
        return html.format_html(
            self.outer_html,
            id_attr=html.format_html(' id="{}"', id_) if id_ else '',
            content=mark_safe('\n'.join(output)),
        )
207270
function () {
            var chart = this,
              axes = chart.axes,
              series = chart.series,
              container = chart.container,
              i,
              parentNode = container && container.parentNode;

            // fire the chart.destoy event
            fireEvent(chart, 'destroy');

            // Delete the chart from charts lookup array
            charts[chart.index] = UNDEFINED;
            chartCount--;
            chart.renderTo.removeAttribute('data-highcharts-chart');

            // remove events
            removeEvent(chart);

            // ==== Destroy collections:
            // Destroy axes
            i = axes.length;
            while (i--) {
                axes[i] = axes[i].destroy();
            }

            // Destroy each series
            i = series.length;
            while (i--) {
                series[i] = series[i].destroy();
            }

            // ==== Destroy chart properties:
            each(['title', 'subtitle', 'chartBackground', 'plotBackground', 'plotBGImage',
                'plotBorder', 'seriesGroup', 'clipRect', 'credits', 'pointer', 'scroller',
                'rangeSelector', 'legend', 'resetZoomButton', 'tooltip', 'renderer'], function (name) {
                var prop = chart[name];

                if (prop && prop.destroy) {
                    chart[name] = prop.destroy();
                }
            });

            // remove container and all SVG
            if (container) { // can break in IE when destroyed before finished loading
                container.innerHTML = '';
                removeEvent(container);
                if (parentNode) {
                    discardElement(container);
                }

            }

            // clean it all up
            for (i in chart) {
                delete chart[i];
            }

        }
1186859
def to_html(options = :DEFAULT, extensions = [])
      opts = Config.process_options(options, :render)
      _render_html(opts, extensions).force_encoding('utf-8')
    end
278034
def render_chart_data(data):
    
    builder = HtmlBuilder()
    builder._render_objects(data, datatype='chartdata')
    return builder._to_html()
277179
function (data, callback) {
            var html = '';
            var self = this;
            callback = callback || function (error, ret) {
                html = ret;
            };
            if (!self.name && self.tpl.TPL_NAME) {
                self.name = self.tpl.TPL_NAME;
            }
            var scope = new Scope(data), buffer = new LinkedBuffer(callback).head;
            renderTpl(self, scope, buffer);
            return html;
        }
524239
function htmlRenamer () {
  return (file) => {
    if (path.extname(file.info.dest) === '.html') {
      const filenameWithoutExtension = path.basename(file.info.dest).replace('.html', '')
      const rootPath = path.dirname(file.info.dest)
      return file.clone({
        info: file.info.clone({
          dest: filenameWithoutExtension === 'index' ? file.info.dest : path.join(rootPath, filenameWithoutExtension, 'index.html')
        })
      })
    } else {
      return file
    }
  }
}
788850
def extract_export_code_iruby(
      placeholder=random_canvas_id, export_type='png', file_name='chart'
    )
      js = ''
      js << "\n <script>"
      js << "\n (function() {"
      js << "\n \tvar chartDom = document.getElementById('#{placeholder}');"
      js << "\n \tvar chart = Highcharts.charts[Highcharts.attr(chartDom,"
      js << " 'data-highcharts-chart')]"
      js << "\n \tchart.exportChart({"
      js << "\n \t\t" + append_chart_type(export_type)
      js << "\n \t\tfilename: '#{file_name}'"
      js << "\n \t});"
      js << "\n })();"
      js << "\n </script>"
      js
    end
438631
def yield_html
      if (template_path = attrs.content_template_path)
        @yield_renderer ||= StringTemplateRenderer.new(@volt_app, attrs.content_controller, template_path)
        @yield_renderer.html
      else
        # no template, empty string
        ''
      end
    end
147457
function() { 
        this.logger.log("Generating html");
        var sb = [];

        sb[sb.length] = '<table id="ygtvtableel' + this.index + '" border="0" cellpadding="0" cellspacing="0" class="ygtvtable ygtvdepth' + this.depth;
        if (this.enableHighlight) {
            sb[sb.length] = ' ygtv-highlight' + this.highlightState;
        }
        if (this.className) {
            sb[sb.length] = ' ' + this.className;
        }           
        sb[sb.length] = '"><tr class="ygtvrow">';
        
        for (var i=0;i<this.depth;++i) {
            sb[sb.length] = '<td class="ygtvcell ' + this.getDepthStyle(i) + '"><div class="ygtvspacer"></div></td>';
        }

        if (this.hasIcon) {
            sb[sb.length] = '<td id="' + this.getToggleElId();
            sb[sb.length] = '" class="ygtvcell ';
            sb[sb.length] = this.getStyle() ;
            sb[sb.length] = '"><a href="#" class="ygtvspacer">&#160;</a></td>';
        }

        sb[sb.length] = '<td id="' + this.contentElId; 
        sb[sb.length] = '" class="ygtvcell ';
        sb[sb.length] = this.contentStyle  + ' ygtvcontent" ';
        sb[sb.length] = (this.nowrap) ? ' nowrap="nowrap" ' : '';
        sb[sb.length] = ' >';
        sb[sb.length] = this.getContentHtml();
        sb[sb.length] = '</td></tr></table>';

        return sb.join("");

    }
441693
def to_html(self):
        
        # Apply bootstrap alignment classes first
        if self.align is 'left':
            if self.style_class is None:
                self.style_class = 'text-left'
            else:
                self.style_class += ' text-left'
        elif self.align is 'right':
            if self.style_class is None:
                self.style_class = 'text-right'
            else:
                self.style_class += ' text-right'
        elif self.align is 'center':
            if self.style_class is None:
                self.style_class = 'text-center'
            else:
                self.style_class += ' text-center'

        # Special case for when we want to put a nested table in a cell
        # We don't use isinstance because of recursive imports with table
        class_name = self.content.__class__.__name__
        if class_name in ['BulletedList', 'Table', 'Image', 'Message']:
            html = self.content.to_html()
        else:
            html = self.content.to_html(wrap_slash=self.wrap_slash)

        # Check if we have a header or not then render
        if self.header_flag is True:
            return '<th%s colspan=%i>%s</th>\n' % (
                self.html_attributes(), self.span, html)
        else:
            return '<td%s colspan=%i>%s</td>\n' % (
                self.html_attributes(), self.span, html)
1158493
def to_html(data):
    
    base_html_template = Template('''
        <html>
            <head>
                {% if style %}
                <style type="text/css">
                    {{ style }}
                </style>
                {% endif %}
            </head>
            <body>
                {% if style %}
                    {{ body|safe }}
                {% else %}
                    <pre></code>{{ body }}</code></pre>
                {% endif %}
            </body>
        </html>
        ''')

    code = to_json(data, indent=4)
    if PYGMENTS_INSTALLED:
        c = Context({
            'body': highlight(code, JSONLexer(), HtmlFormatter()),
            'style': HtmlFormatter().get_style_defs('.highlight')
        })
        html = base_html_template.render(c)
    else:
        c = Context({'body': code})
        html = base_html_template.render(c)
    return html
344626
def _chart_support(self, name, data, caller, **kwargs):
        ""
        id = 'chart-%s' % next(self.id)
        name = self._chart_class_name(name)
        options = dict(self.environment.options)
        options.update(name=name, id=id)

        # jinja2 prepends 'l_' or 'l_{{ n }}'(ver>=2.9) to keys
        if jinja2.__version__ >= '2.9':
            kwargs = dict((k[4:], v) for (k, v) in kwargs.items())
        else:
            kwargs = dict((k[2:], v) for (k, v) in kwargs.items())

        if self._library is None:
            self._library = self.load_library()
        id = kwargs.get('id', '')
        library = self._library.get(id, {})

        # apply options from a tag
        library.update(kwargs.get('library', {}))
        # apply options from chartkick.json
        kwargs.update(library=library)

        options.update(kwargs)
        return CHART_HTML.format(data=data, options=json.dumps(kwargs),
                                 **options)
543756
function () {
		var chart = this,
			options = chart.options,
			callback = chart.callback;

		// Check whether the chart is ready to render
		if (!chart.isReadyToRender()) {
			return;
		}

		// Create the container
		chart.getContainer();

		// Run an early event after the container and renderer are established
		fireEvent(chart, 'init');

		
		chart.resetMargins();
		chart.setChartSize();

		// Set the common chart properties (mainly invert) from the given series
		chart.propFromSeries();

		// get axes
		chart.getAxes();

		// Initialize the series
		each(options.series || [], function (serieOptions) {
			chart.initSeries(serieOptions);
		});

		chart.linkSeries();

		// Run an event after axes and series are initialized, but before render. At this stage,
		// the series data is indexed and cached in the xData and yData arrays, so we can access
		// those before rendering. Used in Highstock. 
		fireEvent(chart, 'beforeRender'); 

		// depends on inverted and on margins being set
		chart.pointer = new Pointer(chart, options);

		chart.render();

		// add canvas
		chart.renderer.draw();
		// run callbacks
		if (callback) {
			callback.apply(chart, [chart]);
		}
		each(chart.callbacks, function (fn) {
			fn.apply(chart, [chart]);
		});
		
		
		// If the chart was rendered outside the top container, put it back in
		chart.cloneRenderTo(true);

		fireEvent(chart, 'load');

	}