Generate guide page from elements

@param path Paths of element files that glob pattern
@param option Optional configure
@return rendered HTML string
487867
function gen(path) {
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  var config = assignConfig_1.default(option, path);
  return globElements_1.default(config).then(readElements_1.default(config)).then(optimize_1.default()).then(render_1.default(config));
}
1006147
public Map<String, String> parseXmlConfiguration(final String path) {
    File xmlFile;
    xmlFile = new File(path);
    if (!xmlFile.exists()) {
      System.err.format("File %s does not exist.", path);
      return null;
    }
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder;
    try {
      docBuilder = docBuilderFactory.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
      System.err.format("Failed to create instance of DocumentBuilder for file: %s. %s. %n",
          path, e.getMessage());
      return null;
    }
    Document doc;
    try {
      doc = docBuilder.parse(xmlFile);
    } catch (IOException e) {
      System.err.format("An I/O error occured reading file %s. %s.%n", path, e.getMessage());
      return null;
    } catch (SAXException e) {
      System.err.format("A parsing error occured parsing file %s. %s.%n", path, e.getMessage());
      return null;
    }
    // Optional, but recommended.
    // Refer to http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work
    doc.getDocumentElement().normalize();
    Map<String, String> ret = new HashMap<>();
    NodeList propNodeList = doc.getElementsByTagName("property");
    for (int i = 0; i < propNodeList.getLength(); i++) {
      Node propNode = propNodeList.item(i);
      if (propNode.getNodeType() == Node.ELEMENT_NODE) {
        Element element = (Element) propNode;
        ret.put(element.getElementsByTagName("name").item(0).getTextContent(),
            element.getElementsByTagName("value").item(0).getTextContent());
      }
    }
    return ret;
  }
851496
def html_path(builder, pagename=None):
    """"""

    return builder.get_relative_uri(
        pagename or builder.current_docname,
        os.path.join(
            builder.app.config.slide_html_relative_path,
            pagename or builder.current_docname,
        ))
1220431
public static String getHTMLPageViewFromRoot(String pathRefRootViews, String pageName){
		return getHTMLPageView(ROOT_DIR,PAGE_VIEW_PATH+pathRefRootViews, pageName);
	}
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;
        }
679135
function ( filepath, options ) {
    var content = grunt.file.read( filepath )
      , lang = options.lang
      , highlightedHtml = hljs.highlight( lang, content ).value
      , output = "<pre><code>" + highlightedHtml + "</code></pre>";

      return output;
  }
555934
@Override
	public Reader generateResource(String path, GeneratorContext context) {

		MessageBundleScriptCreator creator = new MessageBundleScriptCreator(context, control);
		addLinkedResources(path, context);
		return creator.createScript(context.getCharset());
	}
259121
public String exportToHtml(String filePath, String fileName) {
        return OptionUtil.exportToHtml(this, filePath, fileName);
    }
216320
public static String getHTMLPageView(String dir, String viewPath, String pageName){
		return getPageView(dir, viewPath, pageName, HTML);
	}
1192675
public void generateLatex(String path) {
        String output = "";
        output += "\\documentclass{article}\n";
        output += "\\usepackage{multirow}\n\\usepackage{booktabs}\n\\begin{document}\n\\begin{table}[htbp]\n\\caption{Add caption}";
        output += "\\begin{tabular}";
        output += "{";
        for (int i = 0; i < this.streams.size() + 4; i++) {
            output += "r";
        }
        output += "}\n\\toprule\nAlgorithm & \\multicolumn{2}{r}{Measure}";
        for (int i = 0; i < this.streams.size(); i++) {
            output += "& " + this.streams.get(i).getName();
        }
        output += "& AVG\\\\\n\\midrule\n";
        int algorithmSize = this.streams.get(0).algorithm.size();
        String name = "";
        for (int i = 0; i < algorithmSize; i++) {
            List<Algorithm> alg = this.streams.get(0).algorithm;
            output += "\\multirow{" + alg.get(i).measureStdSize + "}[" + 6 + "]{*}{" + alg.get(i).name + "}";
            List<Measure> measures[] = alg.get(i).getMeasuresPerData(streams);
            int cont = 0;
            double sum = 0.0;
            boolean isType = true;
            while (cont != this.streams.get(0).algorithm.get(i).measures.size()) {
                sum = 0;
                name = measures[0].get(cont).getName();
                if (measures[0].get(cont).isType()) {
                    output += "&\\multirow{" + 2 + "}[4]{*}{" + name + "} & mean";

                } else {
                    output += " & " + name;
                    output += "& Last value";
                }
                for (int j = 0; j < measures.length; j++) {
                    //sum =0;
                    if (measures[j].get(cont).isType()) {
                        output += " & " + Algorithm.format(measures[j].get(cont).getValue());

                        sum += measures[j].get(cont).getValue();
                        isType = true;
                    } else {
                        output += " & " + Algorithm.format1(measures[j].get(cont).getValue());
                        isType = false;
                    }

                }
                if (isType) {
                    double size = (double) this.streams.size();
                    output += "& " + Algorithm.format(sum / size);
                    output += "\\\\\n";
                    output += " & & std";
                    for (int j = 0; j < measures.length; j++) {
                        output += " & " + Algorithm.format(measures[j].get(cont).getStd());
                    }
                    output += " & -";
                } else {
                    output += " & -";

                }
                output += "\\\\\n";
                cont++;
            }
        }
        output += "\\bottomrule\n\\end{tabular}%\n\\label{tab:addlabel}%\n\\end{table}%\n\\end{document}";
//        PrintStream out = null;
//        try {
//            out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path + "summary.tex")));
//        } catch (FileNotFoundException ex) {
//            Logger.getLogger(Summary.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        System.setOut(out);
//        System.out.println(output);
//        out.close();
        try {
            BufferedWriter out = new BufferedWriter(new FileWriter(path + "summary.tex"));
            out.write(output);  //Replace with the string 
            //you are trying to write  
            out.close();
        } catch (IOException e) {
            System.out.println(" Error saving summary.tex");

        }
    }
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>';
  }
1345854
def as_html(self, path=""):
        
        if path not in self.top_level_links:
            raise StateError("Unknown path")

        header = """
        <html>
            <head>
                <title>VPC-router state</title>
            </head>
            <body>
                <h3>VPC-router state</h3>
                <hr>
                <font face="courier">
        """

        footer = """
                </font>
            </body>
        </html>
        """

        rep = self.get_state_repr(path)

        def make_links(rep):
            # Recursively create clickable links for _href elements
            for e, v in rep.items():
                if e == "_href":
                    v = '<a href=%s>%s</a>' % (v, v)
                    rep[e] = v
                else:
                    if type(v) == dict:
                        make_links(v)

        make_links(rep)

        rep_str_lines = json.dumps(rep, indent=4).split("\n")
        buf = []
        for l in rep_str_lines:
            # Replace leading spaces with '&nbsp;'
            num_spaces = len(l) - len(l.lstrip())
            l = "&nbsp;" * num_spaces + l[num_spaces:]
            buf.append(l)

        return "%s%s%s" % (header, "<br>\n".join(buf), footer)
292777
def generate_xhtml(path, dirs, files):
    """"""
    # Prepare the path to display.
    if path != '/':
        dirs.insert(0, '..')
    if not path.endswith('/'):
        path += '/'

    def itemize(item):
        return '<a href="%s">%s</a>' % (item, path+item)
    dirs = [d + '/' for d in dirs]
    return """
    <html>
     <body>
      <h1>%s</h1>
       <pre>%s\n%s</pre>
     </body>
    </html>
    """ % (path, '\n'.join(itemize(dir) for dir in dirs), '\n'.join(itemize(file) for file in files))
1265221
function renderTmpl (path, vars, callback) {
    fs.readFile(path, 'utf8', function (err, file) {
        if (err) {
            return callback(err);
        }
        var out = file.replace(/\{\{([a-z]+)\}\}/ig, function (all, name) {
            return vars[name];
        });
        callback(null, out);
    });
}
921496
function includeSource(path, options) {
  var opts = utils.shallowCopy({}, options);
  var includePath;
  var template;
  includePath = getIncludePath(path, opts);
  template = fileLoader(includePath).toString().replace(_BOM, '');
  opts.filename = includePath;
  var templ = new Template(template, opts);
  templ.generateSource();
  return {
    source: templ.source,
    filename: includePath,
    template: template
  };
}
796883
function get(path) {
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  var config = assignConfig_1.default(option, path);
  return globElements_1.default(config).then(readElements_1.default(config)).then(optimize_1.default());
}
469350
@Override
	protected Reader generateResource(String path, GeneratorContext context) {

		Reader reader = helper.createResource(context);

		String filePath = helper.getFilePath(path);
		if (filePath != null) {
			long lastModified = rsHandler.getLastModified(filePath);
			FilePathMapping fMapping = new FilePathMapping(filePath, lastModified);
			addLinkedResources(path, context, Arrays.asList(fMapping));
		}

		return reader;
	}