Renders a new view.  If data is passed in, uses that to render the view.
@param {Object} options standard options passed to a new view.
@param {optional:Object} data
@return {String}
500276
function(options, data, helpers) {
      if (!helpers) helpers = this._extras;
      if (!data) data = this._data;
      return new EJS(options).render(data, helpers);
    }
343274
public function provide($data = null, array $options = [])
    {
        $result = '';
        $data = (string)$data;

        $listName = null;
        // Take list name from options or from fieldDefinitions
        if (!empty($options['listName'])) {
            $listName = (string)$options['listName'];
        } elseif (!empty($options['fieldDefinitions'])) {
            $listName = $options['fieldDefinitions']->getLimit();
        }

        // No known list name, so render value as safe string
        if (empty($listName)) {
            return parent::provide($data, $options);
        }

        return $this->config->getView()
            ->cell('CsvMigrations.Dblist::renderValue', [$data, $listName])
            ->render('renderValue');
    }
1133208
public function provide($data = null, array $options = [])
    {
        $result = null;

        if (empty($data)) {
            return $result;
        }

        $relatedProperties[] = $this->_getRelatedProperties($options['fieldDefinitions']->getLimit(), $data);

        if (!empty($relatedProperties[0]['config']['parent']['module'])) {
            array_unshift(
                $relatedProperties,
                $this->_getRelatedParentProperties($relatedProperties[0])
            );
        }

        $elementName = 'CsvMigrations.FieldHandlers/RelatedFieldHandler/view';
        $params = [
            'relatedProperties' => $relatedProperties,
            'options' => $options,
        ];

        return $this->renderElement($elementName, $params);
    }
916359
public function provide($data = null, array $options = [])
    {
        $template = $this->getBasicTemplate('text');
        $defaultOptions = $this->getDefaultOptions($data, $options);
        $defaultOptions['input'] = ['content' => $template];

        $result[$this->config->getField()] = $defaultOptions;

        $className = $this->config->getProvider('selectOptions');
        $provider = new $className($this->config);

        $selectOptions = $provider->provide($options['fieldDefinitions']->getLimit());

        $view = $this->config->getView();
        $content = $view->Form->select('{{name}}', $selectOptions, [
            'class' => 'form-control',
            'label' => false
        ]);

        foreach ($selectOptions as $key => $value) {
            $result[$this->config->getField()]['options'][] = ['value' => $key, 'label' => $value];
        }
        $result[$this->config->getField()]['input'] = ['content' => $content];

        return $result;
    }
808699
function render (file, options, callback) {
    debug('render', file, options)
    // load layouts
    var layouts = loadLayouts(options)
    // load partials
    var partials = loadPartials(options)
    // get template function
    var template = loadTemplate(file, options)
    // wait for all promises to resolve
    return Promise.all([
        layouts,
        partials,
        template,
    ])
    // once all promises resolved render template
    .then(all => {
        var layouts = all[0]
        var partials = all[1]
        var template = all[2]
        // render options
        var hbsOptions = {
            helpers: GLOBAL.helpers,
            partials: partials,
        }
        // render template
        var body = template(options, hbsOptions)
        // get layout from options or default layout
        var layout = options.layout || GLOBAL.defaultLayout
        // use layout if found
        if (layout && layouts[layout]) {
            // pass layout contents of template render along with other params
            options.body = body
            // render layout
            body = layouts[layout](options, hbsOptions)
        }
        // if callback is passed then call with result
        if (callback) {
            callback(null, body)
        }
        // otherwise resolve with result
        else {
            return body
        }
    })
}
814704
function (data, defaults, callback) {
  // Flatten everything for ease of use.
  var options = _.defaults({}, data, data.options, defaults)

  callback(null, options)
}
542118
function _render_option(){

	var buf = new Array();

	// Sort the items in the mdata array.
	// Also keep a lookup for a "special" entry.
	// var default_on_p = false;
	var mdata_keys = bbop.core.get_keys(anchor.mdata);
	function _data_comp(a, b){

	    // Get the associated data.
	    var a_data = anchor.mdata[a];
	    var b_data = anchor.mdata[b];

	    // if( (a_data['special'] == true && a_data['selected'] == true) ||
	    // 	(b_data['special'] == true && b_data['selected'] == true) ){
	    // 	default_on_p = true;
	    // }

	    //
	    var retval = 0;
	    if( a_data['special'] != b_data['special'] ){
		if( a_data['count'] == true ){
		    retval = 1;
		}else{
		    retval = -1;
		}
	    }else if( a_data['count'] != b_data['count'] ){
		if( a_data['count'] > b_data['count'] ){
		    retval = -1;
		}else{
		    retval = 1;
		}
	    }else if( a_data['label'] != b_data['label'] ){
		if( a_data['label'] > b_data['label'] ){
		    retval = 1;
		}else{
		    retval = -1;
		}
	    }

	    return retval;
	}
	mdata_keys.sort(_data_comp); // inplace sort

	//
	for( var mski = 0; mski < mdata_keys.length; mski++ ){

	    var write_data = anchor.mdata[mdata_keys[mski]];
	    
	    // Write out option if:
	    // 1) the default is selected (so we want to see everything)
	    // 2) the selection is special
	    // 3) if the default is not selected, either the item is selected or
	    // 4) it has a count (and is thus interesting)
	    if( // default_on_p == true ||
	    	write_data['selected'] == true ||
	    	write_data['special'] == true ||
	    	( write_data['count'] && write_data['count'] > 0 ) ){
		    
		    buf.push('<option');
		    // Title.
		    buf.push(' title="');
		    buf.push(write_data['value']);
		    buf.push('"');		
		    // Value.
		    buf.push(' value="');
		    buf.push(write_data['value']);
		    buf.push('"');		
		    if( write_data['selected'] ){
			buf.push(' selected="selected"');
		    }
		    buf.push('>');
		    //buf.push(bbop.core.crop(write_data['label']));
		    buf.push(bbop.core.crop(write_data['label'], 40, '...'));
		    
		    if( write_data['count'] && write_data['count'] > 0 ){
			buf.push(' (' + write_data['count'] + ')');
		    }
		    
		    buf.push('</option>');
		}
		
	}
	return buf.join('');
    }
331004
function (format, view, data, helpers, callback, nodelist) {
		// if callback has expression prop its actually the nodelist
		if (callback !== undefined && typeof callback.expression === 'string') {
			nodelist = callback;
			callback = undefined;
		}
		
		// If helpers is a `function`, it is actually a callback.
		if (isFunction(helpers)) {
			callback = helpers;
			helpers = undefined;
		}

		// give templates the can namespace:
		helpers = Object.assign({ can: can }, helpers);

		// See if we got passed any deferreds.
		var deferreds = getDeferreds(data);
		var deferred, dataCopy, async, response;
		if (deferreds.length) {
			// Does data contain any deferreds?
			// The deferred that resolves into the rendered content...
			deferred = new Deferred();
			dataCopy = Object.assign({}, data);

			// Add the view request to the list of deferreds.
			deferreds.push(getRenderer(view, true));
			// Wait for the view and all deferreds to finish...
			Deferred.when.apply(can, deferreds)
				.then(function (resolved) {
					// Get all the resolved deferreds.
					var objs = makeArray(arguments),
						// Renderer is the last index of the data.
						renderer = objs.pop(),
						// The result of the template rendering with data.
						result;

					// Make data look like the resolved deferreds.
					if (isDeferred(data)) {
						dataCopy = usefulPart(resolved);
					} else {
						// Go through each prop in data again and
						// replace the defferreds with what they resolved to.
						for (var prop in data) {
							if (isDeferred(data[prop])) {
								dataCopy[prop] = usefulPart(objs.shift());
							}
						}
					}

					// Get the rendered result.
					result = can.view.renderTo(format, renderer, dataCopy, helpers, nodelist);

					// Resolve with the rendered view.
					deferred.resolve(result, dataCopy);

					// If there's a `callback`, call it back with the result.
					if (callback) {
						callback(result, dataCopy);
					}
				}, function () {
					deferred.reject.apply(deferred, arguments);
				});
			// Return the deferred...
			return deferred;
		} else {

			// If there's a `callback` function
			async = isFunction(callback);
			
			// get is called async but in
			// ff will be async so we need to temporarily reset
			deferred = Observation.ignore(getRenderer)(view, async);

			// If we are `async`...
			if (async) {
				// Return the deferred
				response = deferred;
				// And fire callback with the rendered result.
				deferred.then(function (renderer) {
					callback(data ? $view.renderTo(format, renderer, data, helpers, nodelist) : renderer);
				});
			} else {
				// if the deferred is resolved, call the cached renderer instead
				// this is because it's possible, with recursive deferreds to
				// need to render a view while its deferred is _resolving_.  A _resolving_ deferred
				// is a deferred that was just resolved and is calling back it's success callbacks.
				// If a new success handler is called while resoliving, it does not get fired by
				// jQuery's deferred system.  So instead of adding a new callback
				// we use the cached renderer.
				// We also add __view_id on the deferred so we can look up it's cached renderer.
				// In the future, we might simply store either a deferred or the cached result.
				if (deferred.state() === 'resolved' && deferred.__view_id) {
					var currentRenderer = $view.cachedRenderers[deferred.__view_id];
					var result =  data ? $view.renderTo(format, currentRenderer, data, helpers, nodelist) : currentRenderer;
					return result;
				} else {
					// Otherwise, the deferred is complete, so
					// set response to the result of the rendering.
					deferred.then(function (renderer) {
						response = data ? $view.renderTo(format, renderer, data, helpers, nodelist) : renderer;
					});
				}
			}

			return response;
		}
	}
698592
def _render_template(options)
        if options.delete(:stream)
          Rack::Chunked::Body.new view_renderer.render_body(view_context, options)
        else
          super
        end
      end
271415
function render(view, options) {
  var self = this;
  options = options || {};

  for (var name in settings._filters) {
    options[name] = settings._filters[name];
  }

  if (settings.helpers) {
    for (var k in settings.helpers) {
      var helper = settings.helpers[k];
      if (typeof helper === 'function') {
        helper = helper(self.req, self);
      }
      if (!options.hasOwnProperty(k)) {
        options[k] = helper;
      }
    }
  }

  if (settings.filters) {
    for (var name in settings.filters) {
      options[name] = settings.filters[name];
    }
  }

  // add request to options
  if (!options.request) {
    options.request = self.req;
  }
  // render view template
  _render(view, options, function (err, str) {
    if (err) {
      return self.req.next(err);
    }
    var layout = typeof options.layout === 'string' ? options.layout : settings.layout;
    if (options.layout === false || !layout) {
      return send(self, str);
    }
    // render layout template, add view str to layout's locals.body;
    options.body = str;
    _render(layout, options, function (err, str) {
      if (err) {
        return self.req.next(err);
      }
      send(self, str);
    });
  });
  return this;
}
1317373
function Renderer(options) {
  options = options || {};
  this.MD   = new MDRenderer(options);
  this.CGMD = new CGMDRenderer(new MDRenderer(options));

  return this;
}
1314969
protected function renderHtml($name = null, $data = []) {
        if (is_array($name)) {
            $data = $name;
            $name = null;
        }
        return $this->renderFile($this->getViewFile($name), $data);
    }
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;
        }
1031499
def render(view_options=configuration)
      logger.debug "rendering"
      result = ""
      if template
        logger.debug "rendering with template : #{template}"
        view = AppView.new(items, view_options)
        view.template = template
        result = view.render
      else
        items.each_with_index do |item, index|
          result += "\n" unless index == 0
          result += item.name.green + ":\n"
          if item.respond_to?(:attributes)
            attributes = item.attributes.deep_clone
            result += attributes.recursively_stringify_keys!.to_conf.gsub(/\s+$/, '') # strip trailing whitespace from YAML
            result += "\n"
          end
        end
      end
      result
    end
799356
public function make($data, $options=array())
	{
		// Options
		$this->options = array_merge($this->options, $options);
		$options       = $this->options;

		// Capture output
		$out  = [];

		// @todo - Raise an exception instead ?
		// Would make more send and could be handled more gracefully
		//
		// Have any records actually been passed through ?
		if (empty($data)) {
			return $this->hasNoData($options);
		}

		// If a 'id' key has been specified use that as the table#id
		$tableId = null;

		if (!empty($options['id'])) {
			$tableId = "id='{$options['id']}'";
		}

		$out[] = "<div class=\"{$options['wrapperClass']}\">";
		$out[] = "\t<table class='{$options['containerClass']}' {$tableId}>";

		// Render headers
		if (true == $options['showHeaders']) {
			$headers = $this->extractHeaders($data);

			$out[] = "\t\t<thead>\r\t\t\t<tr class=\"{$options['headerClass']}\">";
			$count = 1;

			/**
			 * Create the <th> tag
			 */
			foreach ($headers as $index => $header)
			{
				$class = $this->getHeaderClass($header, $count);
				$count++;

				// Apply sort links to header
				if (isset($options['sort'][$header])) {

					$sortBy = $options['sort'][$header];
					$label  = $header;

					$header = $this->applyHeaderSort($label, $sortBy);
				}

				$out[] = "\t\t\t\t<th class=\"{$class}\">{$header}</th>";
			}

			$out[] = "\t\t\t</tr>\r\t\t</thead>";
		}

		$out[] = "\t\t<tbody>";

		// Render rows
		foreach ($data as $index => $row)
		{
			$rowClass = ($index % 2 == 0) ? $options['rowClass'] : $options['rowClassAlt'];

			if (isset($row['id'])) {
				$out[] = "\t\t\t<tr class='{$rowClass}' id='{$row['id']}-{$row['id']}'>";
			} else {
				$out[] = "\t\t\t<tr class='{$rowClass}'>";
			}

			foreach ($row as $field => $value) {
				$indent = "";
				if ($field == 'Title' && isset($options['type']) && $options['type'] == 'table-tree') {
					if (!empty($row['parent_id'])) {
						$indent = str_repeat($options['indent_style'], $row['depth']);
					}
				}

				if (in_array($field, $options['hiddenFields'], true)) {
					continue;
				}

				$fieldClass = $options['fieldClass'];

				if (is_array($value)) {
					//Log::info('@todo - Replace with logging interface');
					//$value = implode(',' $value);
					$value = 'Array';
				}

				$out[] = "\t\t\t\t<td class=\"{$fieldClass}\">{$value}</td>";

			}

			$out[] = "\t\t\t</tr>";
		}

		$out[] = "\t\t</tbody>";
		$out[] = "\t</table>";
		$out[] = "</div>";

		$this->output['table'] = implode(PHP_EOL, $out);

		return $this;
	}
1146148
function compile (str, options) {
    var id;
    var render;

    str = str || EMPTY;
    options = options || {};

    id = options.id || str;

    render = eoraptor[id];
    if (render) {
        return render;
    }

    var oTag = options.oTag || OTAG;
    var cTag = options.cTag || CTAG;

    var code = build(parse(str, oTag, cTag));

    render = function (data) {
        var result;
        try {

            result = new Function('data', codePrefix + code)(data);
        } catch(err) {
            console.error('"' +err.message + '" from data and tpl below:');
            console.log(data);
            console.log(str);
        }
        return result;
    };

    render.render = render;
    render.source = 'function (data) {\n' + code + '\n}';
    return eoraptor[id] = render;
}
309646
function(data) {
		try {
		    this.options.language = new TL.Language(this.options);

		    this._initData(data);
		} catch(e) {
		    this.showMessage(this._translateError(e));
		}
	}