Build the toctree relative to the named document,
    with the given parameters, and then return the rendered
    HTML fragment.
347891
def get_rendered_toctree(builder, docname, prune=False, collapse=True):
    
    fulltoc = build_full_toctree(builder,
                                 docname,
                                 prune=prune,
                                 collapse=collapse,
                                 )
    rendered_toc = builder.render_partial(fulltoc)['fragment']
    return rendered_toc
1016130
def get_params_from_page(path, file_name, method_count):
    
    # open the rendered file.
    file_name = file_name.replace(".rst", "")
    file_path = "{0}/../_build/html/endpoints/{1}/index.html".format(
        path, file_name)
    soup = bs4.BeautifulSoup(open(file_path))

    # Pull out the relevant section
    section = soup.find_all('div', class_='section')[method_count]

    # get the tbody of the params table
    tbody = section.find('tbody')
    params = []
    if tbody is not None:
        for row in tbody.find_all('tr'):
            name, param_type, required, description = row.find_all('td')
            required = required.text == 'Yes'
            param = dict(
                name=name.text,
                type=param_type.text,
                required=required,
                description=description.text
            )
            params.append(param)
    params = sorted(params, key=lambda k: not k['required'])
    return params
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,
        ))
844004
def build_base_document(dom, return_fragment=True):
    
    body_element = dom.find(".//body")

    if body_element is None:
        fragment = fragment_fromstring('<div id="readabilityBody"/>')
        fragment.append(dom)
    else:
        body_element.tag = "div"
        body_element.set("id", "readabilityBody")
        fragment = body_element

    return document_from_fragment(fragment, return_fragment)
1226130
def render(self, builder, context, sphinx_app: Sphinx):
        

        context['sphinx_app'] = sphinx_app
        context['toctree'] = self

        html = builder.templates.render(self.template + '.html', context)
        return html
838837
function FinderBuilder(newDocument) {
// private
    var doc = newDocument;

    function buildIdFinder(e) {
        if (e.id) {
            var id = e.id;

            return (function(targetDoc) {
                return targetDoc.getElementById(id);
            });
        }

        return null;
    }

    function buildTagNameFinder(e) {
        var elements = doc.getElementsByTagName(e.tagName);

        for (var i = 0, n = elements.length; i < n; ++i) {
            if (elements[i] === e) {
                // both the descendant axis and getElementsByTagName() should
                // return elements in document order; hence the following index
                // operation is possible
                return (function(targetDoc) {
                    return targetDoc.getElementsByTagName(e.tagName)[i];
                });
            }
        }

        return null;
    }

// public
    this.setDocument = function(newDocument) {
        doc = newDocument;
        return this;
    };

    this.build = function(e) {
        return (
            buildIdFinder(e) ||
            buildTagNameFinder(e)
        );
    };
}
735182
def generate_html(self, jdoc, schema, schemas):
        ''''''

        params = {'functions': sorted([j for j in jdoc \
                   if (j.schema_name == schema.object_name and j.object_type \
                       in ['function', 'procedure', 'trigger'])], \
                                      key=lambda x: x.object_name),
                   'tables': sorted([j for j in jdoc \
                   if (j.schema_name == schema.object_name and j.object_type \
                       in ['table', 'view', 'materialized view', 'foreign table'])], \
                                    key=lambda x: x.object_name),
                   'schema_name': schema.object_name,
                   'schemas': sorted(schemas, key=lambda x: x.object_name),
                   'project': self.project_name,
                   'title': '{}: schema {}'.format(self.project_name,
                                                   schema.object_name)}
        template = self.lookup.get_template('schema.mako')
        html = template.render_unicode(**params)

        return html
645051
def render(self, *args, **kwargs):
        """"""
        if not self.childs and "href" in self.attrs:
            return self.clone()(self.attrs["href"]).render(*args, **kwargs)
        return super().render(*args, **kwargs)
888487
def _buildTemplates(self):
        

        # Ontology - MAIN PAGE
        contents = self._renderTemplate(
            "markdown/markdown_ontoinfo.md", extraContext=None)
        FILE_NAME = "index.md"
        main_url = self._save2File(contents, FILE_NAME, self.output_path)

        browser_output_path = self.output_path

        if self.ontospy_graph.all_classes:

            # BROWSER PAGES - CLASSES ======
            for entity in self.ontospy_graph.all_classes:
                extra_context = {
                    "main_entity": entity,
                    "main_entity_type": "class",
                    "ontograph": self.ontospy_graph
                }
                contents = self._renderTemplate(
                    "markdown/markdown_classinfo.md",
                    extraContext=extra_context)
                FILE_NAME = entity.slug + ".md"
                self._save2File(contents, FILE_NAME, browser_output_path)

        if self.ontospy_graph.all_properties:

            # BROWSER PAGES - PROPERTIES ======
            for entity in self.ontospy_graph.all_properties:
                extra_context = {
                    "main_entity": entity,
                    "main_entity_type": "property",
                    "ontograph": self.ontospy_graph
                }
                contents = self._renderTemplate(
                    "markdown/markdown_propinfo.md",
                    extraContext=extra_context)
                FILE_NAME = entity.slug + ".md"
                self._save2File(contents, FILE_NAME, browser_output_path)

        if self.ontospy_graph.all_skos_concepts:

            # BROWSER PAGES - CONCEPTS ======
            for entity in self.ontospy_graph.all_skos_concepts:
                extra_context = {
                    "main_entity": entity,
                    "main_entity_type": "concept",
                    "ontograph": self.ontospy_graph
                }
                contents = self._renderTemplate(
                    "markdown/markdown_conceptinfo.md",
                    extraContext=extra_context)
                FILE_NAME = entity.slug + ".ms"
                self._save2File(contents, FILE_NAME, browser_output_path)

        return main_url
1107111
def markdown(iterable, renderer=HTMLRenderer):
    
    with renderer() as renderer:
        return renderer.render(Document(iterable))
1066043
def _buildTemplates(self):
        
        # INDEX - MAIN PAGE
        contents = self._renderTemplate("html-multi/index.html", extraContext={"theme": self.theme, "index_page_flag" : True})
        FILE_NAME = "index.html"
        main_url = self._save2File(contents, FILE_NAME, self.output_path)

        # DASHBOARD
        contents = self._renderTemplate("html-multi/statistics.html", extraContext={"theme": self.theme})
        FILE_NAME = "statistics.html"
        self._save2File(contents, FILE_NAME, self.output_path)

        # VIZ LIST
        if False:
            contents = self._renderTemplate("html-multi/viz_list.html", extraContext={"theme": self.theme})
            FILE_NAME = "visualizations.html"
            self._save2File(contents, FILE_NAME, self.output_path)


        browser_output_path = self.output_path

        # ENTITIES A-Z
        extra_context = {"ontograph": self.ontospy_graph, "theme": self.theme}
        contents = self._renderTemplate("html-multi/browser/browser_entities_az.html", extraContext=extra_context)
        FILE_NAME = "entities-az.html"
        self._save2File(contents, FILE_NAME, browser_output_path)



        if self.ontospy_graph.all_classes:
            # CLASSES = ENTITIES TREE
            extra_context = {"ontograph": self.ontospy_graph, "theme": self.theme,
                            "treetype" : "classes",
                'treeTable' : formatHTML_EntityTreeTable(self.ontospy_graph.ontologyClassTree())}
            contents = self._renderTemplate("html-multi/browser/browser_entities_tree.html", extraContext=extra_context)
            FILE_NAME = "entities-tree-classes.html"
            self._save2File(contents, FILE_NAME, browser_output_path)
            # BROWSER PAGES - CLASSES ======
            for entity in self.ontospy_graph.all_classes:
                extra_context = {"main_entity": entity,
                                "main_entity_type": "class",
                                "theme": self.theme,
                                "ontograph": self.ontospy_graph
                                }
                extra_context.update(self.highlight_code(entity))
                contents = self._renderTemplate("html-multi/browser/browser_classinfo.html", extraContext=extra_context)
                FILE_NAME = entity.slug + ".html"
                self._save2File(contents, FILE_NAME, browser_output_path)


        if self.ontospy_graph.all_properties:

            # PROPERTIES = ENTITIES TREE
            extra_context = {"ontograph": self.ontospy_graph, "theme": self.theme,
                            "treetype" : "properties",
                'treeTable' : formatHTML_EntityTreeTable(self.ontospy_graph.ontologyPropTree())}
            contents = self._renderTemplate("html-multi/browser/browser_entities_tree.html", extraContext=extra_context)
            FILE_NAME = "entities-tree-properties.html"
            self._save2File(contents, FILE_NAME, browser_output_path)

            # BROWSER PAGES - PROPERTIES ======

            for entity in self.ontospy_graph.all_properties:
                extra_context = {"main_entity": entity,
                                "main_entity_type": "property",
                                "theme": self.theme,
                                "ontograph": self.ontospy_graph
                                }
                extra_context.update(self.highlight_code(entity))
                contents = self._renderTemplate("html-multi/browser/browser_propinfo.html", extraContext=extra_context)
                FILE_NAME = entity.slug + ".html"
                self._save2File(contents, FILE_NAME, browser_output_path)


        if self.ontospy_graph.all_skos_concepts:

            # CONCEPTS = ENTITIES TREE

            extra_context = {"ontograph": self.ontospy_graph, "theme": self.theme,
                            "treetype" : "concepts",
                'treeTable' : formatHTML_EntityTreeTable(self.ontospy_graph.ontologyConceptTree())}
            contents = self._renderTemplate("html-multi/browser/browser_entities_tree.html", extraContext=extra_context)
            FILE_NAME = "entities-tree-concepts.html"
            self._save2File(contents, FILE_NAME, browser_output_path)

            # BROWSER PAGES - CONCEPTS ======

            for entity in self.ontospy_graph.all_skos_concepts:
                extra_context = {"main_entity": entity,
                                "main_entity_type": "concept",
                                "theme": self.theme,
                                "ontograph": self.ontospy_graph
                                }
                extra_context.update(self.highlight_code(entity))
                contents = self._renderTemplate("html-multi/browser/browser_conceptinfo.html", extraContext=extra_context)
                FILE_NAME = entity.slug + ".html"
                self._save2File(contents, FILE_NAME, browser_output_path)


        if self.ontospy_graph.all_shapes:

            # SHAPES = ENTITIES TREE

            extra_context = {"ontograph": self.ontospy_graph, "theme": self.theme,
                            "treetype" : "shapes", 'treeTable' : formatHTML_EntityTreeTable(self.ontospy_graph.ontologyShapeTree()) }
            contents = self._renderTemplate("html-multi/browser/browser_entities_tree.html", extraContext=extra_context)
            FILE_NAME = "entities-tree-shapes.html"
            self._save2File(contents, FILE_NAME, browser_output_path)

            # BROWSER PAGES - SHAPES ======

            for entity in self.ontospy_graph.all_shapes:
                extra_context = {"main_entity": entity,
                                "main_entity_type": "shape",
                                "theme": self.theme,
                                "ontograph": self.ontospy_graph
                                }
                extra_context.update(self.highlight_code(entity))
                contents = self._renderTemplate("html-multi/browser/browser_shapeinfo.html", extraContext=extra_context)
                FILE_NAME = entity.slug + ".html"
                self._save2File(contents, FILE_NAME, browser_output_path)


        return main_url
128663
def doc():
    """"""
    kwdb = current_app.kwdb

    libraries = get_collections(kwdb, libtype="library")
    resource_files = get_collections(kwdb, libtype="resource")
    hierarchy = get_navpanel_data(kwdb)

    return flask.render_template("home.html",
                                 data={"libraries": libraries,
                                       "version": __version__,
                                       "libdoc": None,
                                       "hierarchy": hierarchy,
                                       "resource_files": resource_files
                                   })
1083911
function renderDoc(page, renderOpts) {
    if (generator.renderOpts !== defaultRenderOpts) return log(new Error('Recursive call to renderDoc'));
    var rOpts = generator.renderOpts = function() { return u.assign({}, defaultRenderOpts(page), renderOpts); };
    var out = renderTemplate(page, docTemplate(page), rOpts()); // synchronous
    generator.renderOpts = defaultRenderOpts;
    return out;
  }
806738
function listToFragment(list) {
  var fragment = document.createDocumentFragment();
  for (var i = 0, l = list.length; i < l; i++) {
    // Use toFragment since this may be an array of text, a jQuery object of `<template>`s, etc.
    fragment.appendChild(toFragment(list[i]));
    if (l === list.length + 1) {
      // adjust for NodeLists which are live, they shrink as we pull nodes out of the DOM
      i--;
      l--;
    }
  }
  return fragment;
}
765037
def to_html(self, codebase):
        
        return ('<a name = "%s" />\n<div class = "jsclass">\n' + 
                '<h3>%s</h3>\n%s\n<h4>Methods</h4>\n%s</div>') % (
                self.name, self.name, 
                htmlize_paragraphs(codebase.translate_links(self.doc, self)) +
                codebase.build_see_html(self.see, 'h4', self),
                '\n'.join(method.to_html(codebase) for method in self.methods
                        if codebase.include_private or not method.is_private))
227210
def render_html_tree(tree):
    

    # Restore any tag names that were changed in get_html_tree()
    for el in tree.iter():
        if '__tag_name' in el.attrib:
            actual_tag_name = el.attrib.pop('__tag_name')
            el.tag = actual_tag_name

    html = lxml.html.tostring(tree, encoding='utf8').decode('utf8')

    return strip_wrapping(html)
291887
function renderPageTree(root, renderOpts) {

    renderOpts = u.assign({ openClass:'open' }, renderOpts);

    if (renderOpts.groupBy) {
      var folderPages =
        u.map(u.groupBy(root._children, renderOpts.groupBy), function(children, name) {
          if (name === 'undefined') { name = renderOpts.defaultGroup || ''; }
          return { folderPage: true,
                   _href:      name ? '/' + u.slugify(name) + '/' : '',
                   _children:  children,
                   name:       name };
        });
      return recurse(folderPages);
    }
    else return recurse(root._children);

    function recurse(children, pid) {
      pid = pid || renderOpts.pageTreeID || 'page-tree';
      var out = '\n<ul>';

      u.each(children, function(page) {
        var ppid = (pid + '-' + page._href).replace(/\W+/g, '-').replace(/^-|-$/g,'');
        out += '\n<li' + (page._children ? ' id="' + ppid + '" class="folder"' : '') + '>'
            + (page.folderPage ?
              ((page.name || page._href) ? '<span class="folderPage">' + (page.name || u.unslugify(page._href)) + '</span>' : '') :
              renderLink(u.assign({}, renderOpts, { href:page._href, title:(page.title || page.name) })))
            + (page._children ? recurse(page._children, ppid) : '')
            + '</li>';
      });
      return out + '\n</ul>';
    }
  }