Generate HTML to display map.
180259
def as_html(self):
        """"""
        if not self._folium_map:
            self.draw()
        return self._inline_map(self._folium_map, self._width, self._height)
400744
def render(self, context):
        """"""
        import markdown
        content = self.get_content_from_context(context)
        return markdown.markdown(content)
319619
def _render_content(self):
        """"""
        if self.content_format == "rst" and docutils_publish is not None:
            doc_parts = docutils_publish(
                source=self.raw_content,
                writer_name="html4css1"
            )
            self.rendered_content = doc_parts['fragment']
        elif self.content_format == "rs" and docutils_publish is None:
            raise RuntimeError("Install docutils to pubilsh reStructuredText")
        elif self.content_format == "md" and markdown is not None:
            self.rendered_content = markdown(self.raw_content)
        elif self.content_format == "md" and markdown is None:
            raise RuntimeError("Install Markdown to pubilsh markdown")
        else:  # Assume we've got html
            self.rendered_content = self.raw_content
600794
def render(self):
        """"""
        context = GLOBAL_TEMPLATE_CONTEXT.copy()
        context['tag'] = self
        entries = list(self.entries)
        entries.sort(key=operator.attrgetter('date'), reverse=True)
        context['entries'] = entries

        # render html page
        render_to = os.path.join(CONFIG['output_to'], 'tags', self.slug)
        if not os.path.exists(render_to):  # pragma: no coverage
            os.makedirs(render_to)
        _render(context, 'tag_index.html', os.path.join(render_to, 'index.html'))  # noqa

        # render atom.xml
        context['entries'] = context['entries'][:10]
        context['last_build'] = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")  # noqa

        _render(context, 'atom.xml', os.path.join(render_to, 'atom.xml'))
        return True
1176097
private List<String> getHtmlLines(Map<String, String> infos) {

        List<String> htmlLines = new ArrayList<String>();

        for (String key : infos.keySet()) {
            htmlLines.add(
                "<div style=\"display:flex;align-items:flex-end;\"><div class=\""
                    + OpenCmsTheme.INFO_ELEMENT_NAME
                    + "\">"
                    + key
                    + " :</div><div style=\"width:140px;\" class=\""
                    + OpenCmsTheme.INFO_ELEMENT_VALUE
                    + "\">"
                    + infos.get(key)
                    + "</div></div>");
        }
        m_htmlLines = htmlLines;
        return htmlLines;
    }
561070
def to_html(self):
        """"""
        id, classes, kvs = self.id, self.classes, self.kvs
        id_str = 'id="{}"'.format(id) if id else ''
        class_str = 'class="{}"'.format(' '.join(classes)) if classes else ''
        key_str = ' '.join('{}={}'.format(k, v) for k, v in kvs.items())
        return ' '.join((id_str, class_str, key_str)).strip()
183115
def create_html(self):
        """"""

        roc_dicts = []
        with open(self._roc_fn, "r") as roc:
            for line in roc:
                line = line.strip()
                if line != "" and line[0] != "#":
                    (q, M, w, m, P, U, u, T, t, x, a) = map(int, line.split("\t"))
                    roc_dict = {
                        "q": q,
                        "M": M,
                        "w": w,
                        "m": m,
                        "P": P,
                        "U": U,
                        "u": u,
                        "T": T,
                        "t": t,
                        "x": x,
                        "a": a,
                        "mapped": M + w + m + P,
                        "unmapped": U + u + T + t + x,
                    }
                    roc_dicts.append(roc_dict)
        tbody = os.linesep.join(
            [
                """
				<tr>
					<td>        {quality}                   </td>
					<td>        {mapped}                    </td>
					<td><small> {mapped_proc:.2f}   </small></td>
					<td>        {M}                         </td>
					<td><small> {M_proc:.2f}        </small></td>
					<td>        {w}                         </td>
					<td><small> {w_proc:.2f}        </small></td>
					<td>        {m}                         </td>
					<td><small> {m_proc:.2f}        </small></td>
					<td>        {P}                         </td>
					<td><small> {P_proc:.2f}        </small></td>
					<td>        {unmapped}                  </td>
					<td><small> {unmapped_proc:.2f} </small></td>
					<td>        {U}                         </td>
					<td><small> {U_proc:.2f}        </small></td>
					<td>        {u}                         </td>
					<td><small> {u_proc:.2f}        </small></td>
					<td>        {T}                         </td>
					<td><small> {T_proc:.2f}        </small></td>
					<td>        {t}                         </td>
					<td><small> {t_proc:.2f}        </small></td>
					<td>        {x}                         </td>
					<td><small> {x_proc:.2f}        </small></td>
					<td>        {sum}                       </td>
					<td>        {prec_proc:.3f}              </td>
				</tr>
			""".format(
                    quality=roc_dict["q"],
                    mapped=roc_dict["mapped"],
                    mapped_proc=100.0 * (roc_dict["mapped"]) / roc_dict["a"],
                    M=roc_dict["M"],
                    M_proc=100.0 * (roc_dict["M"]) / (roc_dict["mapped"]) if (roc_dict["mapped"]) != 0 else 0,
                    w=roc_dict["w"],
                    w_proc=100.0 * (roc_dict["w"]) / (roc_dict["mapped"]) if (roc_dict["mapped"]) != 0 else 0,
                    m=roc_dict["m"],
                    m_proc=100.0 * (roc_dict["m"]) / (roc_dict["mapped"]) if (roc_dict["mapped"]) != 0 else 0,
                    P=roc_dict["P"],
                    P_proc=100.0 * (roc_dict["P"]) / (roc_dict["mapped"]) if (roc_dict["mapped"]) != 0 else 0,
                    unmapped=roc_dict["unmapped"],
                    unmapped_proc=100.0 * (roc_dict["unmapped"]) / roc_dict["a"],
                    U=roc_dict["U"],
                    U_proc=100.0 * (roc_dict["U"]) / (roc_dict["unmapped"]) if (roc_dict["unmapped"]) != 0 else 0,
                    u=roc_dict["u"],
                    u_proc=100.0 * (roc_dict["u"]) / (roc_dict["unmapped"]) if (roc_dict["unmapped"]) != 0 else 0,
                    T=roc_dict["T"],
                    T_proc=100.0 * (roc_dict["T"]) / (roc_dict["unmapped"]) if (roc_dict["unmapped"]) != 0 else 0,
                    t=roc_dict["t"],
                    t_proc=100.0 * (roc_dict["t"]) / (roc_dict["unmapped"]) if (roc_dict["unmapped"]) != 0 else 0,
                    x=roc_dict["x"],
                    x_proc=100.0 * (roc_dict["x"]) / (roc_dict["unmapped"]) if (roc_dict["unmapped"]) != 0 else 0,
                    sum=roc_dict["a"],
                    prec_proc=100.0 * (roc_dict["M"]) / (roc_dict["mapped"]) if (roc_dict["mapped"]) != 0 else 0,
                ) for roc_dict in roc_dicts
            ]
        )

        with open(self._html_fn, "w+") as html:
            program_info = ["No information available (PG header is essing)."]
            for x in rnftools.utils.shell(
                '"{samtools}" view -H "{bam}"'.format(
                    samtools="samtools",
                    bam=self._bam_fn,
                ), iterable=True
            ):
                x = x.strip()

                if x[:3] == "@PG":
                    pg_header = x[4:].strip()
                    parts = pg_header.split("\t")

                    program_info = ["<table>"]
                    for part in parts:
                        (lvalue, _, rvalue) = part.partition(":")
                        program_info.append(
                            '<tr><td style="font-weight:bold">{}:</td><td style="text-align:left">{}</td></tr>'.format(
                                lvalue, rvalue
                            )
                        )

                    program_info.append("</table>")

            eval_info = ["<table>"]
            for (lvalue, rvalue) in [
                ("BAM file", self._bam_fn),
                ("Allowed delta", self.report.allowed_delta),
            ]:
                eval_info.append(
                    '<tr><td style="font-weight:bold">{}:</td><td style="text-align:left">{}</td></tr>'.format(
                        lvalue, rvalue
                    )
                )

            eval_info.append("</table>")

            css_src = textwrap.dedent(
                """
					table            {border-collapse:collapse;}
					td               {border: solid #aaaaff 1px;padding:4px;text-align:right;}
					colgroup, thead  {border: solid black 2px;padding 2px;}
					.link_to_top     {font-size:10pt;}
					.desc            {color:#aaa;}
					.formats         {text-align:left;margin-bottom:20px;}
				"""
            )

            html_src = """<!DOCTYPE html>
				<html>
				<head>
					<meta charset="UTF-8" />
					<title>{name}</title>
					<style type="text/css">
					{css}
					</style>
				</head>
				<body>
					<h1 id="top">
						{name}
						<span class="link_to_top">
							[<a href="{homepage}">Back to main report</a>]
						</span>
					</h1>
	
					<p>
						<a href="#info_eval">Information about evaluation</a> -
						<a href="#info_prog">Information about program</a> -
						<a href="#roctable">ROC table</a> -
						<a href="#graphs">Graphs</a>
					</p>
	
					<h2 id="info_eval">
						Information about evaluation
						{headline_links}
					</h2>
	
					{eval_info}
	
					<h2 id="info_prog">
						Information about program
						{headline_links}
					</h2>
	
	
					{program_info}
	
					<h2 id="roctable">
						ROC table
						{headline_links}
					</h2>
	
					<p style="font-size:80%">
						<strong>M</strong>:
							mapped correctly
							<span class="desc">
								(all segments of tuple are mapped once and correctly),
							</span>
						<strong>w</strong>:
							mapped to wrong position
							<span class="desc">
								(at least one segment was mapped to a wrong position),
							</span>
						<strong>m</strong>:
							mapped but should be unmapped
							<span class="desc">
								(at least one segment was mapped but the read should not be mapped),
							</span>
						<strong>P</strong>:
							multimapped
							<span class="desc">
								(read should be mapped but it at least one segment was mapped several
								times and all segments were mapped correctly at least once),
							</span>
						<strong>U</strong>:
							unmapped correctly
							<span class="desc">
								(all segments of the read were correctly marked as unmapped),
							</span>
						<strong>u</strong>:
							unmapped but should be mapped
							<span class="desc">
								(at least one segment was mapped but entire read should be unmapped),
							</span>
						<strong>T</strong>:
							thresholded correctly
							<span class="desc">
								(read shoud not be mapped),
							</span>
						<strong>t</strong>:
							thresholded incorrectly
							<span class="desc">
								(read should be mapped),
							</span>
						<strong>x</strong>:
							unknown
							<span class="desc">
								(read is probably not reported by mapper)
							</span>
					</p>
					<table>
						<colgroup span="1" style="">
						<colgroup span="2" style="background-color:#ddd">
						<colgroup span="8" style="">
						<colgroup span="2" style="background-color:#ddd">
						<colgroup span="10" style="">
						<colgroup span="1" style="background-color:#ddd">
						<colgroup span="1" style="">
						<thead style="font-weight:bold;background-color:#ddddff">
							<tr style="font-weight:bold;background-color:#ddddff">
								<td>q</td>
								<td>mapped</td>
								<td>%</td>
								<td>M</td>
								<td>%</td>
								<td>w</td>
								<td>%</td>
								<td>m</td>
								<td>%</td>
								<td>P</td>
								<td>%</td>
								<td>unmapped</td>
								<td>%</td>
								<td>U</td>
								<td>%</td>
								<td>u</td>
								<td>%</td>
								<td>T</td>
								<td>%</td>
								<td>t</td>
								<td>%</td>
								<td>x</td>
								<td>%</td>
								<td>sum</td>
								<td>prec. (%)</td>
							</tr>
						</thead>
						<tbody>
							{tbody}
						</tbody>
					</table>
	
					<h2 id="graphs">
						Graphs
						{headline_links}
					</h2>
	
					<div class="formats">
						<img src="{svg}" />
						<br />
						<a href="{svg}">SVG version</a>
						|
						<a href="{roc}" type="text/csv">ROC file</a>
						|
						<a href="{gp}" type="text/plain">GP file</a>
					</div>
	
	
				</body>
				</html>
				""".format(
                name=self.name, tbody=tbody, css=css_src,
                svg=os.path.relpath(self._svg_fn, os.path.dirname(self._html_fn)),
                roc=os.path.relpath(self._roc_fn, os.path.dirname(self._html_fn)),
                gp=os.path.relpath(self._gp_fn, os.path.dirname(self._html_fn)), eval_info=os.linesep.join(eval_info),
                program_info=os.linesep.join(program_info),
                homepage=os.path.relpath(self.report.html_fn(), os.path.dirname(self._html_fn)), headline_links='''
							<span class="link_to_top">
								[<a href="#top">Top of this page</a>]
								[<a href="{homepage}">Back to main report</a>]
							</span>
						'''.format(homepage=os.path.relpath(self.report.html_fn(), os.path.dirname(self._html_fn)), )
            )

            tidy_html_src = bs4.BeautifulSoup(html_src).prettify()
            html.write(tidy_html_src)
258959
function generateReport(html) {
        var template = grunt.file.read(templates.reportTemplate);
        return grunt.template.process(template, {
            data: {
                scenarios: html
            }
        });
    }
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))
149500
def html(self):
        
        return self.render(self.data, self.proj, self.obj)
728044
def format(self, **kwargs):
        """"""
        attrs = self._attrs.copy()
        attrs.update({'width': self._width, 'height': self._height})
        attrs.update(kwargs)
        return Map(self._features, **attrs)
784703
def display_map(fname):
    
    print("viewing ", fname)
    
    wrld = read_map(fname)
    for row in wrld:
        #for col in row:
        print(row)
    app = gui_view_tk(None)
    app.add_file(fname)
    app.show_grid_from_file(fname)
    app.title('Map View')
    app.mainloop()
1077301
def html_report(self, file_path):
        """"""
        self.logger.debug('Generating HTML report')
        report = self.zap.core.htmlreport()
        self._write_report(report, file_path)
1356575
def render(self, rectangle, data):
        """"""

        size = (1.0 - 2.0*self.margin) * rectangle.h
        offset = self.margin * rectangle.h
        per_mark = 1.0 / float(self.total)
        bottom = offset + size * float(self.index) * per_mark
        top = bottom + per_mark * size

        c = data['output']
        with c:
            c.translate(rectangle.x, rectangle.y)
            c.draw_polygon(
                0, top, -self.width, bottom, self.width, bottom,
                fill=self.color
                )
233599
public function generatepage_html(){
		$bhtml=BHTML::getInstance();
		$status=200;
		//Forming page from blocks...
		$jsused=array();
		$cssused=array();
		foreach($this->rules as &$c){
			if(isset($this->positions[$c->position])){
				$this->positions[$c->position].=$c->output;
				}else{
				$this->positions[$c->position]=$c->output;
				}
			if($c->status!=200){
				$status=$c->status;
				}
			if(isset($c->locationurl)){
				$bhtml->setLocationUrl($c->locationurl,$c->locationtime);
				}
			if(isset($c->modified)){
				$bhtml->setLastModified($c->modified);
				}
			if(isset($c->title)){
				$bhtml->setTitle($c->title);
				}
			if(isset($c->meta)){
				foreach($c->meta as $meta){
					$bhtml->add_meta($meta['name'],$meta['content'],$meta['http_equiv']);
					}
				}
			if(isset($c->link)){
				foreach($c->link as $link){
					//Remove dublicates...
					$wasused=false;
					if($link['rel']=='stylesheet'){
						$wasused=isset($cssused[$link['href']]);
						$cssused[$link['href']]=1;
						}
					if(!$wasused){
						$bhtml->add_link($link);
						}
					}
				}
			if(isset($c->js)){
				foreach($c->js as $js){
					//Remove dublicates...
					$wasused=false;
					if(!empty($js['file'])){
						$wasused=isset($jsused[$js['file']]);
						$jsused[$js['file']]=1;
						}
					if(!$wasused){
						$bhtml->addJS($js['file'],$js['src'],$js['priority']);
						}
					}
				}
			if(isset($c->style)){
				foreach($c->style as $st){
					$bhtml->addCSSDeclaration($st);
					}
				}
			if(isset($c->frameworks)){
				foreach($c->frameworks as $framework){
					$bhtml->useFramework($framework);
					}
				}
			//Add breadcrumbs elements
			if(isset($c->breadcrumbs)){
				bimport('cms.breadcrumbs');
				$gbc=BGeneralBreadcrumbs::getInstance();
				foreach($c->breadcrumbs as $bc){
					$gbc->elements[]=$bc;
					}
				}
			}
		//Output the page
		header('Content-Type: text/html; charset=utf-8');
		if($status==403){
			header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
			}
		if($status==404){
			header($_SERVER['SERVER_PROTOCOL'].' 404 Page Not Found');
			}
		if($status==500){
			header($_SERVER['SERVER_PROTOCOL'].' 500 Server Error!');
			}
		$bhtml->headers_check();
		//Check for last-modified
		if((isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))&&(isset($bhtml->last_modified))){
			$mod_since=new DateTime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
			$interval=date_diff($bhtml->last_modified,$mod_since);
			if($interval->invert==0){
	        		header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
				return;//return nothing!
				}
			}
		if($this->templatename===NULL){
			$this->templatename='default';
			}
		//Detect device...
		$device=BBrowserUseragent::detectDevice();
		if($device==DEVICE_TYPE_MPHONE){
			$suffix='.m';
			}
		elseif($device==DEVICE_TYPE_TABLET){
			$suffix='.m';
			}else{
			$suffix='.d';
			}
		$fn=BTEMPLATESPATH.$this->templatename.DIRECTORY_SEPARATOR.'template'.$suffix.'.php';
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.$this->templatename.DIRECTORY_SEPARATOR.'template.d.php';
			}
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.'default'.DIRECTORY_SEPARATOR.'template'.$suffix.'.php';
			}
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.'default'.DIRECTORY_SEPARATOR.'template.d.php';
			}

		//Starting render
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Rendering template...');
			}
		ob_start();
		include $fn;
		$tpl_str=ob_get_clean();
		$tpl_str=str_replace('{{head}}','',$tpl_str);
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Filling empty positions...');
			}
		$pattern='/{{position.(?P<position>\w+)*}}/';
		preg_match_all($pattern, $tpl_str, $matches);
		foreach($matches['position'] as $pos){
			if(!isset($this->positions[$pos])){
				$this->positions[$pos]='';
				}
			}
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Put content into positions...');
			}
		foreach($this->positions as $p=>$val){
			$tpl_str=str_replace('{{position:'.$p.'}}',$val,$tpl_str);
			}
		//Output debug information, if necessary.
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Generation time: '.sprintf('%7.7f',self::page_time()));
			BLog::addToLog('[Router]: MySQL queries:'.BMySQL::getQueriesCount());
			$qc=BCache::getQueriesCount();
			BLog::addToLog('[Router]: Cache queries: get-'.$qc['get'].' set-'.$qc['set'].' mset-'.$qc['mset'].' mget-'.$qc['mget'].' gc-'.$qc['gc']);
			BLog::addToLog('[Router]: Outputing the template...');
			}
		echo($tpl_str);
		BLog::addToLog('[Router]: All done!');
		if(!empty($this->htmllogger)){
			$this->htmllogger->print_html();
			}
		}
1291053
def generate_html():
    
    html_file = open(html_filename, "w")
    html_file.write("<html><body>")
    html_file.write("<h1>Here are some graphs for you!</h1>")
    for image in [lines_filename, bars_filename, histogram_filename]:
        html_file.write("<div><h2>{0}</h2><img src='{0}' /></div>".format(image))
    html_file.write("</body></html>")
    html_file.close()
1120870
def write_html(self, text, image_map=None):
        ""
        h2p = HTML2FPDF(self, image_map)
        text = h2p.unescape(text) # To deal with HTML entities
        h2p.feed(text)