Returns rendered HTML for source text
770509
def transform(request, syntax_processor_name=None, var_name="text"):
    
    if request.method != 'POST':
        return HttpResponseNotAllowed("Only POST allowed")

    source = request.POST.get(var_name)
    if not source:
        return HttpResponse('')

    processor = TextProcessor.objects.get(name=syntax_processor_name or getattr(settings, "DEFAULT_MARKUP", "markdown"))
    output = processor.convert(source)

    try:
        t = template.Template(output, name='markup_preview')
        output = t.render(template.Context({'MEDIA_URL' : settings.MEDIA_URL}))
    except template.TemplateSyntaxError, e:
        log.warning('Error in preview rendering: %s' % e)
        output = '<h3 style="color:red">%s</h3><p>%s</p>' % (ugettext('You have an errors in source text!'), e)

    return HttpResponse(output)
1013916
def render(self, text, auth=None):
        
        if markdown is None:
            import markdown
        if UrlizeExtension is None:
            from .mdx_urlize import UrlizeExtension
        return markdown.markdown(text, extensions=[
            'fenced_code',
            'codehilite(css_class=highlight)',
            'toc',
            'tables',
            'sane_lists',
            UrlizeExtension(),
        ])
1232817
function renderContent(source, generator, context, options, cb) {
    ejs.renderFile(generator.templatePath(source), context, options, (err, res) => {
        if (!err) {
            cb(res);
        } else {
            generator.error(`Copying template ${source} failed. [${err}]`);
        }
    });
}
400744
def render(self, context):
        """"""
        import markdown
        content = self.get_content_from_context(context)
        return markdown.markdown(content)
85519
function render(item, escape) {
        return [
          '<div class="completed">',
            '<strong class="name">'+ escape(item.name) +'</strong>',
           'string' === typeof item.desc ? '<span class="description">'+ escape(item.desc) +'</span>' : '',
          '</div>'
        ].join('');
      }
601720
def render(self, **context):
		
		# Make the complete context we'll use.
		localns = self.envs.copy()
		localns.update(context)

		try:
			exec(str(self.code), None, localns)
			return localns[Liquid.COMPLIED_RENDERED_STR]
		except Exception:
			stacks = list(reversed(traceback.format_exc().splitlines()))
			for stack in stacks:
				stack = stack.strip()
				if stack.startswith('File "<string>"'):
					lineno = int(stack.split(', ')[1].split()[-1])
					source = []
					if 'NameError:' in stacks[0]:
						source.append('Do you forget to provide the data?')

					import math
					source.append('\nCompiled source (use debug mode to see full source):')
					source.append('---------------------------------------------------')
					nlines = len(self.code.codes)
					nbit   = int(math.log(nlines, 10)) + 3
					for i, line in enumerate(self.code.codes):
						if i - 7 > lineno or i + 9 < lineno: continue
						if i + 1 != lineno:
							source.append('  ' + (str(i+1) + '.').ljust(nbit) + str(line).rstrip())
						else:
							source.append('* ' + (str(i+1) + '.').ljust(nbit) + str(line).rstrip())

					raise LiquidRenderError(
						stacks[0], 
						repr(self.code.codes[lineno - 1]) + 
						'\n' + '\n'.join(source) + 
						'\n\nPREVIOUS EXCEPTION:\n------------------\n' + 
						'\n'.join(stacks) + '\n' +
						'\nCONTEXT:\n------------------\n' +
						'\n'.join(
							'  ' + key + ': ' + str(val) 
							for key, val in localns.items() if not key.startswith('_liquid_') and not key.startswith('__')
						) + '\n'
					)
			raise
350071
def render_string string, options
      escaped = html_escape(string)
      if options[:pretty]
        indent = ' ' * (options[:indent] * options[:depth])
        indent + escaped + "\n"
      else
        escaped
      end
    end
76364
def content(self, output=None, str_output=None, **kwargs):
        """"""
        if self.response.mimetype != "text/html":
            raise Failure(_("expected request to return HTML, but it returned {}").format(
                self.response.mimetype))

        # TODO: Remove once beautiful soup updates to accomodate python 3.7
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=DeprecationWarning)
            content = BeautifulSoup(self.response.data, "html.parser")

        return self._search_page(
            output,
            str_output,
            content,
            lambda regex, content: any(regex.search(str(tag)) for tag in content.find_all(**kwargs)))
235666
def htmlFormat(output, pathParts = (), statDict = None, query = None):
  """"""
  statDict = statDict or scales.getStats()
  if query:
    statDict = runQuery(statDict, query)
  _htmlRenderDict(pathParts, statDict, output)
1149007
def html_content(self):
        
        context = self.acquire_context()
        try:
            return render_placeholder(self.content_placeholder, context)
        except (AttributeError, KeyError):
            # Should happen when ``context`` and ``request``
            # have not been found in the stack.
            pass
        return self.content
641230
def render_text(text, language=None):
    
    # Get the filter
    text_filter = SUPPORTED_LANGUAGES.get(language, None)
    if not text_filter:
        raise ImproperlyConfigured("markup filter does not exist: {0}. Valid options are: {1}".format(
            language, ', '.join(list(SUPPORTED_LANGUAGES.keys()))
        ))

    # Convert.
    return text_filter(text)
766541
function renderElement(tag, attrs, content, indentStr, indentLevel) {
    let indent = indentStr.repeat(indentLevel);
    content = renderFalsey(content);
    content = isNested(content) ? ('\n' + jxh(content, indentStr, ++indentLevel) + indent) : content;
    return Tag.render(indent, tag, attrs, content);
}
1201483
def to_html(input, context = {}, result = nil)
      result = call(input, context, result = nil)
      output = result[:output]
      if output.respond_to?(:to_html)
        output.to_html
      else
        output.to_s
      end
    end
157070
def render_text(path, cp):
    

    # define filename and slug from path
    filename = os.path.basename(path)
    slug = filename.replace('.', '_')

    # initializations
    content = None

    # read file as a string
    with codecs.open(path, 'r', encoding='utf-8', errors='replace') as fp:
        content = fp.read()

    # replace all the escaped characters
    content = unescape(content, unescape_table)

    # render template
    template_dir = pycbc.results.__path__[0] + '/templates/files'
    env = Environment(loader=FileSystemLoader(template_dir))
    env.globals.update(abs=abs)
    env.globals.update(path_exists=os.path.exists)
    template = env.get_template('file_pre.html')
    context = {'filename' : filename,
               'slug'     : slug,
               'cp'       : cp,
               'content'  : content}
    output = template.render(context)

    return output
864276
def __get_html(self, body=None):
        

        output = []
        output.append("<html>")
        output.append("<head>")
        for javascript in (self.__jquery_javascript,
                           self.__crittercism_javascript,
                           self.__reporter_javascript):
            output.append("<script type=\"text/javascript\">")
            output.append(javascript)
            output.append("</script>")
        output.append("<style type=\"text/css\">")
        output.append(self.__style)
        output.append("</style>")
        output.append("</head>")
        if body is not None:
            output.append(body)
        else:
            output.append("<body>")
            output.append("<div id=\"report\">")
            output.append("</div>")
            output.append("</body>")
        output.append("</html>")
        return "\n".join(output)
228884
def pretty_render(data, format='text', indent=0):
    
    if format == 'json':
        return render_json(data)
    elif format == 'html':
        return render_html(data)
    elif format == 'xml':
        return render_xml(data)
    else:
        return dict_to_plaintext(data, indent=indent)
543801
def abstract_html(self):
        """"""
        descriptions = _pluralize(self._r['descriptions'], 'description')
        for desc in descriptions:
            if desc['@descriptionType'] == 'Abstract':
                return desc['#text']