Create a HTML page for this BAM file.
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)
385955
def _generate_html(data, out):
    '''
    
    '''
    print('<html>', file=out)
    print('<body>', file=out)
    _generate_html_table(data, out, 0)
    print('</body>', file=out)
    print('</html>', file=out)
1110606
def _page_html(page):
    
    out = []
    out.append(_html_title(page))
    out.append(_html_image(page))
    out.append(page.data.get('extract'))
    return "\n".join([x for x in out if x])
796893
private void createOutputHeader() {
        // setup some constants
        String endBracket3 = "   }\n";
        String endBracket4 = "    }\n";
        String boldFont = "    font-weight:bold;\n";
        String swapRow = "   </tr><tr>\n";

        // Open file
        SimpleDateFormat sdf = new SimpleDateFormat("EEEE, MMMM d, yyyy");
        SimpleDateFormat stf = new SimpleDateFormat("HH:mm:ss");
        String datePart = sdf.format(new Date());
        String sTime = stf.format(startTime);
        try (FileWriter fw = new FileWriter(file); BufferedWriter out = new BufferedWriter(fw)) {
            out.write("<html>\n");
            out.write(" <head>\n");
            out.write("  <title>" + test + "</title>\n");
            out.write("  <style type='text/css'>\n");
            out.write("    @page {\n");
            out.write("     size: landscape;\n");
            out.write(endBracket3);
            out.write("   table {\n");
            out.write("    margin-left:auto;margin-right:auto;\n");
            out.write("    width:90%;\n");
            out.write("    border-collapse:collapse;\n");
            out.write(endBracket3);
            out.write("   table, td, th {\n");
            out.write("    border:1px solid black;\n");
            out.write("    padding:0px 10px;\n");
            out.write(endBracket3);
            out.write("   th {\n");
            out.write("    text-align:right;\n");
            out.write(endBracket3);
            out.write("   td {\n");
            out.write("    word-wrap: break-word;\n");
            out.write(endBracket3);
            out.write("   .check {\n");
            out.write("    color:orange;\n");
            out.write(boldFont);
            out.write(endBracket3);
            out.write("   .fail {\n");
            out.write("    color:red;\n");
            out.write(boldFont);
            out.write(endBracket3);
            out.write("   .pass {\n");
            out.write("    color:green;\n");
            out.write(boldFont);
            out.write(endBracket3);
            out.write("   .indent {\n");
            out.write("    position:relative;\n");
            out.write("    left:10px;\n");
            out.write(endBracket3);
            out.write("  </style>\n");
            out.write("  <script type='text/javascript'>\n");
            out.write("   function toggle( imageName ) {\n");
            out.write("    var element = document.getElementById( imageName );\n");
            out.write("    element.src = location.href.match(/^.*\\//) + imageName;\n");
            out.write("    element.style.display = (element.style.display != 'none' ? 'none' : '' );\n");
            out.write(endBracket3);
            out.write("   function display( imageName ) {\n");
            out.write("    window.open( location.href.match(/^.*\\//) + imageName )\n");
            out.write(endBracket3);
            out.write("   function toggleVis(col_no, do_show) {\n");
            out.write("    var stl;\n");
            out.write("    if (do_show) stl = ''\n");
            out.write("    else         stl = 'none';\n");
            out.write("    var tbl  = document.getElementById('all_results');\n");
            out.write("    var rows = tbl.getElementsByTagName('tr');\n");
            out.write("    var cels = rows[0].getElementsByTagName('th')\n");
            out.write("    cels[col_no].style.display=stl;\n");
            out.write("    for (var row=1; row<rows.length;row++) {\n");
            out.write("     var cels = rows[row].getElementsByTagName('td')\n");
            out.write("     cels[col_no].style.display=stl;\n");
            out.write(endBracket4);
            out.write(endBracket3);
            out.write("   function getElementsByClassName(oElm, strTagName, strClassName){\n");
            out.write(
                    "    var arrElements = (strTagName == '*' && document.all)? document.all : oElm" +
                            ".getElementsByTagName(strTagName);\n");
            out.write("    var arrReturnElements = new Array();\n");
            out.write("    strClassName = strClassName.replace(/\\-/g, '\\\\-');\n");
            out.write("    var oRegExp = new RegExp('(^|\\s)' + strClassName + '(\\s|$)');\n");
            out.write("    var oElement;\n");
            out.write("    for(var i=0; i<arrElements.length; i++){\n");
            out.write("     oElement = arrElements[i];\n");
            out.write("     if(oRegExp.test(oElement.className)){\n");
            out.write("      arrReturnElements.push(oElement);\n");
            out.write("     }\n");
            out.write(endBracket4);
            out.write("    return (arrReturnElements)\n");
            out.write(endBracket3);
            out.write("   function fixImages( imageName ) {\n");
            out.write("    top.document.title = document.title;\n");
            out.write("    allImgIcons = getElementsByClassName( document, 'img', 'imgIcon' );\n");
            out.write("    for( var element in allImgIcons ) {\n");
            out.write("     element.src = location.href.match(/^.*\\//) + element.src;\n");
            out.write(endBracket4);
            out.write(endBracket3);
            out.write("  </script>\n");
            out.write(" </head>\n");
            out.write(" <body onLoad='fixImages()'>\n");
            out.write("  <table>\n");
            out.write(START_ROW);
            out.write("    <th bgcolor='lightblue'><font size='5'>Test</font></th>\n");
            out.write("    <td bgcolor='lightblue' colspan='3'><font size='5'>" + test + " </font></td>\n");
            out.write(swapRow);
            out.write("    <th>Tester</th>\n");
            out.write("    <td>Automated</td>\n");
            out.write("    <th>Version</th>\n");
            out.write(START_CELL + this.version + END_CELL);
            out.write(swapRow);
            out.write("    <th>Author</th>\n");
            out.write(START_CELL + this.author + END_CELL);
            out.write("    <th rowspan='2'>Test Run Time</th>\n");
            out.write("    <td rowspan='2'>\n");
            out.write("     Start:\t" + sTime + " <br/>\n");
            out.write("     End:\tTIMEFINISHED <br/>\n");
            out.write("     Run Time:\tRUNTIME \n");
            out.write("    </td>\n ");
            out.write(swapRow);
            out.write("    <th>Date Tested</th>\n");
            out.write(START_CELL + datePart + END_CELL);
            out.write(swapRow);
            out.write("    <th>URL Under Test</th>\n");
            out.write(START_CELL + "<a href='" + url + "'>" + url + "</a>" + END_CELL);
            out.write("    <th>Browser</th>\n");
            out.write(START_CELL + capabilities.getBrowser().getDetails() + END_CELL);
            out.write(swapRow);
            out.write("    <th>Testing Group</th>\n");
            out.write(START_CELL + group + END_CELL);
            out.write("    <th>Testing Suite</th>\n");
            out.write(START_CELL + suite + END_CELL);
            out.write(swapRow);
            out.write("    <th>Test Objectives</th>\n");
            out.write("    <td colspan='3'>" + objectives + END_CELL);
            out.write(swapRow);
            out.write("    <th>Overall Results</th>\n");
            out.write("    <td colspan='3' style='padding: 0px;'>\n");
            out.write("     <table style='width: 100%;'><tr>\n");
            out.write("      <td font-size='big' rowspan='2'>PASSORFAIL</td>\n");
            out.write("      <td><b>Steps Performed</b></td><td><b>Steps Passed</b></td>" +
                    "<td><b>Steps Failed</b></td>\n");
            out.write("     </tr><tr>\n");
            out.write("      <td>STEPSPERFORMED</td><td>STEPSPASSED</td><td>STEPSFAILED</td>\n");
            out.write("     </tr></table>\n");
            out.write("    </td>\n");
            out.write(swapRow);
            out.write("    <th>View Results</th>\n");
            out.write("    <td colspan='3'>\n");
            out.write("     <input type='checkbox' name='step' onclick='toggleVis(0,this.checked)' " +
                    "checked='checked'>Step</input>\n");
            out.write("     <input type='checkbox' name='action' onclick='toggleVis(1,this.checked)' " +
                    "checked='checked'>Action</input>\n");
            out.write(
                    "     <input type='checkbox' name='expected' onclick='toggleVis(2,this.checked)' " +
                            "checked='checked'>Expected Results</input>\n");
            out.write(
                    "     <input type='checkbox' name='actual' onclick='toggleVis(3,this.checked)' " +
                            "checked='checked'>Actual Results</input>\n");
            out.write(
                    "     <input type='checkbox' name='times' onclick='toggleVis(4,this.checked)' " +
                            "checked='checked'>Step Times</input>\n");
            out.write("     <input type='checkbox' name='result' onclick='toggleVis(5,this.checked)' " +
                    "checked='checked'>Results</input>\n");
            out.write("    </td>\n");
            out.write(END_ROW);
            out.write("  </table>\n");
            out.write("  <table id='all_results'>\n");
            out.write(START_ROW);
            out.write("    <th align='center'>Step</th><th style='text-align:center'>Action</th>" +
                    "<th style='text-align:center'>Expected Result</th>" +
                    "<th style='text-align:center'>Actual Result</th>" +
                    "<th style='text-align:center'>Step Times</th><th style='text-align:center'>Pass/Fail</th>\n");
            out.write(END_ROW);
        } catch (IOException e) {
            log.error(e);
        }
    }
1032942
def htmlhelp():
    """"""
    build('htmlhelp', 'Now you can run HTML Help Workshop with the .hhp '
                      'project file in {}.')
    print('Running HTML Help Workshop...')
    builddir = os.path.join(BUILDDIR, 'htmlhelp')
    rc = subprocess.call(['hhc', os.path.join(builddir, 'rinohtype.hhp')])
    if rc != 1:
        print('Error running HTML Help Workshop. Aborting.')
        sys.exit(1)
    print('HTML Help Workshop finished; the CHM file is in {}.'
          .format(builddir))
507973
function generatePage(output, page) {
    var book = output.getBook();
    var engine = createTemplateEngine(output);

    return timing.measure(
        'page.generate',
        Promise(page)
        .then(function(resultPage) {
            var file = resultPage.getFile();
            var filePath = file.getPath();
            var parser = file.getParser();
            var context = JSONUtils.encodeOutputWithPage(output, resultPage);

            if (!parser) {
                return Promise.reject(error.FileNotParsableError({
                    filename: filePath
                }));
            }

            // Call hook "page:before"
            return callPageHook('page:before', output, resultPage)

            // Escape code blocks with raw tags
            .then(function(currentPage) {
                return parser.preparePage(currentPage.getContent());
            })

            // Render templating syntax
            .then(function(content) {
                var absoluteFilePath = path.join(book.getContentRoot(), filePath);
                return Templating.render(engine, absoluteFilePath, content, context);
            })

            .then(function(output) {
                var content = output.getContent();

                return parser.parsePage(content)
                .then(function(result) {
                    return output.setContent(result.content);
                });
            })

            // Post processing for templating syntax
            .then(function(output) {
                return Templating.postRender(engine, output);
            })

            // Return new page
            .then(function(content) {
                return resultPage.set('content', content);
            })

            // Call final hook
            .then(function(currentPage) {
                return callPageHook('page', output, currentPage);
            });
        })
    );
}
1189959
def render_requests_data_to_html(self, data, file_name, context={}):
        """"""
        file_path = os.path.join(self.html_dir, file_name)
        logger.info('Rendering HTML file %s...' % file_path)
        data = format_data(data)
        data.update(context)
        data.update(domain=self.domain)
        with open(file_path, 'w') as fp:
            fp.write(render_template('realtime.html', data))
1144152
def save_report_to_html(self):
        """"""
        html = self.page().mainFrame().toHtml()
        if self.report_path is not None:
            html_to_file(html, self.report_path)
        else:
            msg = self.tr('report_path is not set')
            raise InvalidParameterError(msg)
727368
def main():
    """"""
    data = Common.open_file(F_INFO)
    config = Common.open_file(F_CONFIG)
    file_full_path = ""

    env = load_jinja2_env(config['p_template'])

    for index, page in data.iteritems():
        logging.info('Creating ' + index + ' page:')

        template = env.get_template(page['f_template'] + \
            config['f_template_ext'])

        for lang, content in page['content'].items():
            if lang == "NaL":
                if page['f_directory'] != '':
                    Common.make_dir(config['p_build'] + page['f_directory'])

                file_full_path = config['p_build'] + page['f_directory'] + \
                    page['f_name'] +page['f_endtype']
            else:
                if page['f_directory'] != '':
                    Common.make_dir(config['p_build'] + lang + '/' + \
                        page['f_directory'])

                file_full_path = config['p_build'] + lang + '/' + \
                    page['f_directory'] + page['f_name'] +page['f_endtype']

            with open(file_full_path, 'w') as target_file:
                target_file.write(template.render(content))

        logging.info('Page ' + index + ' created.')
70329
def printFromHTML(self, sr_html):
        
        # HTML written to debug file
        debug_mode = App.config.getConfiguration().debug_mode
        if debug_mode:
            tmp_fn = tempfile.mktemp(suffix=".html")
            open(tmp_fn, "wb").write(sr_html)

        # Creates the pdf
        # we must supply the file ourself so that createPdf leaves it alone.
        pdf_fn = tempfile.mktemp(suffix=".pdf")
        pdf_report = createPdf(htmlreport=sr_html, outfile=pdf_fn)
        return pdf_report
663445
def create_html(self, filename=None):
        """"""
        
        if isinstance(self.style, str):
            style = "'{}'".format(self.style)
        else:
            style = self.style
        
        options = dict(
            gl_js_version=GL_JS_VERSION,
            accessToken=self.access_token,
            div_id=self.div_id,
            style=style,
            center=list(self.center),
            zoom=self.zoom,
            geojson_data=json.dumps(self.data, ensure_ascii=False),
            belowLayer=self.below_layer,
            opacity=self.opacity,
            minzoom=self.min_zoom,
            maxzoom=self.max_zoom,
            pitch=self.pitch, 
            bearing=self.bearing,
            boxZoomOn=json.dumps(self.box_zoom_on),
            doubleClickZoomOn=json.dumps(self.double_click_zoom_on),
            scrollZoomOn=json.dumps(self.scroll_zoom_on),
            touchZoomOn=json.dumps(self.touch_zoom_on),
            popupOpensOnHover=self.popup_open_action=='hover',
            includeSnapshotLinks=self.add_snapshot_links,
            preserveDrawingBuffer=json.dumps(self.add_snapshot_links),
            showScale=self.scale,
            scaleUnits=self.scale_unit_system,
            scaleBorderColor=self.scale_border_color,
            scalePosition=self.scale_position,
            scaleFillColor=self.scale_background_color,
            scaleTextColor=self.scale_text_color,
        )

        if self.legend:

            if all([self.legend, self.legend_gradient, self.legend_function == 'radius']):
                raise LegendError(' '.join(['Gradient legend format not compatible with a variable radius legend.',
                                            'Please either change `legend_gradient` to False or `legend_function` to "color".']))

            options.update(
                showLegend=self.legend,
                legendLayout=self.legend_layout,
                legendFunction=self.legend_function,
                legendStyle=self.legend_style, # reserve for custom CSS
                legendGradient=json.dumps(self.legend_gradient),
                legendFill=self.legend_fill,
                legendHeaderFill=self.legend_header_fill,
                legendTextColor=self.legend_text_color,
                legendNumericPrecision=json.dumps(self.legend_text_numeric_precision),
                legendTitleHaloColor=self.legend_title_halo_color,
                legendKeyShape=self.legend_key_shape,
                legendKeyBordersOn=json.dumps(self.legend_key_borders_on)
            )

        if self.vector_source:
            options.update(
                vectorUrl=self.vector_url,
                vectorLayer=self.vector_layer_name,
                vectorJoinDataProperty=self.vector_join_property,
                joinData=json.dumps(False),
                dataJoinProperty=self.data_join_property,
                enableDataJoin=not self.disable_data_join
            )
            data = geojson_to_dict_list(self.data)
            if bool(data):
                options.update(joinData=json.dumps(data, ensure_ascii=False))

        if self.label_property is None:
            options.update(labelProperty=None)
        else:
            options.update(labelProperty='{' + self.label_property + '}')
        
        options.update(
            labelColor=self.label_color,
            labelSize=self.label_size,
            labelHaloColor=self.label_halo_color,
            labelHaloWidth=self.label_halo_width
        )

        self.add_unique_template_variables(options)

        if filename:
            html = templates.format(self.template, **options)
            with codecs.open(filename, "w", "utf-8-sig") as f:
                f.write(html)
            return None
        else:
            return templates.format(self.template, **options)
249781
def build():
    
    test_files()
    with open('content.rst') as f:
        content = publish_parts(f.read(), writer_name='html')
        title = content['title']
        body =  content['html_body'].replace('\n',' ')

    with open('template.jinja', 'r') as f:
        loader = FileSystemLoader(getcwd())
        env= Environment(loader=loader)
        template = env.get_template('template.jinja')
        page =  template.render(title=title,
                                content=body)

    with open('index.html', 'w') as f:
        f.write(page)
1159898
def render(file):
    """"""
    fp = file.open()
    content = fp.read()
    fp.close()

    notebook = nbformat.reads(content.decode('utf-8'), as_version=4)

    html_exporter = HTMLExporter()
    html_exporter.template_file = 'basic'
    (body, resources) = html_exporter.from_notebook_node(notebook)
    return body, resources
723641
protected void html() {
        int p = bp;
        nextChar();
        if (isIdentifierStart(ch)) {
            String name = readIdentifier();
            checkHtmlTag(name);
            htmlAttrs();
            if (ch == '/') {
                nextChar();
            }
            if (ch == '>') {
                nextChar();
                return;
            }
        } else if (ch == '/') {
            nextChar();
            if (isIdentifierStart(ch)) {
                readIdentifier();
                skipWhitespace();
                if (ch == '>') {
                    nextChar();
                    return;
                }
            }
        } else if (ch == '!') {
            nextChar();
            if (ch == '-') {
                nextChar();
                if (ch == '-') {
                    nextChar();
                    while (bp < buflen) {
                        int dash = 0;
                        while (ch == '-') {
                            dash++;
                            nextChar();
                        }
                        // Strictly speaking, a comment should not contain "--"
                        // so dash > 2 is an error, dash == 2 implies ch == '>'
                        // See http://www.w3.org/TR/html-markup/syntax.html#syntax-comments
                        // for more details.
                        if (dash >= 2 && ch == '>') {
                            nextChar();
                            return;
                        }

                        nextChar();
                    }
                }
            }
        }

        bp = p + 1;
        ch = buf[bp];
    }
106574
public function CreatePage() 
	{
		parent::CreatePage();
		
		$this->myWords = $this->WordCollection();
		$this->setTitlePage($this->myWords->Value("TITLE"));
		$this->setHelp($this->myWords->Value("DESCRIPTION"));

		$block = new XmlBlockCollection($this->myWords->Value("TITLE"), BlockPosition::Center);
		
		$this->addMenuItem($this->_moduleUrl, $this->myWords->Value("MENULISTPOLLS"), "");
		$this->addMenuItem("module:Xmlnuke.Admin.ManageDBConn", $this->myWords->Value("MENUMANAGEDBCONN"), "");
			
		// Create a NEW config file and SETUP Database
		$configfile = new AnydatasetFilenameProcessor("_poll");
		if (!FileUtil::Exists($configfile))
		{
			$this->CreateSetup($block);
		}
		else 
		{
			$anyconfig = new AnyDataset($configfile->FullQualifiedNameAndPath());
			$it = $anyconfig->getIterator();
			if ($it->hasNext())
			{
				$sr = $it->moveNext();
				$this->_isdb = $sr->getField("dbname") != "-anydata-";
				$this->_connection = $sr->getField("dbname");
				$this->_tblanswer = $sr->getField("tbl_answer");
				$this->_tblpoll = $sr->getField("tbl_poll");
				$this->_tbllastip = $sr->getField("tbl_lastip");
			}
			else 
			{
				$this->CreateSetup($block);
				$this->defaultXmlnukeDocument->addXmlnukeObject($block);
				return $this->defaultXmlnukeDocument->generatePage();
			}
			
			if ($this->_context->get("op") == "")
			{
				$this->ListPoll($block);
			}
			elseif ($this->_context->get("op") == "answer")
			{
				$polldata = explode("|", $this->_context->get("valueid"));
				$this->ListAnswers($block, $polldata[0], $polldata[1]);
			}
			elseif ($this->_context->get("op") == "answernav")
			{
				$this->ListAnswers($block, $this->_context->get("curpoll"), $this->_context->get("curlang"));
			}
		}

		$this->defaultXmlnukeDocument->addXmlnukeObject($block);
		return $this->defaultXmlnukeDocument->generatePage();
	}
99080
def generate_pages(self):
		
		for page in self.pages:
			self.generate_page(page.slug, template='page.html.jinja', page=page)
154633
def create_page_from_template(template_file, output_path):
    
    mkdir_p(os.path.dirname(output_path))
    shutil.copy(os.path.join(livvkit.resource_dir, template_file), output_path)