Render a reST string as HTML.
495662
def publish_string(self, rest, outfile, styles=''):
        
        html = self.convert_string(rest)
        html = self.strip_xml_header(html)
        html = self.apply_styles(html, styles)
        self.write_file(html, outfile)
        return outfile
616067
def _render_str(self, string):
        """"""
        if isinstance(string, StrLabel):
            string = string._render(string.expr)
        string = str(string)
        if len(string) == 0:
            return ''
        name, supers, subs = split_super_sub(string)
        return render_latex_sub_super(
            name, subs, supers, translate_symbols=True)
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)
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
381577
function renderHtml (jsonString) {
	let messages = '';

	try {
		let msg = JSON.parse(jsonString).messages;
		messages = msg;
	} catch (e) {
		console.log(chalk.red('!!! OUTPUT ERROR'));
		if (e.message === 'Unexpected token E in JSON at position 1') {
			console.log(chalk.red('Possible cause of error - incorrect path or files were not found'));
		}
		return e.message;
	}

	if (!messages.length) {
		return jsonString;
	}

	let views = {};
	let counts = {
		groups: {
			info: 0,
			warning: 0,
			error: 0,
			fatal: 0,
			'non-document-error': 0
		},
		msgGroups: {}
	};

	messages.forEach((item, i) => {
		let key = item.url;
		let msg = item.message;
		let extract = item.extract;

		if (key in views) {
			views[key].list.push(item);
		} else {
			let viewName = key.replace(/\\/, '/').split('/').pop();
			let viewAnchor = viewName.replace(/\/|\.|[а-я]|\s/gi, '-');

			views[key] = {
				msgGroup: 1,
				name: viewName,
				anchor: viewAnchor,
				path: key,
				list: [
					item
				],
				errorGroups: {},
				errorCounts: {
					info: 0,
					warning: 0,
					error: 0,
					fatal: 0,
					'non-document-error': 0
				}
			};
		}

		let view = views[key];

		if (item.subType === 'warning' || item.subType === 'fatal') {
			item.processType = item.subType;
		} else {
			item.processType = item.type;
		}

		view.errorCounts[item.processType]++;
		counts.groups[item.processType]++;

		let processMsg = `${item.processType}: ${msg}`;

		if (!counts.msgGroups[processMsg]) {
			counts.msgGroups[processMsg] = {
				urls: {},
				count: 0
			};
		}

		if (!view.errorGroups[processMsg]) {
			view.errorGroups[processMsg] = {
				key: view.msgGroup++,
				count: 0
			};
		}
		counts.msgGroups[processMsg].count++;
		if (item.url) {
			counts.msgGroups[processMsg].urls[item.url] = true;
		}
		view.errorGroups[processMsg].count++;
		item.processGroup = view.errorGroups[processMsg].key;

		msg = msg.replace(/“/g, '<code>');
		msg = msg.replace(/”/g, '</code>');
		item.message = msg;

		item.badge = item.subType || item.type;
		item.firstLine = item.firstLine > -1 ? item.firstLine : item.lastLine;
		item.firstColumn = item.firstColumn > -1 ? item.firstColumn : item.lastColumn;

		if (item.hiliteStart !== undefined && item.hiliteLength) {
			let arr = [];
			let start = item.hiliteStart;
			let length = item.hiliteLength;
			let end = start + length;

			if (start > 0) {
				arr.push(extractParts(extract, 0, start));
			}

			arr.push(`<mark>${extractParts(extract, start, length)}</mark>`);
			arr.push(extractParts(extract, end));
			messages[i].extract = arr.join('');
		}
	});

	return _.template(layout)({views, counts});
}
59946
def render(self, context, request=None):
        """"""
        context['component'] = self
        return render_to_string(self.template_name, context, request)
787433
def render(obj):
    """"""
    def get_v(v):
        return v % env if isinstance(v, basestring) else v

    if isinstance(obj, types.StringType):
        return obj % env
    elif isinstance(obj, types.TupleType) or isinstance(obj, types.ListType):
        rv = []
        for v in obj:
            rv.append(get_v(v))
    elif isinstance(obj, types.DictType):
        rv = {}
        for k, v in obj.items():
            rv[k] = get_v(v)

    return rv
895381
def _repr_html_(self):
        
        # Make header.
        r = '</th><th>'.join(['Index', 'UWI', 'Data', 'Curves'])
        rows = '<tr><th>{}</th></tr>'.format(r)

        # Make rows.
        for i, w in enumerate(self.__list):
            rows += '<tr><td>{}</td>'.format(i)
            rows += '<td><strong>{}</strong></td>'.format(w.uwi)
            rows += '<td>{}&nbsp;curves</td>'.format(len(w.data))
            rows += '<td>{}</td></tr>'.format(', '.join(w.data.keys()))
        html = '<table>{}</table>'.format(rows)

        return html
974795
def render_string
      result = '<?xml version="1.0" encoding="UTF-8"?>' + "\n<urlset"

      XmlSitemap::MAP_SCHEMA_OPTIONS.each do |key, val|
        result << ' ' + key + '="' + val + '"'
      end

      result << ">\n"

      item_results = []
      @items.each do |item|
        item_string  = "  <url>\n"
        item_string << "    <loc>#{CGI::escapeHTML(item.target)}</loc>\n"

        # Format and image tag specifications found at http://support.google.com/webmasters/bin/answer.py?hl=en&answer=178636
        if item.image_location
          item_string << "    <image:image>\n"
          item_string << "      <image:loc>#{CGI::escapeHTML(item.image_location)}</image:loc>\n"
          item_string << "      <image:caption>#{CGI::escapeHTML(item.image_caption)}</image:caption>\n"               if item.image_caption
          item_string << "      <image:title>#{CGI::escapeHTML(item.image_title)}</image:title>\n"                     if item.image_title
          item_string << "      <image:license>#{CGI::escapeHTML(item.image_license)}</image:license>\n"               if item.image_license
          item_string << "      <image:geo_location>#{CGI::escapeHTML(item.image_geolocation)}</image:geo_location>\n" if item.image_geolocation
          item_string << "    </image:image>\n"
        end

        # Format and video tag specifications found at http://support.google.com/webmasters/bin/answer.py?hl=en&answer=80472&topic=10079&ctx=topic#2
        if item.video_thumbnail_location && item.video_title && item.video_description && (item.video_content_location || item.video_player_location)
          item_string << "    <video:video>\n"
          item_string << "      <video:thumbnail_loc>#{CGI::escapeHTML(item.video_thumbnail_location)}</video:thumbnail_loc>\n"
          item_string << "      <video:title>#{CGI::escapeHTML(item.video_title)}</video:title>\n"
          item_string << "      <video:description>#{CGI::escapeHTML(item.video_description)}</video:description>\n"
          item_string << "      <video:content_loc>#{CGI::escapeHTML(item.video_content_location)}</video:content_loc>\n"                           if item.video_content_location
          item_string << "      <video:player_loc>#{CGI::escapeHTML(item.video_player_location)}</video:player_loc>\n"                              if item.video_player_location
          item_string << "      <video:duration>#{CGI::escapeHTML(item.video_duration.to_s)}</video:duration>\n"                                    if item.video_duration
          item_string << "      <video:expiration_date>#{item.video_expiration_date_value}</video:expiration_date>\n"                               if item.video_expiration_date
          item_string << "      <video:rating>#{CGI::escapeHTML(item.video_rating.to_s)}</video:rating>\n"                                          if item.video_rating
          item_string << "      <video:view_count>#{CGI::escapeHTML(item.video_view_count.to_s)}</video:view_count>\n"                              if item.video_view_count
          item_string << "      <video:publication_date>#{item.video_publication_date_value}</video:publication_date>\n"                            if item.video_publication_date
          item_string << "      <video:family_friendly>#{CGI::escapeHTML(item.video_family_friendly)}</video:family_friendly>\n"                    if item.video_family_friendly
          item_string << "      <video:category>#{CGI::escapeHTML(item.video_category)}</video:category>\n"                                         if item.video_category
          item_string << "      <video:restriction relationship=\"allow\">#{CGI::escapeHTML(item.video_restriction)}</video:restriction>\n"         if item.video_restriction
          item_string << "      <video:gallery_loc>#{CGI::escapeHTML(item.video_gallery_location)}</video:gallery_loc>\n"                           if item.video_gallery_location
          item_string << "      <video:price currency=\"USD\">#{CGI::escapeHTML(item.video_price.to_s)}</video:price>\n"                            if item.video_price
          item_string << "      <video:requires_subscription>#{CGI::escapeHTML(item.video_requires_subscription)}</video:requires_subscription>\n"  if item.video_requires_subscription
          item_string << "      <video:uploader>#{CGI::escapeHTML(item.video_uploader)}</video:uploader>\n"                                         if item.video_uploader
          item_string << "      <video:platform relationship=\"allow\">#{CGI::escapeHTML(item.video_platform)}</video:platform>\n"                  if item.video_platform
          item_string << "      <video:live>#{CGI::escapeHTML(item.video_live)}</video:live>\n"                                                     if item.video_live
          item_string << "    </video:video>\n"
        end

        item_string << "    <lastmod>#{item.lastmod_value}</lastmod>\n"
        item_string << "    <changefreq>#{item.changefreq}</changefreq>\n" if item.changefreq
        item_string << "    <priority>#{item.priority}</priority>\n" if item.priority
        item_string << "  </url>\n"

        item_results << item_string
      end

      result << item_results.join("")
      result << "</urlset>\n"

      result
    end
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)
367396
def create_html(api_key, attrs):
    ''''''
    gif = get_gif(api_key, attrs['gif_id'])

    if 'alt' not in attrs.keys():
        attrs['alt'] = 'source: {}'.format(gif['data']['source'])

    html_out = '<a href="{}">'.format(gif['data']['url'])
    html_out += '<img src="{}" alt="{}">'.format(
        gif['data']['images']['original']['url'],
        attrs['alt'])
    html_out += '</a>'

    return html_out
817534
def render_to_string(self, template, context=None, def_name=None, subdir='templates'):
        ''''''
        template_adapter = self.get_template_loader(subdir).get_template(template)
        return getattr(template_adapter, 'render')(context=context, request=self.request, def_name=def_name)
769874
function render(element, opts) {
    opts = opts || {};

    var prepend = opts.prepend;
    var model = opts.model || {};
    var indentLevel = opts.indentLevel || 0;
    var isPretty = opts.isPretty;
    var jtPrintIndent = isPretty ? '\t' : '';
    var jtPrintNewline = isPretty ? '\n' : '';
    var indent = '', i, len, prop;
    var p = [];  // p is going to be our concatenator for the HTML string

    // if no element, then no HTML so return empty string
    if (!element) { return ''; }

    // if already a string, just return it
    if (utils.isString(element)) { return element; }

    // if an array, wrap it
    if (utils.isArray(element)) { element = naked(element, null); }

    // set the indentation level to the current indent
    if (isPretty && indentLevel) {
        for (i = 0; i < indentLevel; i++) {
            indent += jtPrintIndent;
        }
    }

    // if we are prepending some string, add it first
    if (prepend) {
        p.push(indent, prepend, jtPrintNewline);
    }

    // starting tag open
    if (element.tag) {
        p.push(indent, '<', element.tag);
    }

    // all tag attributes
    if (element.attributes) {
        for (prop in element.attributes) {
            if (element.attributes.hasOwnProperty(prop)) {

                if (element.attributes[prop] === null) {
                    p.push(' ', prop);
                }
                else {
                    p.push(' ', prop, '="', element.attributes[prop], '"');
                }
            }
        }
    }

    // if no children or text, then close the tag
    if (element.tag && !element.children && (element.text === undefined || element.text === null)) {

        // for self closing we just close it, else we add the end tag
        if (selfClosing.indexOf(element.tag) > -1) {
            p.push('/>', jtPrintNewline);
        }
        else {
            p.push('></', element.tag, '>', jtPrintNewline);
        }
    }
    // else we need to add children or the inner text
    else {

        // if a tag (i.e. not just a string literal) put end bracket
        if (element.tag) { p.push('>'); }

        // if children, we will need to recurse
        if (element.children) {
            if (element.tag) { p.push(jtPrintNewline); }

            // recurse down for each child
            for (i = 0, len = element.children.length; i < len; ++i) {
                p.push(render(element.children[i], {
                    indentLevel:    element.tag ? indentLevel + 1 : indentLevel,
                    isPretty:       isPretty,
                    model:          model
                }));
            }

            if (element.tag) { p.push(indent); }
        }

        // if text, simply add it
        if (element.text !== null && element.text !== undefined) { p.push(element.text); }

        // finally if a tag, add close tag
        if (element.tag) {
            p.push('</', element.tag, '>', jtPrintNewline);
        }
    }

    return p.join('');
}
1123734
function getHtmlFromMarkedMarkdown(srcStr) {
	var result = parseSource(srcStr);
	var html = md.render(result);
	return html;
}
847632
function render(that, dom, options) {
  if (!dom) {
    if (that._root && that._root.children) {
      dom = that._root.children;
    } else {
      return '';
    }
  } else if (typeof dom === 'string') {
    dom = select(dom, that._root, options);
  }

  return serialize(dom, options);
}
278365
def render(self, text, auth=None):
        
        # Ensure text is Unicode
        expected = str if sys.version_info[0] >= 3 else unicode  # noqa
        if not isinstance(text, expected):
            raise TypeError(
                'Expected a Unicode string, got {!r}.'.format(text))

        if self.user_content:
            url = '{0}/markdown'.format(self.api_url)
            data = {'text': text, 'mode': 'gfm'}
            if self.context:
                data['context'] = self.context
            data = json.dumps(data, ensure_ascii=False).encode('utf-8')
            headers = {'content-type': 'application/json; charset=UTF-8'}
        else:
            url = '{0}/markdown/raw'.format(self.api_url)
            data = text.encode('utf-8')
            headers = {'content-type': 'text/x-markdown; charset=UTF-8'}

        r = requests.post(url, headers=headers, data=data, auth=auth)
        r.raise_for_status()

        # FUTURE: Remove this once GitHub API properly handles Unicode markdown
        r.encoding = 'utf-8'

        return r.text if self.raw else patch(r.text)
277179
function (data, callback) {
            var html = '';
            var self = this;
            callback = callback || function (error, ret) {
                html = ret;
            };
            if (!self.name && self.tpl.TPL_NAME) {
                self.name = self.tpl.TPL_NAME;
            }
            var scope = new Scope(data), buffer = new LinkedBuffer(callback).head;
            renderTpl(self, scope, buffer);
            return html;
        }