Adds found data to the report via several HTML generators
174112
def _add_section_to_report(self, data):
    

    # Count samples that have errors and/or warnings
    pass_count = error_count = only_warning_count = 0
    for sample_data in data.values():
        if sample_data['file_validation_status'] == 'fail':
            error_count += 1
        elif sample_data['file_validation_status'] == 'warn':
            only_warning_count += 1
        else:
            pass_count += 1

    # Add overview note
    plot_html = []
    note_html = _generate_overview_note(
                        pass_count=pass_count,
                        only_warning_count=only_warning_count,
                        error_count=error_count,
                        total_count=len(data)
                    )
    plot_html.append(note_html)

    # Add the detailed table, but only if we have something to show
    if error_count or only_warning_count:
        table_html = _generate_detailed_table(data)
        plot_html.append(table_html)

    # Finally, add the html to the report as a section
    self.add_section(
            name='SAM/BAM File Validation',
            anchor='picard_validatesamfile',
            description=('This tool reports on the validity of a SAM or BAM '
                         'file relative to the SAM-format specification.'),
            helptext='''
            A detailed table is only shown if errors or warnings are found. Details about the errors and warnings are only shown if a `SUMMARY` report was parsed.

            For more information on the warnings, errors and possible fixes please read [this broadinstitute article](https://software.broadinstitute.org/gatk/documentation/article.php?id=7571).''',
            plot="\n".join(plot_html),
    )
636384
def make_report(plots, settings):
    '''
    
    '''
    logging.info("Writing html report.")
    html_content = ['<body>']

    # Hyperlink Table of Contents panel
    html_content.append('<div class="panel panelC">')
    if settings["filtered"]:
        html_content.append(
            '<p><strong><a href="#stats0">Summary Statistics prior to filtering</a></strong></p>')
        html_content.append(
            '<p><strong><a href="#stats1">Summary Statistics after filtering</a></strong></p>')
    else:
        html_content.append(
            '<p><strong><a href="#stats0">Summary Statistics</a></strong></p>')
    html_content.append('<p><strong><a href="#plots">Plots</a></strong></p>')
    html_content.extend(['<p style="margin-left:20px"><a href="#' +
                         p.title.replace(' ', '_') + '">' + p.title + '</a></p>' for p in plots])
    html_content.append('</div>')

    # The report itself: stats
    html_content.append('<div class="panel panelM"> <h1>NanoPlot report</h1>')
    if settings["filtered"]:
        html_content.append('<h2 id="stats0">Summary statistics prior to filtering</h2>')
        html_content.append(utils.stats2html(settings["statsfile"][0]))
        html_content.append('<h2 id="stats1">Summary statistics after filtering</h2>')
        html_content.append(utils.stats2html(settings["statsfile"][1]))
    else:
        html_content.append('<h2 id="stats0">Summary statistics</h2>')
        html_content.append(utils.stats2html(settings["statsfile"][0]))

    # The report itself: plots
    html_content.append('<h2 id="plots">Plots</h2>')
    for plot in plots:
        html_content.append('\n<h3 id="' + plot.title.replace(' ', '_') + '">' +
                            plot.title + '</h3>\n' + plot.encode())
        html_content.append('\n<br>\n<br>\n<br>\n<br>')
    html_body = '\n'.join(html_content) + '</div></body></html>'
    html_str = utils.html_head + html_body
    htmlreport = settings["path"] + "NanoPlot-report.html"
    with open(htmlreport, "w") as html_file:
        html_file.write(html_str)
    return htmlreport
769987
function writeGeneratedFileList(htmlFiles) {
  const fileList = htmlFiles.map(filename => {
    return {
      title: filename,
      path: `${devsitePath}${filename}`
    };
  });
  const generatedTocYAML = yaml.safeDump({ toc: fileList });
  return fs
    .writeFile(`${docPath}/_toc_autogenerated.yaml`, generatedTocYAML)
    .then(() => htmlFiles);
}
427261
def append(self, report):
        """"""
        assert report not in self.examples
        self.count += 1
        if len(self.examples) < self.top:
            self.examples.append(report)
1126896
private void addMetaData() {
		document.addTitle(getDocumentTitle());
		document.addAuthor(ReleaseInfoAdapter.getCompany());
		document.addCreator("NextReports " + ReleaseInfoAdapter.getVersionNumber());
		document.addSubject("Created by NextReports Designer" + ReleaseInfoAdapter.getVersionNumber());
		document.addCreationDate();
		document.addKeywords(ReleaseInfoAdapter.getHome());
	}
297667
def _generate_ids(self, document, content):
        
        existing_ids = content.xpath('//*/@id')
        elements = [
            'p', 'dl', 'dt', 'dd', 'table', 'div', 'section', 'figure',
            'blockquote', 'q', 'code', 'pre', 'object', 'img', 'audio',
            'video',
            ]
        elements_xpath = '|'.join(['.//{}|.//xhtml:{}'.format(elem, elem)
                                  for elem in elements])

        data_types = [
            'equation', 'list', 'exercise', 'rule', 'example', 'note',
            'footnote-number', 'footnote-ref', 'problem', 'solution', 'media',
            'proof', 'statement', 'commentary'
            ]
        data_types_xpath = '|'.join(['.//*[@data-type="{}"]'.format(data_type)
                                     for data_type in data_types])

        xpath = '|'.join([elements_xpath, data_types_xpath])

        mapping = {}  # old id -> new id

        for node in content.xpath(xpath, namespaces=HTML_DOCUMENT_NAMESPACES):
            old_id = node.attrib.get('id')
            document_id = document.id.replace('_', '')
            if old_id:
                new_id = 'auto_{}_{}'.format(document_id, old_id)
            else:
                random_number = random.randint(0, 100000)
                new_id = 'auto_{}_{}'.format(document_id, random_number)
            while new_id in existing_ids:
                random_number = random.randint(0, 100000)
                new_id = 'auto_{}_{}'.format(document_id, random_number)
            node.attrib['id'] = new_id
            if old_id:
                mapping[old_id] = new_id
            existing_ids.append(new_id)

        for a in content.xpath('//a[@href]|//xhtml:a[@href]',
                               namespaces=HTML_DOCUMENT_NAMESPACES):
            href = a.attrib['href']
            if href.startswith('#') and href[1:] in mapping:
                a.attrib['href'] = '#{}'.format(mapping[href[1:]])
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);
    }
947211
def write_template(data, results_dir, parent):
    
    print("Generating html report...")
    partial = time.time()
    j_env = Environment(loader=FileSystemLoader(os.path.join(results_dir, parent, 'templates')))
    template = j_env.get_template('report.html')

    report_writer = ReportWriter(results_dir, parent)
    report_writer.write_report(template.render(data))
    print("HTML report generated in {} seconds\n".format(time.time() - partial))
9605
function generateDemoHtml(done) {
			if (!o.htmlDemo) {
				done();
				return;
			}

			var context = prepareHtmlTemplateContext();

			// Generate HTML
			var demoTemplate = readTemplate(o.htmlDemoTemplate, 'demo', '.html');
			var demo = renderTemplate(demoTemplate, context);

			mkdirp(getDemoPath(), function(err) {
				if (err) {
					logger.log(err);
					return;
				}
				// Save file
				fs.writeFileSync(getDemoFilePath(), demo);
				done();
			});

		}
1041799
private List<RunResults> generateRunResultList(List<File> reportInputDataDirs, SrcTree srcTree)
            throws IllegalDataStructureException {
        List<RunResults> resultsList = new ArrayList<>(reportInputDataDirs.size());
        for (File reportInputDataDir : reportInputDataDirs) {
            RunResults results = new RunResults();
            Collection<File> runResultFiles;
            File runResultsRootDir = CommonPath.runResultRootDir(reportInputDataDir);
            if (runResultsRootDir.exists()) {
                runResultFiles = FileUtils.listFiles(runResultsRootDir, null, true);
            } else {
                runResultFiles = new ArrayList<>(0);
            }
            for (File runResultFile : runResultFiles) {
                Map<String, Object> runResultYamlObj = YamlUtils.load(runResultFile);
                RootMethodRunResult rootMethodRunResult = new RootMethodRunResult();
                try {
                    rootMethodRunResult.fromYamlObject(runResultYamlObj);
                } catch (YamlConvertException e) {
                    throw new IllegalDataStructureException(e);
                }
                results.addRootMethodRunResults(rootMethodRunResult);
            }
            results.resolveKeyReference(srcTree);
            resultsList.add(results);
        }
        return resultsList;
    }
230217
def _generate_report(ret, setup):
    '''
    
    '''

    retdata = ret.get('return', {})

    sorted_data = sorted(
        retdata.items(),
        key=lambda s: s[1].get('__run_num__', 0)
    )

    total = 0
    failed = 0
    changed = 0
    duration = 0.0

    # gather stats
    for _, data in sorted_data:
        if not data.get('result', True):
            failed += 1
        total += 1

        try:
            duration += float(data.get('duration', 0.0))
        except ValueError:
            pass

        if data.get('changes', {}):
            changed += 1

    unchanged = total - failed - changed

    log.debug('highstate total: %s', total)
    log.debug('highstate failed: %s', failed)
    log.debug('highstate unchanged: %s', unchanged)
    log.debug('highstate changed: %s', changed)

    # generate report if required
    if setup.get('report_everything', False) or \
       (setup.get('report_changes', True) and changed != 0) or \
       (setup.get('report_failures', True) and failed != 0):

        report = [
            {'stats': [
                {'total': total},
                {'failed': failed, '__style__': 'failed'},
                {'unchanged': unchanged, '__style__': 'unchanged'},
                {'changed': changed, '__style__': 'changed'},
                {'duration': duration}
            ]},
            {'job': [
                {'function': ret.get('fun', '')},
                {'arguments': ret.get('fun_args', '')},
                {'jid': ret.get('jid', '')},
                {'success': ret.get('success', True)},
                {'retcode': ret.get('retcode', 0)}
            ]},
            {'states': _generate_states_report(sorted_data)}
        ]

        if failed:
            function = setup.get('failure_function', None)
        else:
            function = setup.get('success_function', None)

        if function:
            func_result = __salt__[function]()
            report.insert(
                0,
                {'extra': [{function: _dict_to_name_value(func_result)}]}
            )

    else:
        report = []

    return report, failed
50083
def render_html(self):
        """"""
        return self._template.safe_substitute(
            report_type=self._report_type,
            results=self.render_json()
        )
480532
public void addDataElement(String elemName, String content, Map<String,String> attrs) {
    	addDataElement(elemName, content, toAttributes(attrs));
    }
731766
def generate_report(
        book_url,
        fund_ids: StringOption(
            section="Funds",
            sort_tag="c",
            documentation_string="Comma-separated list of fund ids.",
            default_value="8123,8146,8148,8147")
    ):
    """"""
    return render_report(book_url, fund_ids)
1160434
function (report) {
            var inputField = this._textInputField;
            var inputFieldParent = inputField.parentNode;
            if (report.clearSuggestions) {
                this._makeInputFieldLastChild();
                while (inputFieldParent.firstChild != inputField) {
                    inputFieldParent.removeChild(inputFieldParent.firstChild);
                }
            }
            var suggestionsToAdd = report.suggestionsToAdd;
            if (suggestionsToAdd && suggestionsToAdd.length > 0) {
                var suggestionsMarkup = [];
                for (var i = 0, l = suggestionsToAdd.length; i < l; i++) {
                    suggestionsMarkup.push(this._generateSuggestionMarkup(suggestionsToAdd[i]));
                }
                ariaUtilsDom.insertAdjacentHTML(inputField, "beforeBegin", suggestionsMarkup.join(""));
                this.__createEllipsis(inputField);
                this._makeInputFieldLastChild();
                inputField.style.width = "0px";
                this.__resizeInput();
            }
        }
258959
function generateReport(html) {
        var template = grunt.file.read(templates.reportTemplate);
        return grunt.template.process(template, {
            data: {
                scenarios: html
            }
        });
    }
1287179
void appendHtmlReport(StringBuilder sb) {
    sb.append("<table class=\"storage\">");
    sb.append("<thead><tr><td>JN</td><td>Status</td></tr></thead>\n");
    for (AsyncLogger l : loggers) {
      sb.append("<tr>");
      sb.append("<td>" + JspUtil.escapeXml(l.toString()) + "</td>");
      sb.append("<td>");
      l.appendHtmlReport(sb);
      sb.append("</td></tr>\n");
    }
    sb.append("</table>");
  }