annex_block is a universal helper to render content from
 the database and display it on the page
760141
def annex_block(identifier, opts = {})
      opts[:route] ||= current_route

      case Annex::config[:adapter]

      when :activerecord
        doc = Annex::Block.where(route: "#{opts[:route]}_#{identifier}").first_or_create
        content = doc.content

      when :mongoid
        doc = Annex::Block.where(route: opts[:route]).first_or_create
        content = doc.content.try(:[], identifier.to_s)

      end

      render partial: 'annex/block', locals: { content: content || opts[:default], identifier: identifier, opts: opts }
    end
398271
function renderTemplate(engine, filePath, content, context) {
    context = context || {};

    // Mutable objects to contains all blocks requiring post-processing
    var blocks = {};

    // Create nunjucks environment
    var env = engine.toNunjucks(blocks);

    // Replace shortcuts from plugin's blocks
    content = replaceShortcuts(engine.getBlocks(), filePath, content);

    return timing.measure(
        'template.render',

        Promise.nfcall(
            env.renderString.bind(env),
            content,
            context,
            {
                path: filePath
            }
        )
        .then(function(content) {
            return TemplateOutput.create(content, blocks);
        })
    );
}
6651
def render_content(options={})
      layout = ::Liquid::Template.parse("{{content}}").render({"content" => page.content})
      result = ::Liquid::Template.parse(layout).render(optional_data(options), :registers => {:controller => controller}).html_safe
    rescue => e
      log_error(e)
    ensure
      return filter_images_urls(result.to_s)
    end
267208
void renderFormContent() {

        initLocaleSelect();
        setNativeResourceInfo(m_sitePath, m_locale);
        m_contentInfoHeader = new CmsInfoHeader(m_title, null, m_sitePath, m_locale, m_iconClasses);
        m_basePanel.add(m_contentInfoHeader);
        SimplePanel content = new SimplePanel();
        content.setStyleName(org.opencms.acacia.client.css.I_CmsLayoutBundle.INSTANCE.form().formParent());
        m_basePanel.add(content);
        initEntityObserver();
        if (m_definitions.get(m_locale).hasEditorChangeHandlers()) {
            initEditorChangeHandlers(m_definitions.get(m_locale).getEditorChangeScopes());
        }
        renderEntityForm(m_entityId, m_tabInfos, content, m_basePanel.getElement());
        if ((m_clientId != null) && (getFormTabs() != null)) {

            CmsListInfoBean pageInfo = CmsContainerpageController.get().getData().getPageInfo();
            m_pageInfoHeader = new CmsInfoHeader(
                pageInfo.getTitle(),
                null,
                pageInfo.getSubTitle(),
                CmsContainerpageController.get().getData().getLocale(),
                pageInfo.getBigIconClasses());
            updateInfoHeader(CmsContentDefinition.SETTINGS_TAB_ID.equals(getFormTabs().getSelectedId()));
            getFormTabs().addSelectionHandler(new SelectionHandler<Integer>() {

                public void onSelection(SelectionEvent<Integer> event) {

                    updateInfoHeader(CmsContentDefinition.SETTINGS_TAB_ID.equals(getFormTabs().getSelectedId()));
                }
            });
        }
    }
122076
def formatted_data(encoding = nil, include_levels = 10, &block)
      return nil unless @blob

      if @formatted_data && @doc then
        yield @doc if block_given?
      else
        @formatted_data = markup_class.render(historical?, encoding, include_levels) do |doc|
          @doc = doc
          yield doc if block_given?
        end
      end

      @formatted_data
    end
1173524
def render
      extensions.reverse.inject(content) do |output, ext|
        if template_type = Tilt[ext]
          template_options = Massimo.config.options_for(ext[1..-1])
          template         = template_type.new(source_path.to_s, @line, template_options) { output }
          template.render(template_scope, template_locals)
        else
          output
        end
      end
    end
157780
def displayhtml(public_key,
                attrs,
                use_ssl=False,
                error=None):
    """"""

    error_param = ''
    if error:
        error_param = '&error=%s' % error

    if use_ssl:
        server = API_SSL_SERVER
    else:
        server = API_SERVER

    if 'lang' not in attrs:
        attrs['lang'] = get_language()[:2]

    return render_to_string(
        WIDGET_TEMPLATE,
        {'api_server': server,
         'public_key': public_key,
         'error_param': error_param,
         'lang': attrs['lang'],
         'options': mark_safe(json.dumps(attrs, indent=2))
         })
794872
function renderDocs(SITE_DIR, name) {
    const env = templates.configure();
    const nav = navigation.getNavigation();
    const components = _.find(nav.children, { id: name });

    components.children.forEach(component => {
        const dirPath = Path.join(SITE_DIR, component.path);
        console.log(dirPath);
        const htmlPath = Path.join(dirPath, 'index.html');
        const rawDir = Path.join(SITE_DIR, 'raw', component.id);

        const componentData = findComponent(component.id);
        componentData.template = pathTrimStart(
            Path.join(component.path, `${component.id}.html`),
        );

        const html = env.render('component.html', {
            navigation: nav,
            component: componentData,
            config: config,
            tokens: getTokens(),
        });

        mkdirp.sync(rawDir);
        mkdirp.sync(dirPath);

        fs.writeFileSync(htmlPath, html, 'utf-8');

        if (componentData.flavours) {
            componentData.flavours.forEach(flavour => {
                if (flavour.states) {
                    flavour.states.forEach(variant => {
                        const state = getStateFromFlavour(
                            componentData,
                            flavour.id,
                            variant.id,
                        );
                        const stateDir = Path.join(
                            rawDir,
                            flavour.id,
                            variant.id,
                        );
                        renderState(env, stateDir, nav, componentData, state);
                    });
                }

                if (flavour.state) {
                    const stateDir = Path.join(rawDir, flavour.id);
                    renderState(
                        env,
                        stateDir,
                        nav,
                        componentData,
                        flavour.state,
                    );
                }
            });
        }
    });
}
810123
function _render(text, fields, fileInfo, context) 
{
	var options = _.extend({}, default_options, this.plugin_options);
	if (options.disable === true)
		return text;
	//l.vvlogd(l.dump(options));

	_collateData(fields, options, fileInfo, context);
	if (!fields.dynamic_list)
		fields.dynamic_list = _field_dynamic_list;
	var dl = fields.dynamic_list;
	/*//debug dynlists...
	fields.dynamic_list = function() { 
		l.vlog("Dynlist for: " + fileInfo.relPath)
		dl.call(this)
		}
	*/
	return fields.content;
}
569869
def render_field(field_name, method, options={}, html_options={}, &block)
      case field_name
      when 'check_box'
        template = field_name
      else
        template = 'default_field'
      end
      @template.render(:partial => "#{BootstrapBuilder.config.template_folder}/#{template}", :locals  => {
        :builder        => self,
        :method         => method,
        :field          => @template.capture(&block),
        :label_text     => label_text(method, html_options[:label]),
        :required       => html_options[:required],
        :prepend        => html_options[:prepend],
        :append         => html_options[:append],
        :help_block     => html_options[:help_block],
        :error_messages => error_messages_for(method)
      })
    end
291887
function renderPageTree(root, renderOpts) {

    renderOpts = u.assign({ openClass:'open' }, renderOpts);

    if (renderOpts.groupBy) {
      var folderPages =
        u.map(u.groupBy(root._children, renderOpts.groupBy), function(children, name) {
          if (name === 'undefined') { name = renderOpts.defaultGroup || ''; }
          return { folderPage: true,
                   _href:      name ? '/' + u.slugify(name) + '/' : '',
                   _children:  children,
                   name:       name };
        });
      return recurse(folderPages);
    }
    else return recurse(root._children);

    function recurse(children, pid) {
      pid = pid || renderOpts.pageTreeID || 'page-tree';
      var out = '\n<ul>';

      u.each(children, function(page) {
        var ppid = (pid + '-' + page._href).replace(/\W+/g, '-').replace(/^-|-$/g,'');
        out += '\n<li' + (page._children ? ' id="' + ppid + '" class="folder"' : '') + '>'
            + (page.folderPage ?
              ((page.name || page._href) ? '<span class="folderPage">' + (page.name || u.unslugify(page._href)) + '</span>' : '') :
              renderLink(u.assign({}, renderOpts, { href:page._href, title:(page.title || page.name) })))
            + (page._children ? recurse(page._children, ppid) : '')
            + '</li>';
      });
      return out + '\n</ul>';
    }
  }
1084707
protected function clientRenderBlock()
    {
        $tmpl = $this->templates()->client('block.html');

        $data = array('count' => 0, 'sum' => 0);

        if ($this->items)
        {
            foreach ($this->items as $class)
            {
                foreach ($class as $item)
                {
                    $data['count'] += $item['count'];
                    $data['sum'] += $item['cost'] * $item['count'];
                }
            }
        }

        $html = $tmpl->compile($data);

        $html = '<div id="cart-block-container">' . $html . '</div>';

        return $html;
    }
771576
function render (template, locals, callback) {
  var engineExt =
  engineName.charAt(0) === '.' ? engineName : ('.' + engineName)
  var tmplPath = path.join(templatesDir, template + engineExt)
  var origTmplPath = path.join(origTemplatesDir, template + engineExt)

  function renderToText (html) {
    var text = htmlToText.fromString(html, {
      wordwrap: 72 // A little less than 80 characters per line is the de-facto
    // standard for e-mails to allow for some room for quoting
    // and e-mail client UI elements (e.g. scrollbar)
    })

    callback(null, html, text)
  }

  engine(tmplPath, locals)
    .then(renderToText)
    .catch(function () {
      engine(origTmplPath, locals)
        .then(renderToText)
        .catch(function (err) {
          callback(err)
        })
    })
}
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);
  }
116678
def _render_template_block_nodelist(nodelist, block_name, context):
    """"""

    # Attempt to find the wanted block in the current template.
    for node in nodelist:
        # If the wanted block was found, return it.
        if isinstance(node, BlockNode):
            # No matter what, add this block to the rendering context.
            context.render_context[BLOCK_CONTEXT_KEY].push(node.name, node)

            # If the name matches, you're all set and we found the block!
            if node.name == block_name:
                return node.render(context)

        # If a node has children, recurse into them. Based on
        # django.template.base.Node.get_nodes_by_type.
        for attr in node.child_nodelists:
            try:
                new_nodelist = getattr(node, attr)
            except AttributeError:
                continue

            # Try to find the block recursively.
            try:
                return _render_template_block_nodelist(new_nodelist, block_name, context)
            except BlockNotFound:
                continue

    # The wanted block_name was not found.
    raise BlockNotFound("block with name '%s' does not exist" % block_name)
1083911
function renderDoc(page, renderOpts) {
    if (generator.renderOpts !== defaultRenderOpts) return log(new Error('Recursive call to renderDoc'));
    var rOpts = generator.renderOpts = function() { return u.assign({}, defaultRenderOpts(page), renderOpts); };
    var out = renderTemplate(page, docTemplate(page), rOpts()); // synchronous
    generator.renderOpts = defaultRenderOpts;
    return out;
  }
1254343
def render context=nil, template_or_src=nil, &block
      compiled_template = compile(template_or_src, &block)
      context.instance_eval compiled_template
    end