Render lines of reStructuredText for items yielded by
        :meth:`~doctor.docs.base.BaseHarness.iter_annotations`.
960401
def _render_rst(self):  # pragma: no cover
        
        # Create a mapping of headers to annotations.  We want to group
        # all annotations by a header, but they could be in multiple handlers
        # so we create a map of them here with the heading as the key and
        # the list of associated annotations as a list.  This is so we can
        # sort them alphabetically to make reading the api docs easier.
        heading_to_annotations_map = defaultdict(list)
        for heading, route, handler, annotations in (
                self.harness.iter_annotations()):
            # Set the route and handler as attributes so we can retrieve them
            # when we loop through them all below.
            for annotation in annotations:
                annotation.route = route
                annotation.handler = handler
                heading_to_annotations_map[heading].append(annotation)

        headings = list(heading_to_annotations_map.keys())
        headings.sort()
        previous_heading = None
        for heading in headings:
            annotations = heading_to_annotations_map.get(heading)
            # Sort all the annotations by title.
            annotations.sort(key=lambda a: a.title)
            # Only emit a new heading if the resource has changed.  This
            # esnures that documented endpoints for the same resource all
            # end up under a single heading.
            if previous_heading != heading:
                previous_heading = heading
                yield HEADING_TOKEN + heading
            for annotation in annotations:
                route = annotation.route
                normalized_route = normalize_route(route)
                handler = annotation.handler
                # Adds a title for the endpoint.
                if annotation.title is not None:
                    yield annotation.title
                    yield '#' * len(annotation.title)
                docstring = get_description_lines(getattr(annotation.logic,
                                                          '__doc__', None))

                # Documents the logic function associated with the annotation.
                docstring.append(':Logic Func: :func:`~{}.{}`'.format(
                    annotation.logic.__module__, annotation.logic.__name__))

                field = '<json'
                if annotation.http_method in ('DELETE', 'GET'):
                    field = 'query'
                docstring.extend(get_json_lines(
                    annotation, field=field, route=normalized_route,
                    request=True)
                )

                # Document any request headers.
                defined_headers = list(self.harness._get_headers(
                    str(route), annotation).keys())
                defined_headers.sort()
                for header in defined_headers:
                    definition = self.harness.header_definitions.get(
                        header, '').strip()
                    docstring.append(':reqheader {}: {}'.format(
                        header, definition))

                # Document response if a type was defined.
                if annotation.return_annotation != Parameter.empty:
                    docstring.extend(get_json_lines(
                        annotation, field='>json', route=normalized_route))

                docstring.extend(self._make_example(route, handler, annotation))
                for line in http_directive(annotation.http_method,
                                           normalized_route, docstring):
                    yield line

        # Document resource objects.
        for line in get_resource_object_doc_lines():
            yield line
1018132
def render(self, context):
        
        try:
            args, ctx = self.get_resolved_arguments(context)
            target = args[0]
            if not target:
                return ''
            ctx['content'] = target
        except VariableDoesNotExist:
            return ''

        emitter = context.get('emitter')
        t_name = emitter.get_template_path(target)
        t = get_template(t_name)
        context.dicts.append(ctx)
        response = t.nodelist.render(context)
        context.pop()
        return response
669054
def print_rendered_results(results_dict):
    
    class _HubComponentEncoder(json.JSONEncoder):
        def default(self, o):
            if isinstance(o, base.HubComponent):
                return repr(o)
            return json.JSONEncoder.default(self, o)
    formatted = json.dumps(results_dict, indent=4, cls=_HubComponentEncoder)
    # the returned string contains lines with trailing spaces, which causes
    # doctests to fail.  So fix that here.
    for s in formatted.splitlines():
        print(s.rstrip())
457845
def clean_restructuredtext(form_instance, content):
    
    if content:
        errors = SourceReporter(content)
        if errors:
            raise ValidationError(map(map_parsing_errors, errors))
    return content
306410
def _iter_texts(self, tree):
        """"""
        skip = (
            not isinstance(tree, lxml.html.HtmlElement)  # comments, etc.
            or tree.tag in self.skipped_tags
        )
        if not skip:
            if tree.text:
                yield Text(tree.text, tree, 'text')
            for child in tree:
                for text in self._iter_texts(child):
                    yield text
        if tree.tail:
            yield Text(tree.tail, tree, 'tail')
296308
def annotate(results, settings):
    ''''''
    annotations = (generate_annotation(result, setting)
                   for result, setting in zip(results, settings))
    return '\n'.join(annot for annot in annotations if annot)
913977
private void renderClass(ClassDoc doc, DocletRenderer renderer) {
        //handle the various parts of the Class doc
        renderer.renderDoc(doc);
        for (MemberDoc member : doc.fields()) {
            renderer.renderDoc(member);
        }
        for (MemberDoc member : doc.constructors()) {
            renderer.renderDoc(member);
        }
        for (MemberDoc member : doc.methods()) {
            renderer.renderDoc(member);
        }
        for (MemberDoc member : doc.enumConstants()) {
            renderer.renderDoc(member);
        }
        if (doc instanceof AnnotationTypeDoc) {
            for (MemberDoc member : ((AnnotationTypeDoc)doc).elements()) {
                renderer.renderDoc(member);
            }
        }
    }
795962
def render_text(text, preformatted=False):
    
    builder = HtmlBuilder()
    builder._render_text(text, preformatted=preformatted)
    return builder._to_html()
426418
def render_text(text, preformatted=False):
  
  return IPython.core.display.HTML(_html.HtmlBuilder.render_text(text, preformatted))
88531
def _render(self, content, **settings):
        
        lines = self._render_content(content, **settings)

        result = []
        s = self._es_margin(settings)
        for l in lines:
            result.append(self.fmt_margin(l, **s))

        return result
36961
def render_flow(self, data):
        

        self.render_tree(data)

        # then reconstruct a new ODT document with the generated content
        for status in self.__save_output():
            yield status
91563
def render(options)
      options = options_for_render(options)
      links = links_for_render(options)

      LinkCollection.new(context, links, options)
    end
1298035
def iter_lines(file_like: Iterable[str]) -> Generator[str, None, None]:
    
    for line in file_like:
        line = line.rstrip('\r\n')
        if line:
            yield line
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
882376
def render_markdown(self, text, context=github.GithubObject.NotSet):
        
        assert isinstance(text, (str, unicode)), text
        assert context is github.GithubObject.NotSet or isinstance(context, github.Repository.Repository), context
        post_parameters = {
            "text": text
        }
        if context is not github.GithubObject.NotSet:
            post_parameters["mode"] = "gfm"
            post_parameters["context"] = context._identity
        status, headers, data = self.__requester.requestJson(
            "POST",
            "/markdown",
            input=post_parameters
        )
        return data
324805
def display(self):
        """"""
        def render(line):
            is_wide_char = False
            for x in range(self.columns):
                if is_wide_char:  # Skip stub
                    is_wide_char = False
                    continue
                char = line[x].data
                assert sum(map(wcwidth, char[1:])) == 0
                is_wide_char = wcwidth(char[0]) == 2
                yield char

        return ["".join(render(self.buffer[y])) for y in range(self.lines)]
348533
def render(self, namespace):
        '''
        '''
        return self._text.format_map(namespace.dictionary) \
            if self._need_format else self._text