Try rendering a view.
@private
518837
function tryRender(view, options, callback) {
  try {
    view.render(options, callback);
  } catch (err) {
    callback(err);
  }
}
484698
function findView(app, name) {
    var keys = app.viewTypes.renderable;
    var len = keys.length;
    var i = -1;

    var res = null;
    while (++i < len) {
      res = app.find(name, keys[i]);
      if (res) {
        break;
      }
    }
    return res;
  }
892934
function(id, view) {
    // No id
    if(!id) {
      throw new Error('View requires an id.');

    // Require unique id
    } else if(_viewHash[id]) {
      throw new Error('View requires a unique id');

    // Add
    } else {
      _viewHash[id] = view;
    }

    // Check if view is currently active
    var current = $state.current() || {};
    var templates = current.templates || {};
    var controllers = current.controllers || {};
    if(!!templates[id]) {
      _renderView(id, view, templates[id], controllers[id]);
    }

    // Implement destroy method
    view.destroy = function() {
      _unregister(id);
    };

    return view;
  }
1230396
function Request__render(response) {

        if (this.isRendered) {
            return false;
        }



        if (Type.isString(response)) {
            this._checkContentType('text/html');
            this.response.writeHead(this.statusCode, this.headers);

            this.addHeader('Content-Length', response.length);
            this.response.end(response);
            this.isRendered = true;
            logger.info('Request.render:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type')
            });
            return true;
        } else if (response instanceof Buffer) {
            this._checkContentType('text/html');
            this.response.writeHead(this.statusCode, this.headers);
            this.addHeader('Content-Length', response.length);
            this.response.end(response);
            this.isRendered = true;
            logger.info('Request.render:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type')
            });
            return true;
        } else if (!response) {
            logger.error('Request.error:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                response: response,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type'),
                message: 'No data to render'
            });
            throw new error.HttpError(500, {}, 'No data to render');
        } else {
            logger.error('Request.error:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                response: response,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type'),
                message: 'Invalid response type'
            });
            throw new error.HttpError(500, {}, 'Invalid response type, string or buffer is required!');
        }
    }
1369383
function getView(app, view) {
    if (typeof view !== 'string') {
      return view;
    }
    if (app.isCollection) {
      view = app.getView(view);

    } else if (app.isList) {
      view = app.getItem(view);

    } else {
      view = findView(app, view);
    }
    return view;
  }
819494
function initViews (args) {
    // create views register for model indexed by view name - these names
    // are not required to be the same as global view names
    this.views = {}
    // validate each defined view, get view model if needed
    _.each(args.views, (spec, name) => {
        // get list of model views
        var views = Array.isArray(spec) ? spec : [spec]
        // validate that all model views can be loaded
        _.each(views, view => requireValidModelView(view, args.views, true))
        // add to views
        this.views[name] = views
    })
}
792053
function render(template, locals, layoutTemplates, cb) {
    if (!layoutTemplates) layoutTemplates = [];

    // We'll render templates from bottom to top of the stack, each template
    // being passed the rendered string of the previous ones as `body`
    var i = layoutTemplates.length - 1;

    var _stackRenderer = function(err, htmlStr) {
      if (err) return cb(err);

      if (i >= 0) {
        locals.body = htmlStr;
        renderTemplate(layoutTemplates[i--], locals, _stackRenderer);
      } else {
        cb(null, htmlStr);
      }
    };

    // Start the rendering with the innermost page template
    renderTemplate(template, locals, _stackRenderer);
  }
1304044
function (view) {
    view.base = view.base || view.cwd || process.cwd();
    this.src = this.src || {};
    // ensure that `view` has `path` and `content` properties
    this.validate(view);

    this.options.orig = view.content;
    this.options.plural = this.collection.options.plural;
    this.options.viewType = this.options.viewType = [];
    this.options.handled = this.options.handled = [];

    this.contexts = view.contexts = {};
    this.locals = view.locals || {};
    this.data = view.data || {};
    mixins(this);

    // add non-emumerable properties
    this.defineOption('route', this.options.route);
    this.define('_callbacks', this._callbacks);

    if (view.stat) {
      utils.defineProp(view, 'history', view.history);
      utils.defineProp(view, '_contents', view._contents);
      utils.defineProp(view, 'stat', view.stat);
    }

    view.__proto__ = this;
    utils.defineProp(view, '_callbacks', view._callbacks);

    // handle `onLoad` middleware routes
    this.app.handleView('onLoad', view, view.locals);
    this.ctx('locals', view.locals);
    this.ctx('data', view.data);
  }
784075
function checkViews() {
  var self = this;
  // Nunjucks have 404 not found disabled by default
  if(this.config.views.engine === 'nunjucks' && typeof this.config.views.errors !== 'string') {
    self.errorViews = errorViews = {};
    return;
  }
  try {
    var errPath = Component.appPath(this.config.path.views, this.config.views.errors);
    var errorFiles = Crux.util.readDirectory(errPath, this.config.views.extension, null, true);
    _.forEach(errorFiles, function(fullPath) {
      var errCode = fullPath.replace(errPath, '').replace('.' + self.config.views.extension, '');
      var code = parseInt(errCode);
      if(!isNaN(code)) {
        errorViews[errCode] = fullPath.replace(Component.appPath(self.config.path.views), '');
      }
    });
  } catch(e) {}
  self.errorViews = errorViews;
}
1309804
function renderJade(viewFiles, viewModel, callback) {
  var jadeFile = viewFiles[0];

  if (viewFiles.length > 1) {
    console.warn('TEMPLATES: More than one possible Jade view file found, will take main or index.');
    jadeFile = _.find(viewFiles, function (file) {
      return Path.basename(file, Path.extname(file)) === 'main' || Path.basename(file, Path.extname(file)) === 'index';
    });
  }

  if (jadeFile) {
    // Handle exports.
    viewModel.basedir = Path.join(__dirname, '../templates/jade/');
    
    Consolidate.jade(jadeFile, viewModel, function (err, html) {
      if (!err) {
        callback && callback(html);
      }
      else {
        console.error('TEMPLATES: Error generating view from Jade file ' + jadeFile, err);
        callback && callback();
      }
    });
  }
  else {
    console.warn('TEMPLATES: Could not find appropriate main Jade view file, please rename your main template to main.jade or index.jade.');
    callback && callback();
  }
}
409790
function makeView(view, controller) {
  return (model, parent) => view(model, controller(model, parent));
}
1289025
function (view, engine = 'html') {
	return async function DefaultView (ctx, next) {
		await ctx.render(`${view}.${engine}`);
	};
}
16865
function(view, data, helpers, callback) {
                    return can.view.renderAs("string", view, data, helpers, callback);
                }
946715
def render_template(view, template, layout_name, locals)
        render_with_layout(view, template, layout_name, locals) do |layout|
          instrument(:template, identifier: template.identifier, layout: layout.try(:virtual_path)) do
            template.render(view, locals) { |*name| view._layout_for(*name) }
          end
        end
      end
196217
public function renderView()
    {
        if (!$this->cb->triggered()) {
            if ($this->loadEvent) {
                $this->js($this->loadEvent, $this->jsLoad());
            }
            $this->add($this->shim);
        }

        return parent::renderView();
    }
55283
function View (name) {
  if (!(this instanceof View)) {
    return new View(name);
  }
  this.name = name;
  this.config = utils.clone(config);
  this.config.pathname += '/_view/' + this.name;
}
174060
function View(attrs) {
  var view = this;
  if (typeof attrs !== 'undefined') {
    Object.keys(attrs).forEach(function (attr) {
      view[attr] = attrs[attr];
    });
  }
  if (typeof this.initialize === 'function')
    this.initialize();
}